Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Adapting Luma tests to cypress 10 version #61

Merged
merged 1 commit into from
Aug 10, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion cypress.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -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 || '',
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This default value doesn't make any sense, since it causes both the luma and the hyva tests to be executed.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

defaultCommandTimeout: process.env.CYPRESS_MAGENTO2_DEFAULT_TIMEOUT || envConfig.MAGENTO2_DEFAULT_TIMEOUT || defaultCommandTimeout,
watchForFileChanges: false,
Expand Down
2 changes: 1 addition & 1 deletion cypress/integration/luma/cart/minicart.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -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()
Expand Down
2 changes: 1 addition & 1 deletion cypress/integration/luma/products/category.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -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)
})

Expand Down
3 changes: 2 additions & 1 deletion cypress/integration/luma/products/product.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -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.')
Expand Down
21 changes: 18 additions & 3 deletions cypress/integration/luma/user/account.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down Expand Up @@ -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)
Expand All @@ -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()
})
})

Expand Down Expand Up @@ -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', () => {
Expand Down Expand Up @@ -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)
})
Expand Down Expand Up @@ -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()
Expand All @@ -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()
})
})
1 change: 0 additions & 1 deletion cypress/page-objects/luma/account.js
Original file line number Diff line number Diff line change
Expand Up @@ -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}`)
}
Expand Down
1 change: 0 additions & 1 deletion cypress/support/commands.js
Original file line number Diff line number Diff line change
@@ -1 +0,0 @@
import 'cypress-localstorage-commands'