Skip to content

Cypress update #4782

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

Open
wants to merge 6 commits into
base: main
Choose a base branch
from
Open
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 .github/workflows/workflow.yml
Original file line number Diff line number Diff line change
Expand Up @@ -139,7 +139,7 @@ jobs:

cypress:
name: Cypress E2E Tests
needs: [check, php-cs-fixer]
needs: [check]
if: |
needs.check.outputs.cypress > 0 ||
needs.check.outputs.php > 0 ||
Expand Down
2 changes: 1 addition & 1 deletion cypress/e2e/openmage/backend/catalog/categories.cy.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
const route = cy.testRoutes.backend.catalog.categories
const route = cy.testRoutes.backend.catalog.categories;

describe(`Checks admin system "${route.h3}"`, () => {
beforeEach('Log in the user', () => {
Expand Down
2 changes: 1 addition & 1 deletion cypress/e2e/openmage/backend/catalog/products.cy.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
const route = cy.testRoutes.backend.catalog.products
const route = cy.testRoutes.backend.catalog.products;

describe(`Checks admin system "${route.h3}"`, () => {
beforeEach('Log in the user', () => {
Expand Down
2 changes: 1 addition & 1 deletion cypress/e2e/openmage/backend/catalog/search.cy.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
const route = cy.testRoutes.backend.catalog.search
const route = cy.testRoutes.backend.catalog.search;

describe(`Checks admin system "${route.h3}"`, () => {
beforeEach('Log in the user', () => {
Expand Down
2 changes: 1 addition & 1 deletion cypress/e2e/openmage/backend/catalog/sitemap.cy.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
const route = cy.testRoutes.backend.catalog.sitemap
const route = cy.testRoutes.backend.catalog.sitemap;

describe(`Checks admin system "${route.h3}"`, () => {
beforeEach('Log in the user', () => {
Expand Down
2 changes: 1 addition & 1 deletion cypress/e2e/openmage/backend/catalog/urlrewrites.cy.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
const route = cy.testRoutes.backend.catalog.urlrewrite
const route = cy.testRoutes.backend.catalog.urlrewrite;

describe(`Checks admin system "${route.h3}"`, () => {
beforeEach('Log in the user', () => {
Expand Down
2 changes: 1 addition & 1 deletion cypress/e2e/openmage/backend/cms/block.cy.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
const route = cy.testRoutes.backend.cms.block
const route = cy.testRoutes.backend.cms.block;

describe(`Checks admin system "${route.h3}"`, () => {
beforeEach('Log in the user', () => {
Expand Down
2 changes: 1 addition & 1 deletion cypress/e2e/openmage/backend/cms/page.cy.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
const route = cy.testRoutes.backend.cms.page
const route = cy.testRoutes.backend.cms.page;

describe(`Checks admin system "${route.h3}"`, () => {
beforeEach('Log in the user', () => {
Expand Down
2 changes: 1 addition & 1 deletion cypress/e2e/openmage/backend/cms/widget.cy.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
const route = cy.testRoutes.backend.cms.widget
const route = cy.testRoutes.backend.cms.widget;

describe(`Checks admin system "${route.h3}"`, () => {
beforeEach('Log in the user', () => {
Expand Down
2 changes: 1 addition & 1 deletion cypress/e2e/openmage/backend/customer/group.cy.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
const route = cy.testRoutes.backend.customers.groups
const route = cy.testRoutes.backend.customers.groups;

describe(`Checks admin system "${route.h3}"`, () => {
beforeEach('Log in the user', () => {
Expand Down
2 changes: 1 addition & 1 deletion cypress/e2e/openmage/backend/customer/manage.cy.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
const route = cy.testRoutes.backend.customers.manage
const route = cy.testRoutes.backend.customers.manage;

describe(`Checks admin system "${route.h3}"`, () => {
beforeEach('Log in the user', () => {
Expand Down
2 changes: 1 addition & 1 deletion cypress/e2e/openmage/backend/customer/online.cy.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
const route = cy.testRoutes.backend.customers.online
const route = cy.testRoutes.backend.customers.online;

describe(`Checks admin system "${route.h3}"`, () => {
beforeEach('Log in the user', () => {
Expand Down
6 changes: 5 additions & 1 deletion cypress/e2e/openmage/backend/login.cy.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ describe('Check admin login', () => {
cy.visit('/admin');
});

const login = cy.openmage.login.admin
const login = cy.openmage.login.admin;

it('tests valid login', () => {
const username = login.username.value;
Expand All @@ -13,6 +13,7 @@ describe('Check admin login', () => {
cy.get(login.username._id).clear().type(username).should('have.value', username);
cy.get(login.password._id).clear().type(password).should('have.value', password);
cy.get(login._submit.__selector).click();
cy.url().should('include', '/dashboard/index');
})

it('tests invalid login', () => {
Expand All @@ -23,11 +24,14 @@ describe('Check admin login', () => {
cy.get(login.username._id).clear().type(username).should('have.value', username);
cy.get(login.password._id).clear().type(password).should('have.value', password);
cy.get(login._submit.__selector).click();
cy.url().should('include', '/index/index');
})

it('tests empty login', () => {
cy.get(login.username._id).clear().should('have.value', '');
cy.get(login.password._id).clear().should('have.value', '');
cy.get(login._submit.__selector).click();
cy.url().should('not.include', '/index/index');
cy.url().should('not.include', '/index/dashboard');
})
})
2 changes: 1 addition & 1 deletion cypress/e2e/openmage/backend/newsletter/queue.cy.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
const route = cy.testRoutes.backend.newsletter.queue
const route = cy.testRoutes.backend.newsletter.queue;

describe(`Checks admin system "${route.h3}"`, () => {
beforeEach('Log in the user', () => {
Expand Down
2 changes: 1 addition & 1 deletion cypress/e2e/openmage/backend/newsletter/report.cy.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
const route = cy.testRoutes.backend.newsletter.report
const route = cy.testRoutes.backend.newsletter.report;

describe(`Checks admin system "${route.h3}"`, () => {
beforeEach('Log in the user', () => {
Expand Down
2 changes: 1 addition & 1 deletion cypress/e2e/openmage/backend/newsletter/subscriber.cy.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
const route = cy.testRoutes.backend.newsletter.subscriber
const route = cy.testRoutes.backend.newsletter.subscriber;

describe(`Checks admin system "${route.h3}"`, () => {
beforeEach('Log in the user', () => {
Expand Down
2 changes: 1 addition & 1 deletion cypress/e2e/openmage/backend/newsletter/templates.cy.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
const route = cy.testRoutes.backend.newsletter.templates
const route = cy.testRoutes.backend.newsletter.templates;

describe(`Checks admin system "${route.h3}"`, () => {
beforeEach('Log in the user', () => {
Expand Down
2 changes: 1 addition & 1 deletion cypress/e2e/openmage/backend/promo/cart.cy.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
const route = cy.testRoutes.backend.promo.cart
const route = cy.testRoutes.backend.promo.cart;

describe(`Checks admin system "${route.h3}"`, () => {
beforeEach('Log in the user', () => {
Expand Down
2 changes: 1 addition & 1 deletion cypress/e2e/openmage/backend/promo/catalog.cy.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
const route = cy.testRoutes.backend.promo.catalog
const route = cy.testRoutes.backend.promo.catalog;

describe(`Checks admin system "${route.h3}"`, () => {
beforeEach('Log in the user', () => {
Expand Down
2 changes: 1 addition & 1 deletion cypress/e2e/openmage/backend/sales/creditmemo.cy.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
const route = cy.testRoutes.backend.sales.creditmemo
const route = cy.testRoutes.backend.sales.creditmemo;

describe(`Checks admin system "${route.h3}"`, () => {
beforeEach('Log in the user', () => {
Expand Down
2 changes: 1 addition & 1 deletion cypress/e2e/openmage/backend/sales/invoice.cy.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
const route = cy.testRoutes.backend.sales.invoice
const route = cy.testRoutes.backend.sales.invoice;

describe(`Checks admin system "${route.h3}"`, () => {
beforeEach('Log in the user', () => {
Expand Down
2 changes: 1 addition & 1 deletion cypress/e2e/openmage/backend/sales/order.cy.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
const route = cy.testRoutes.backend.sales.order
const route = cy.testRoutes.backend.sales.order;

describe(`Checks admin system "${route.h3}"`, () => {
beforeEach('Log in the user', () => {
Expand Down
2 changes: 1 addition & 1 deletion cypress/e2e/openmage/backend/sales/shipment.cy.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
const route = cy.testRoutes.backend.sales.shipment
const route = cy.testRoutes.backend.sales.shipment;

describe(`Checks admin system "${route.h3}"`, () => {
beforeEach('Log in the user', () => {
Expand Down
2 changes: 1 addition & 1 deletion cypress/e2e/openmage/backend/sales/transactions.cy.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
const route = cy.testRoutes.backend.sales.transactions
const route = cy.testRoutes.backend.sales.transactions;

describe(`Checks admin system "${route.h3}"`, () => {
beforeEach('Log in the user', () => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ describe(`Checks admin system "${route.h3}" settings`, () => {
});

it(`tests non-digit dimensions`, () => {
const value = cy.openmage.validation.assert.float;
const value = cy.openmage.validation.test.float;

Object.keys(validate.dimension._input).forEach(section => {
const group = validate.dimension._input[section];
Expand Down
24 changes: 17 additions & 7 deletions cypress/e2e/openmage/backend/system/config/catalog/sitemap.cy.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
const route = cy.testRoutes.backend.system.config.catalog.sitemap;
const saveButton = cy.testRoutes.backend.system.config._buttonSave
const saveButton = cy.testRoutes.backend.system.config._buttonSave;
const validation = cy.openmage.validation;

describe(`Checks admin system "${route.h3}" settings`, () => {
Expand All @@ -8,21 +8,31 @@ describe(`Checks admin system "${route.h3}" settings`, () => {
cy.adminGetConfiguration(route);
});

const priority = route.__validation.priority._input;

it(`tests invalid string priority`, () => {
validation.fillFields(route.__validation.priority._input, validation.number, validation.assert.string);
validation.fillFields(priority, validation.number, validation.test.string);
validation.saveAction(saveButton);
validation.validateFields(route.__validation.priority._input, validation.number);
validation.validateFields(priority, validation.number);
});

it(`tests invalid number priority`, () => {
validation.fillFields(route.__validation.priority._input, validation.numberRange, validation.assert.numberGreater1);
validation.fillFields(priority, validation.numberRange, validation.test.numberGreater1);
validation.saveAction(saveButton);
validation.validateFields(route.__validation.priority._input, validation.numberRange);
validation.validateFields(priority, validation.numberRange);
});

it(`tests empty priority`, () => {
validation.fillFields(route.__validation.priority._input, validation.requiredEntry);
validation.fillFields(priority, validation.requiredEntry);
validation.saveAction(saveButton);
validation.validateFields(priority, validation.requiredEntry);
});

it(`tests empty priority, no js`, () => {
const error = 'An error occurred while saving this configuration: The priority must be between 0 and 1.';
validation.fillFields(priority, validation.requiredEntry);
validation.removeClasses(priority);
validation.saveAction(saveButton);
validation.validateFields(route.__validation.priority._input, validation.requiredEntry);
cy.get(cy.openmage.validation._errorMessage).should('include.text', error);
});
});
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
const route = cy.testRoutes.backend.system.config.customers.promo;
const saveButton = cy.testRoutes.backend.system.config._buttonSave
const saveButton = cy.testRoutes.backend.system.config._buttonSave;
const validation = cy.openmage.validation;

describe(`Checks admin system "${route.h3}" settings`, () => {
Expand All @@ -18,7 +18,7 @@ describe(`Checks admin system "${route.h3}" settings`, () => {

const fields = fieldset._input;
const validate = validation.digits;
validation.fillFields(fields, validate, validation.assert.string);
validation.fillFields(fields, validate, validation.test.string);
validation.saveAction(saveButton);
validation.validateFields(fields, validate);
});
Expand Down
15 changes: 8 additions & 7 deletions cypress/e2e/openmage/backend/system/manage-currency.cy.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
const route = cy.testRoutes.backend.system.manage_curreny
const route = cy.testRoutes.backend.system.manage_curreny;
const validation = cy.openmage.validation;

describe(`Checks admin system "${route.h3}"`, () => {
beforeEach('Log in the user', () => {
Expand All @@ -17,9 +18,9 @@ describe(`Checks admin system "${route.h3}"`, () => {
cy.get('body').then($body => {
if ($body.find(route.__validation._input.from).length > 0) {
cy.get(route.__validation._input.from).clear();
cy.openmage.validation.saveAction(route._buttonSave);
cy.get('.warning-msg').should('include.text', warning);
cy.get('.success-msg').should('include.text', success);
validation.saveAction(route._buttonSave);
cy.get(validation._warningMessage).should('include.text', warning);
cy.get(validation._successMessage).should('include.text', success);
}
});
});
Expand All @@ -28,9 +29,9 @@ describe(`Checks admin system "${route.h3}"`, () => {
cy.get('body').then($body => {
if ($body.find(route.__validation._input.from).length > 0) {
cy.get(route.__validation._input.from).clear().type('abc');
cy.openmage.validation.saveAction(route._buttonSave);
cy.get('.warning-msg').should('include.text', warning);
cy.get('.success-msg').should('include.text', success);
validation.saveAction(route._buttonSave);
cy.get(validation._warningMessage).should('include.text', warning);
cy.get(validation._successMessage).should('include.text', success);
}
});
});
Expand Down
11 changes: 6 additions & 5 deletions cypress/e2e/openmage/backend/system/myacount.cy.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
const route = cy.testRoutes.backend.system.myaccount
const route = cy.testRoutes.backend.system.myaccount;
const validation = cy.openmage.validation;

describe(`Checks admin system "${route.h3}"`, () => {
beforeEach('Log in the user', () => {
Expand All @@ -10,10 +11,10 @@ describe(`Checks admin system "${route.h3}"`, () => {
cy.adminTestRoute(route);
});

it(`tests empty priority`, () => {
it(`tests empty input`, () => {
const validate = cy.openmage.validation.requiredEntry;
cy.openmage.validation.fillFields(route.__validation._input, validate);
cy.openmage.validation.saveAction(route._buttonSave);
cy.openmage.validation.validateFields(route.__validation._input, validate);
validation.fillFields(route.__validation._input, validate);
validation.saveAction(route._buttonSave);
validation.validateFields(route.__validation._input, validate);
});
});
2 changes: 1 addition & 1 deletion cypress/e2e/openmage/backend/system/notifications.cy.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
const route = cy.testRoutes.backend.system.notification
const route = cy.testRoutes.backend.system.notification;

describe(`Checks admin system "${route.h3}"`, () => {
beforeEach('Log in the user', () => {
Expand Down
56 changes: 36 additions & 20 deletions cypress/e2e/openmage/frontend/customer/account/create.cy.js
Original file line number Diff line number Diff line change
@@ -1,38 +1,54 @@
const route = cy.testRoutes.frontend.customer.account.create;
const fields = route.__validation._input;
const validation = cy.openmage.validation;

describe('Checks customer account create', () => {
beforeEach('Log in the user', () => {
cy.visit('/customer/account/create');
beforeEach('Go to page', () => {
cy.visit(route.url);
});

it('Checks the Create Account page title', () => {
cy.get('h1').should('include.text', 'Create an Account');
cy.get(route._h1).should('include.text', route.h1);
});

it('Submits empty form', () => {
const error = 'This is a required field.';
cy.get('#form-validate button[type="submit"]').click();
cy.get('#advice-required-entry-firstname').should('include.text', error);
cy.get('#advice-required-entry-lastname').should('include.text', error);
cy.get('#advice-required-entry-email_address').should('include.text', error);
cy.get('#advice-required-entry-password').should('include.text', error);
cy.get('#advice-required-entry-confirmation').should('include.text', error);
validation.fillFields(fields, validation.requiredEntry);
validation.saveAction(route._buttonSubmit);
validation.validateFields(fields, validation.requiredEntry);
});

it('Submits empty form, no js', () => {
validation.fillFields(fields, validation.requiredEntry);
validation.removeClasses(fields);
validation.saveAction(route._buttonSubmit);
cy.get(validation._errorMessage)
.should('include.text', '"First Name" is a required value.')
.should('include.text', '"First Name" length must be equal or greater than 1 characters.')
.should('include.text', '"Last Name" is a required value.')
.should('include.text', '"Last Name" length must be equal or greater than 1 characters.')
.should('include.text', '"Email" is a required value.');
});

it('Submits form with short password and wrong confirmation', () => {
cy.get('#password').type('123').should('have.value', '123');
cy.get('#confirmation').type('abc').should('have.value', 'abc');
cy.get('#form-validate button[type="submit"]').click();
cy.get(fields.password).type('123').should('have.value', '123');
cy.get(fields.confirmation).type('abc').should('have.value', 'abc');
cy.get(route._buttonSubmit).click();
cy.get('#advice-validate-password-password').should('include.text', 'Please enter more characters or clean leading or trailing spaces.');
cy.get('#advice-validate-cpassword-confirmation').should('include.text', 'Please make sure your passwords match.');
});

it('Submits valid form with random email', () => {
const email = cy.openmage.tools.generateRandomEmail();
cy.get('#firstname').type('John').should('have.value', 'John');
cy.get('#lastname').type('Doe').should('have.value', 'Doe');
cy.get('#email_address').type(email).should('have.value', email);
cy.get('#password').type('12345678').should('have.value', '12345678');
cy.get('#confirmation').type('12345678').should('have.value', '12345678');
cy.get('#form-validate button[type="submit"]').click();
cy.get('.success-msg').should('include.text', 'Thank you for registering with Madison Island.');
const firstname = 'John';
const lastname = 'Doe';
const password = '12345678';
const successMsg = 'Thank you for registering with Madison Island.';
cy.get(fields.firstname).type(firstname).should('have.value', firstname);
cy.get(fields.lastname).type(lastname).should('have.value', lastname);
cy.get(fields.email_address).type(email).should('have.value', email);
cy.get(fields.password).type(password).should('have.value', password);
cy.get(fields.confirmation).type(password).should('have.value', password);
cy.get(route._buttonSubmit).click();
cy.get(validation._successMessage).should('include.text', successMsg);
});
});
Loading
Loading