diff --git a/cypress.config.js b/cypress.config.js index ec7231e..2e80286 100644 --- a/cypress.config.js +++ b/cypress.config.js @@ -12,7 +12,7 @@ const defaultCommandTimeout = process.env.NODE_ENV === "develop" ? 10000 : 4000; module.exports = defineConfig({ e2e: { baseUrl: process.env.CYPRESS_MAGENTO2_BASE_URL || envConfig.MAGENTO2_BASE_URL || baseUrl, - specPattern: process.env.CYPRESS_MAGENTO2_SPEC_PATTERN || envConfig.MAGENTO2_SPEC_PATTERN ||'cypress/integration/hyva/**/*.spec.js', + specPattern: process.env.CYPRESS_MAGENTO2_SPEC_PATTERN || envConfig.MAGENTO2_SPEC_PATTERN ||'cypress/integration/**/*.spec.js', excludeSpecPattern: process.env.CYPRESS_MAGENTO2_EXCLUDE_PATTERN || envConfig.MAGENTO2_EXCLUDE_PATTERN || '', defaultCommandTimeout: process.env.CYPRESS_MAGENTO2_DEFAULT_TIMEOUT || envConfig.MAGENTO2_DEFAULT_TIMEOUT || defaultCommandTimeout, watchForFileChanges: false, diff --git a/cypress/integration/luma/cart/minicart.spec.js b/cypress/integration/luma/cart/minicart.spec.js index 92f41b5..ccef8d7 100644 --- a/cypress/integration/luma/cart/minicart.spec.js +++ b/cypress/integration/luma/cart/minicart.spec.js @@ -3,7 +3,7 @@ import selectors from "../../../fixtures/luma/selectors/minicart" describe('Mini cart tests', () => { beforeEach(() => { - cy.removeLocalStorage(); + cy.restoreLocalStorage(); cy.clearCookies(); cy.visit(minicart.didiSportWatch) cy.get(selectors.addToCartButton).click() diff --git a/cypress/integration/luma/products/category.spec.js b/cypress/integration/luma/products/category.spec.js index 237f107..b9d6711 100644 --- a/cypress/integration/luma/products/category.spec.js +++ b/cypress/integration/luma/products/category.spec.js @@ -6,7 +6,7 @@ import {isMobile} from "../../../support/utils"; describe('Category page tests', () => { beforeEach(() => { - cy.visit(Product.routes.category) + cy.visit(product.categoryUrl) cy.wait(3000) }) diff --git a/cypress/integration/luma/products/product.spec.js b/cypress/integration/luma/products/product.spec.js index b64d363..77c71c4 100644 --- a/cypress/integration/luma/products/product.spec.js +++ b/cypress/integration/luma/products/product.spec.js @@ -52,8 +52,9 @@ describe('Simple Product test suite', () => { }) it('Can\'t add a product to a wishlist when the user in not logged in', () => { + cy.wait(3000) cy.get(selectors.addToWishlistButtonGuest).click() - cy.wait(2000) + cy.wait(3000) cy.get(selectors.errorMessage) .should('exist') .should("contain.text", 'You must login or register to add items to your wishlist.') diff --git a/cypress/integration/luma/user/account.spec.js b/cypress/integration/luma/user/account.spec.js index 8b63421..1c71454 100644 --- a/cypress/integration/luma/user/account.spec.js +++ b/cypress/integration/luma/user/account.spec.js @@ -36,7 +36,7 @@ describe('Account activities', () => { after(() => { // Remove the added address - cy.wait(2500) + cy.wait(4000) Account.login(account.customer.customer.email, account.customer.password) cy.visit('/customer/address') cy.wait(4000) @@ -68,7 +68,6 @@ describe('Account activities', () => { }) it('Can change the profile values', () => { - Account.login(account.customer.customer.email, account.customer.password) let fn = account.tempCustomerInfo.firstname, ln = account.tempCustomerInfo.lastname cy.visit(account.routes.accountEdit) @@ -85,6 +84,9 @@ describe('Account activities', () => { cy.get(selectorsLuma.accountFirstnameInputSelector).should('have.value', fn) cy.get(selectorsLuma.accountLastnameInputSelector).should('have.value', ln) }) + cy.wait(8000) + cy.get(':nth-child(2) > .customer-welcome > .customer-name > .action').click() + cy.contains('Sign Out').click() }) }) @@ -131,6 +133,10 @@ describe('Account activities', () => { cy.visit(checkout.checkoutUrl) cy.wait(7000) // this shouldn't be needed but for some reason it doesn't work without cy.get('.shipping-address-item.selected-item').should('have.length', 1) + cy.visit('/') + cy.wait(3000) + cy.get(':nth-child(2) > .customer-welcome > .customer-name > .action').click() + cy.contains('Sign Out').click() }) it('Can remove an address', () => { @@ -165,7 +171,7 @@ describe('Account activities', () => { it('Can log out', () => { cy.get(selectorsLuma.accountIcon).click({force: true}) - cy.get(selectorsLuma.accountMenu).contains('Sign Out').click({force: true}) + cy.get(selectorsLuma.accountMenuItems).contains('Sign Out').click({force: true}) cy.get(selectorsLuma.signedOutHeader).should('contain.text', 'You are signed out') cy.wait(2000) }) @@ -195,6 +201,10 @@ describe('Guest user test', () => { }) it('Can login from checkout', () => { + cy.visit('/') + cy.wait(3000) + cy.get(':nth-child(2) > .customer-welcome > .customer-name > .action').click() + cy.contains('Sign Out').click() cy.visit(product.simpleProductUrl) cy.wait(4000) cy.get(checkoutSelectors.addToCartButton).should('contain.text', 'Add to Cart').click() @@ -205,5 +215,10 @@ describe('Guest user test', () => { cy.get(checkoutSelectors.checkoutPasswordLabel).type(account.customer.password) cy.wait(1000) cy.get('button[data-action="checkout-method-login"]').click() + cy.wait(4000) + cy.visit('/') + cy.wait(3000) + cy.get(':nth-child(2) > .customer-welcome > .customer-name > .action').click() + cy.contains('Sign Out').click() }) }) diff --git a/cypress/page-objects/luma/account.js b/cypress/page-objects/luma/account.js index f4fbfc0..a03b498 100644 --- a/cypress/page-objects/luma/account.js +++ b/cypress/page-objects/luma/account.js @@ -5,7 +5,6 @@ import {isMobile} from "../../support/utils"; export class Account { static login(user, pw) { cy.visit(account.routes.accountIndex); - cy.wait(2000) cy.get(selectors.loginEmailInputSelector).type(user) cy.get(selectors.loginPasswordInputSelector).type(`${pw}{enter}`) } diff --git a/cypress/support/commands.js b/cypress/support/commands.js index f22e147..e69de29 100644 --- a/cypress/support/commands.js +++ b/cypress/support/commands.js @@ -1 +0,0 @@ -import 'cypress-localstorage-commands'