Skip to content
This repository was archived by the owner on Feb 13, 2023. It is now read-only.

Commit edb3a6f

Browse files
authored
e2e performance (#1010)
1 parent f07cda9 commit edb3a6f

File tree

98 files changed

+564
-2577
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

98 files changed

+564
-2577
lines changed

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ screenshotsFolder
99
videosFolder
1010
cypress.env.json
1111
cypress/videos
12+
cypress/logs
1213
cypress-performance-tests
1314
benchmark.txt
1415

cypress.json

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,10 @@
66
"video": false,
77
"screenshotOnRunFailure": false,
88
"experimentalFetchPolyfill": true,
9+
"retries": {
10+
"runMode": 0,
11+
"openMode": 0
12+
},
913
"env": {
1014
"apiServer": "http://localhost:8000/api/v1/",
1115
"defaultLanguage": "en_GB",

cypress/defaults/index.js

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,3 +2,29 @@
22
* Copyright © Ergonode Sp. z o.o. All rights reserved.
33
* See LICENSE for license details.
44
*/
5+
6+
export const requestTypes = {
7+
get: 'GET',
8+
create: 'POST',
9+
update: 'PUT',
10+
delete: 'DELETE',
11+
};
12+
13+
export const statusCodes = {
14+
GET: {
15+
correct: 200,
16+
incorrect: 404,
17+
},
18+
POST: {
19+
correct: 201,
20+
incorrect: 400,
21+
},
22+
PUT: {
23+
correct: 204,
24+
incorrect: 400,
25+
},
26+
DELETE: {
27+
correct: 204,
28+
incorrect: 400,
29+
},
30+
};

cypress/integration/01:attributeGroups/1:create.feature

Lines changed: 5 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,7 @@ Feature: CREATE: Attribute groups
1010
@success
1111
Scenario Outline: Add attribute group - success
1212
When I fill the "attribute-group-code" input with the "<name>" term
13-
* I click on "submit" button
14-
* I send a "POST" request and status code should be 201
13+
* On "modal" I "submit" the data and "create" is "correct"
1514
Then On "grid" I can see row with "<name>" value and columns data: "{'0': '<name>', '2': '0'}"
1615

1716
Examples:
@@ -23,8 +22,7 @@ Feature: CREATE: Attribute groups
2322
@success
2423
Scenario: Add attribute group and go to edit - success
2524
When I fill the "attribute-group-code" input with the "text_attribute_group4" term
26-
* I click on "proceed" button
27-
* I send a "POST" request and status code should be 201
25+
* On "modal" I "proceed" the data and "create" is "correct"
2826
* I see "attribute-groups/group/%UUID%/general" page
2927
* Element "attribute-group-code" is visible
3028
* Element "title-bar-header" is visible
@@ -33,23 +31,20 @@ Feature: CREATE: Attribute groups
3331
@error
3432
Scenario: Add attribute group - duplication error
3533
When I fill the "attribute-group-code" input with the "text_attribute_group" term
36-
* I click on "submit" button
37-
* I send a "POST" request and status code should be 400
34+
* On "modal" I "submit" the data and "create" is "incorrect"
3835
* I see a form validation error that says "['The value is not unique.']"
3936
Then I close modal
4037

4138
@error
4239
Scenario: Add attribute group - validation error (empty string)
43-
When I click on "submit" button
44-
* I send a "POST" request and status code should be 400
40+
When On "modal" I "submit" the data and "create" is "incorrect"
4541
* I see a form validation error that says "['System name is required']"
4642
Then I close modal
4743

4844
@error
4945
Scenario: Add attribute group - validation error (misc string)
5046
When I fill the "attribute-group-code" input with the "@#$%()" term
51-
* I click on "submit" button
52-
* I send a "POST" request and status code should be 400
47+
* On "modal" I "submit" the data and "create" is "incorrect"
5348
* I see a form validation error that says "['System name can have only letters, digits or underscore symbol']"
5449
* I close modal
5550
Then On "grid" I can not see row with "@#$%()" value

cypress/integration/01:attributeGroups/1:create/index.test.js

Lines changed: 2 additions & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -2,21 +2,7 @@
22
* Copyright © Ergonode Sp. z o.o. All rights reserved.
33
* See LICENSE for license details.
44
*/
5-
import {
6-
And,
7-
Given,
8-
Then,
9-
} from 'cypress-cucumber-preprocessor/steps';
105

11-
import {
12-
MultiSteps,
13-
} from '../../../models/index';
14-
import {
15-
openPage,
16-
sendRequest,
17-
} from '../../../models/navigation';
18-
19-
const requestName = 'attributeGroupRequest';
206
const url = /attributes\/groups/;
217

228
before(() => {
@@ -29,32 +15,11 @@ beforeEach(() => {
2915
method: 'POST',
3016
url,
3117
},
32-
).as(`${requestName}_POST`);
18+
).as(`${Cypress.spec.name}_POST`);
3319
cy.intercept(
3420
{
3521
method: 'GET',
3622
url,
3723
},
38-
).as(`${requestName}_GET`);
39-
});
40-
41-
MultiSteps([
42-
Given,
43-
And,
44-
], 'I open {string} page', (page) => {
45-
openPage({
46-
page,
47-
requestName,
48-
});
49-
});
50-
51-
MultiSteps([
52-
Then,
53-
And,
54-
], 'I send a {string} request and status code should be {int}', (reqType, status) => {
55-
sendRequest({
56-
requestName,
57-
reqType,
58-
status,
59-
});
24+
).as(`${Cypress.spec.name}_GET`);
6025
});

cypress/integration/01:attributeGroups/2:read/index.test.js

Lines changed: 1 addition & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -2,21 +2,7 @@
22
* Copyright © Ergonode Sp. z o.o. All rights reserved.
33
* See LICENSE for license details.
44
*/
5-
import {
6-
And,
7-
Given,
8-
Then,
9-
} from 'cypress-cucumber-preprocessor/steps';
105

11-
import {
12-
MultiSteps,
13-
} from '../../../models/index';
14-
import {
15-
openPage,
16-
sendRequest,
17-
} from '../../../models/navigation';
18-
19-
const requestName = 'attributeGroupRequest';
206
const url = /attributes\/groups/;
217

228
before(() => {
@@ -29,26 +15,5 @@ beforeEach(() => {
2915
method: 'GET',
3016
url,
3117
},
32-
).as(`${requestName}_GET`);
33-
});
34-
35-
MultiSteps([
36-
Given,
37-
And,
38-
], 'I open {string} page', (page) => {
39-
openPage({
40-
page,
41-
requestName,
42-
});
43-
});
44-
45-
MultiSteps([
46-
Then,
47-
And,
48-
], 'I send a {string} request and status code should be {int}', (reqType, status) => {
49-
sendRequest({
50-
requestName,
51-
reqType,
52-
status,
53-
});
18+
).as(`${Cypress.spec.name}_GET`);
5419
});

cypress/integration/01:attributeGroups/3:update.feature

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,7 @@ Feature: UPDATE: Attribute groups
1313
* I click tab with "Translations" text
1414
* I see "attribute-groups/group/%UUID%/translations" page
1515
* I fill the "attribute-group-name" input with the "attribute_group_attribute_group_attribute_group_attribute_group_" term for "en_GB" translation
16-
Then I click on "submit" button
17-
* I send a "PUT" request and status code should be 400
16+
* I "submit" the data and "update" is "incorrect"
1817
Then I see a form validation error that says "['Attribute group name is too long. It should contain 32 characters or less.']"
1918

2019
@success
@@ -27,8 +26,7 @@ Feature: UPDATE: Attribute groups
2726
* I choose "[1]" option from "translation-language-select" multi select field
2827
* I fill the "attribute-group-name" input with the "attribute_group_EN" term for "en_GB" translation
2928
* I fill the "attribute-group-name" input with the "attribute_group_PL" term for "pl_PL" translation
30-
Then I click on "submit" button
31-
* I send a "PUT" request and status code should be 204
29+
* I "submit" the data and "update" is "correct"
3230
* I click back arrow
3331
* I see "attribute-groups/grid" page
3432
Then On "grid" I can see row with "text_attribute_group" value and columns data: "{'0': 'text_attribute_group', '1': 'attribute_group_EN', '2': '0'}"

cypress/integration/01:attributeGroups/3:update/index.test.js

Lines changed: 2 additions & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -2,21 +2,7 @@
22
* Copyright © Ergonode Sp. z o.o. All rights reserved.
33
* See LICENSE for license details.
44
*/
5-
import {
6-
And,
7-
Given,
8-
Then,
9-
} from 'cypress-cucumber-preprocessor/steps';
105

11-
import {
12-
MultiSteps,
13-
} from '../../../models/index';
14-
import {
15-
openPage,
16-
sendRequest,
17-
} from '../../../models/navigation';
18-
19-
const requestName = 'attributeGroupRequest';
206
const url = /attributes\/groups/;
217

228
before(() => {
@@ -29,32 +15,11 @@ beforeEach(() => {
2915
method: 'PUT',
3016
url,
3117
},
32-
).as(`${requestName}_PUT`);
18+
).as(`${Cypress.spec.name}_PUT`);
3319
cy.intercept(
3420
{
3521
method: 'GET',
3622
url,
3723
},
38-
).as(`${requestName}_GET`);
39-
});
40-
41-
MultiSteps([
42-
Given,
43-
And,
44-
], 'I open {string} page', (page) => {
45-
openPage({
46-
page,
47-
requestName,
48-
});
49-
});
50-
51-
MultiSteps([
52-
Then,
53-
And,
54-
], 'I send a {string} request and status code should be {int}', (reqType, status) => {
55-
sendRequest({
56-
requestName,
57-
reqType,
58-
status,
59-
});
24+
).as(`${Cypress.spec.name}_GET`);
6025
});

cypress/integration/01:attributeGroups/4:delete.feature

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,6 @@ Feature: DELETE: Attribute groups
3131
When On "grid" I can see row with "text_attribute_group" value and columns data: "{'0': 'text_attribute_group', '2': '0'}"
3232
* On "grid" I click on "delete" button for row with "text_attribute_group" value
3333
* I confirm modal
34-
* I send a "DELETE" request and status code should be 204
3534
Then On "grid" I can not see row with "text_attribute_group" value
3635

3736
@success

cypress/integration/01:attributeGroups/4:delete/index.test.js

Lines changed: 1 addition & 42 deletions
Original file line numberDiff line numberDiff line change
@@ -2,59 +2,18 @@
22
* Copyright © Ergonode Sp. z o.o. All rights reserved.
33
* See LICENSE for license details.
44
*/
5-
import {
6-
And,
7-
Given,
8-
Then,
9-
} from 'cypress-cucumber-preprocessor/steps';
105

11-
import {
12-
MultiSteps,
13-
} from '../../../models/index';
14-
import {
15-
openPage,
16-
sendRequest,
17-
} from '../../../models/navigation';
18-
19-
const requestName = 'attributeGroupRequest';
206
const url = /attributes\/groups/;
217

228
before(() => {
239
cy.login(Cypress.env('adminEmail'), Cypress.env('adminPass'));
2410
});
2511

2612
beforeEach(() => {
27-
cy.intercept(
28-
{
29-
method: 'DELETE',
30-
url,
31-
},
32-
).as(`${requestName}_DELETE`);
3313
cy.intercept(
3414
{
3515
method: 'GET',
3616
url,
3717
},
38-
).as(`${requestName}_GET`);
39-
});
40-
41-
MultiSteps([
42-
Given,
43-
And,
44-
], 'I open {string} page', (page) => {
45-
openPage({
46-
page,
47-
requestName,
48-
});
49-
});
50-
51-
MultiSteps([
52-
Then,
53-
And,
54-
], 'I send a {string} request and status code should be {int}', (reqType, status) => {
55-
sendRequest({
56-
requestName,
57-
reqType,
58-
status,
59-
});
18+
).as(`${Cypress.spec.name}_GET`);
6019
});

0 commit comments

Comments
 (0)