Skip to content

Commit 352c775

Browse files
committed
update
1 parent 734dd7f commit 352c775

File tree

6 files changed

+41
-19
lines changed

6 files changed

+41
-19
lines changed

cypress/e2e/paths/backend/catalog/products.cy.js

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,4 +13,21 @@ describe(`Checks admin system "${route.h3}"`, () => {
1313
it(`tests`, () => {
1414
cy.log('Checking for error messages');
1515
});
16+
17+
it(`tests filter options`, () => {
18+
cy.log('Checking for the number of filter type options');
19+
cy.get('#productGrid_product_filter_type option').should('have.length', 7);
20+
21+
cy.log('Checking for the number of filter visibility options');
22+
cy.get('#productGrid_product_filter_visibility option').should('have.length', 5);
23+
});
24+
25+
it(`tests add simple product`, () => {
26+
cy.log('Checking for the number of add product options');
27+
cy.get('#productGrid_product_add_product option').should('have.length', 6);
28+
29+
cy.log('Checking for the number of add product options');
30+
cy.get('#productGrid_product_add_product option').contains('Simple Product').click();
31+
cy.get('#productGrid_product_add_product option').should('have.length', 5);
32+
});
1633
});

cypress/e2e/paths/frontend/customer/account/create.cy.js

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -8,12 +8,13 @@ describe('Checks customer account create', () => {
88
});
99

1010
it('Submits empty form', () => {
11+
const error = 'This is a required field.';
1112
cy.get('#form-validate button[type="submit"]').click();
12-
cy.get('#advice-required-entry-firstname').should('include.text', 'This is a required field.');
13-
cy.get('#advice-required-entry-lastname').should('include.text', 'This is a required field.');
14-
cy.get('#advice-required-entry-email_address').should('include.text', 'This is a required field.');
15-
cy.get('#advice-required-entry-password').should('include.text', 'This is a required field.');
16-
cy.get('#advice-required-entry-confirmation').should('include.text', 'This is a required field.');
13+
cy.get('#advice-required-entry-firstname').should('include.text', error);
14+
cy.get('#advice-required-entry-lastname').should('include.text', error);
15+
cy.get('#advice-required-entry-email_address').should('include.text', error);
16+
cy.get('#advice-required-entry-password').should('include.text', error);
17+
cy.get('#advice-required-entry-confirmation').should('include.text', error);
1718
});
1819

1920
it('Submits form with short password and wrong confirmation', () => {
@@ -25,10 +26,10 @@ describe('Checks customer account create', () => {
2526
});
2627

2728
it('Submits valid form with random email', () => {
28-
const randomEmail = cy.generateRandomEmail();
29+
const email = cy.openmage.generateRandomEmail();
2930
cy.get('#firstname').type('John').should('have.value', 'John');
3031
cy.get('#lastname').type('Doe').should('have.value', 'Doe');
31-
cy.get('#email_address').type(randomEmail).should('have.value', randomEmail);
32+
cy.get('#email_address').type(email).should('have.value', email);
3233
cy.get('#password').type('12345678').should('have.value', '12345678');
3334
cy.get('#confirmation').type('12345678').should('have.value', '12345678');
3435
cy.get('#form-validate button[type="submit"]').click();

cypress/e2e/paths/frontend/newsletter-subscribe.cy.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,13 +7,13 @@ describe('Check newsletter subribe', () => {
77
})
88

99
it('Test valid input twice', () => {
10-
const randomEmail = cy.generateRandomEmail();
10+
const email = cy.openmage.generateRandomEmail();
1111
cy.visit('/')
12-
cy.get('#newsletter').type(randomEmail).should('have.value', randomEmail);
12+
cy.get('#newsletter').type(randomEmail).should('have.value', email);
1313
cy.get('#newsletter-validate-detail button[type="submit"]').click();
1414
cy.get('.success-msg').should('include.text', 'Thank you for your subscription.');
1515

16-
cy.get('#newsletter').type(randomEmail).should('have.value', randomEmail);
16+
cy.get('#newsletter').type(randomEmail).should('have.value', email);
1717
cy.get('#newsletter-validate-detail button[type="submit"]').click();
1818
cy.get('.error-msg').should('include.text', 'There was a problem with the subscription: This email address is already registered.');
1919
})

cypress/support/commands.js

Lines changed: 1 addition & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -67,11 +67,4 @@ Cypress.Commands.add('adminSaveConfiguration', () => {
6767
cy.log('Clicking on Save Config button');
6868
cy.get('.form-buttons button[title="Save Config"]').click({force: true, multiple: true});
6969
})
70-
Cypress.Commands.add('generateRandomEmail', () => {
71-
const chars = 'abcdefghijklmnopqrstuvwxyz0123456789';
72-
let email = '';
73-
for (let i = 0; i < 16; i++) {
74-
email += chars.charAt(Math.floor(Math.random() * chars.length));
75-
}
76-
return email + '@example.com';
77-
})
70+

cypress/support/e2e.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,4 +14,5 @@
1414
// ***********************************************************
1515

1616
// Import commands.js using ES2015 syntax:
17-
import './commands'
17+
import './commands'
18+
import './functions'

cypress/support/functions.js

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
cy.openmage = {
2+
generateRandomEmail: () => {
3+
const chars = 'abcdefghijklmnopqrstuvwxyz0123456789';
4+
let email = '';
5+
for (let i = 0; i < 16; i++) {
6+
email += chars.charAt(Math.floor(Math.random() * chars.length));
7+
}
8+
return email + '@example.com';
9+
}
10+
}

0 commit comments

Comments
 (0)