summaryrefslogtreecommitdiff
path: root/src/frontend/cypress/e2e/Home.cy.ts
diff options
context:
space:
mode:
Diffstat (limited to 'src/frontend/cypress/e2e/Home.cy.ts')
-rw-r--r--src/frontend/cypress/e2e/Home.cy.ts28
1 files changed, 28 insertions, 0 deletions
diff --git a/src/frontend/cypress/e2e/Home.cy.ts b/src/frontend/cypress/e2e/Home.cy.ts
new file mode 100644
index 0000000..300912f
--- /dev/null
+++ b/src/frontend/cypress/e2e/Home.cy.ts
@@ -0,0 +1,28 @@
+// Copyright The OpenTelemetry Authors
+// SPDX-License-Identifier: Apache-2.0
+
+import getSymbolFromCurrency from 'currency-symbol-map';
+import SessionGateway from '../../gateways/Session.gateway';
+import { CypressFields, getElementByField } from '../../utils/Cypress';
+
+describe('Home Page', () => {
+ beforeEach(() => {
+ cy.visit('/');
+ });
+
+ it('should validate the home page', () => {
+ getElementByField(CypressFields.HomePage).should('exist');
+ getElementByField(CypressFields.ProductCard, getElementByField(CypressFields.ProductList)).should('have.length', 10);
+
+ getElementByField(CypressFields.SessionId).should('contain', SessionGateway.getSession().userId);
+ });
+
+ it('should change currency', () => {
+ getElementByField(CypressFields.CurrencySwitcher).select('EUR');
+ getElementByField(CypressFields.ProductCard, getElementByField(CypressFields.ProductList)).should('have.length', 10);
+
+ getElementByField(CypressFields.CurrencySwitcher).should('have.value', 'EUR');
+
+ getElementByField(CypressFields.ProductCard).should('contain', getSymbolFromCurrency('EUR'));
+ });
+});