Skip to content

Commit 8669ead

Browse files
Separated e2e tests for add and topology pages
1 parent e021f1f commit 8669ead

File tree

5 files changed

+142
-152
lines changed

5 files changed

+142
-152
lines changed
Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
@add-flow @ODC6771
2+
Feature: Update user in Add page if Quotas has been reached in a namespace
3+
If any resource reached resource quota limit, a warning alert will be displayed for the user in Add page.
4+
5+
Background:
6+
Given user is at developer perspective
7+
And user has created or selected namespace "aut-add"
8+
9+
10+
@regression
11+
Scenario: single resource reached quota: A-15-TC01
12+
Given user has created workload with resource type deployment
13+
When user creates resource quota 'resourcequota1' by entering 'testData/resource-quota/resource-quota.yaml' file data
14+
And user navigates to Add page
15+
And user clicks on link to view resource quota details
16+
Then user is redirected to resource quota details page
17+
18+
19+
@regression
20+
Scenario: multiple resources reached quota: A-15-TC02
21+
Given user has created workload with resource type deployment
22+
And user has created two resource quotas using 'testData/resource-quota/resource-quota.yaml' file
23+
When user navigates to Add page
24+
And user clicks on link to view resource quota details
25+
Then user is redirected to resource quota list page
26+
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,69 @@
1+
import { Given, When, Then } from 'cypress-cucumber-preprocessor/steps';
2+
import { detailsPage } from '@console/cypress-integration-tests/views/details-page';
3+
import { listPage } from '@console/cypress-integration-tests/views/list-page';
4+
import { modal } from '@console/cypress-integration-tests/views/modal';
5+
import * as yamlView from '@console/cypress-integration-tests/views/yaml-editor';
6+
import { devNavigationMenu } from '@console/dev-console/integration-tests/support/constants';
7+
import {
8+
navigateTo,
9+
createGitWorkloadIfNotExistsOnTopologyPage,
10+
topologyHelper,
11+
app,
12+
} from '@console/dev-console/integration-tests/support/pages';
13+
14+
const deteleResourceQuota = () => {
15+
detailsPage.isLoaded();
16+
detailsPage.clickPageActionFromDropdown('Delete ResourceQuota');
17+
modal.shouldBeOpened();
18+
modal.submit();
19+
modal.shouldBeClosed();
20+
};
21+
22+
Given('user has created workload with resource type deployment', () => {
23+
createGitWorkloadIfNotExistsOnTopologyPage(
24+
'https://github.com/sclorg/nodejs-ex.git',
25+
'ex-node-js',
26+
'deployment',
27+
'nodejs-ex-git-app',
28+
);
29+
topologyHelper.verifyWorkloadInTopologyPage('ex-node-js');
30+
});
31+
32+
Given('user has created two resource quotas using {string} file', (yamlLocation) => {
33+
cy.exec(`oc apply -f ${yamlLocation}`);
34+
app.waitForDocumentLoad();
35+
});
36+
37+
When('user navigates to Add page', () => {
38+
app.waitForDocumentLoad();
39+
navigateTo(devNavigationMenu.Add);
40+
});
41+
42+
When('user clicks on link to view resource quota details', () => {
43+
cy.byTestID('resource-quota-warning').click();
44+
});
45+
46+
Then('user is redirected to resource quota details page', () => {
47+
cy.get('h2').should('contain.text', 'ResourceQuota details');
48+
deteleResourceQuota();
49+
});
50+
51+
Then('user is redirected to resource quota list page', () => {
52+
listPage.rows.shouldBeLoaded();
53+
});
54+
55+
When(
56+
'user creates resource quota {string} by entering {string} file data',
57+
(resourceQuotaName: string, yamlLocation: string) => {
58+
cy.get('[data-test="import-yaml"]').click();
59+
cy.get('.yaml-editor').should('be.visible');
60+
cy.readFile(yamlLocation).then((str) => {
61+
const myArray = str.split('---');
62+
resourceQuotaName === 'resourcequota1'
63+
? yamlView.setEditorContent(myArray[0])
64+
: yamlView.setEditorContent(myArray[1]);
65+
});
66+
cy.get('[data-test="save-changes"]').click();
67+
cy.get('h2').should('contain.text', 'ResourceQuota details');
68+
},
69+
);
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
apiVersion: v1
2+
kind: ResourceQuota
3+
metadata:
4+
name: resourcequota1
5+
namespace: aut-add
6+
spec:
7+
hard:
8+
pods: '1'
9+
---
10+
apiVersion: v1
11+
kind: ResourceQuota
12+
metadata:
13+
name: resourcequota2
14+
namespace: aut-add
15+
spec:
16+
hard:
17+
pods: '1'
Lines changed: 17 additions & 64 deletions
Original file line numberDiff line numberDiff line change
@@ -1,74 +1,27 @@
1-
@topology @add-flow @ODC6771
2-
Feature: Update user in topology and add flow if Quotas has been reached in a namespace
3-
If any resource reached resource quota limit, a warning alert will be displayed for the user in Add page and Topology page.
1+
@topology @ODC6771
2+
Feature: Update user in topology page if Quotas has been reached in a namespace
3+
If any resource reached resource quota limit, a warning alert will be displayed for the user in Topology page.
44

55
Background:
66
Given user is at developer perspective
77
And user has created or selected namespace "aut-topology"
88

99

1010
@regression
11-
Scenario: Deploy git workload with devfile from topology page: T-19-TC01
12-
Given user is at the Topology page
13-
When user right clicks on topology empty graph
14-
And user selects "Import from Git" option from Add to Project context menu
15-
And user enters Git Repo URL as "https://github.com/nodeshift-starters/devfile-sample" in Import from Git form
16-
And user enters workload name as "node-bulletin-board-1"
17-
And user clicks Create button on Add page
18-
Then user will be redirected to Topology page
19-
And user is able to see workload "node-bulletin-board-1" in topology page
20-
21-
22-
@regression
23-
Scenario: user creates a resource quota: T-19-TC02
24-
Given user clicks on import YAML button
25-
When user creates resource quota 'resourcequota1' by entering "testData/resource-quota/resource-quota.yaml" file data
26-
And user clicks on Create button
27-
Then user is redirected to resource quota details page
28-
29-
30-
@regression
31-
Scenario: check resource quota reached warning message in topology page: T-19-TC03
32-
Given user is at the Topology page
33-
When user clicks on link to view resource quota details
34-
Then user is redirected to resource quota details page
35-
36-
37-
@regression
38-
Scenario: check resource quota reached warning message in Add page: T-19-TC04
39-
Given user is at the Add page
40-
When user clicks on link to view resource quota details
41-
Then user is redirected to resource quota details page
42-
43-
44-
@regression
45-
Scenario: user creates another resource quota: T-19-TC05
46-
Given user clicks on import YAML button
47-
When user creates resource quota 'resourcequota2' by entering "testData/resource-quota/resource-quota.yaml" file data
48-
And user clicks on Create button
11+
Scenario: single resource reached quota: T-19-TC01
12+
Given user has created workload with resource type deployment
13+
When user creates resource quota 'resourcequota1' by entering 'testData/resource-quota/resource-quota.yaml' file data
14+
And user navigates to Topology page
15+
And user clicks on link to view resource quota details
4916
Then user is redirected to resource quota details page
50-
51-
52-
@regression
53-
Scenario: Click on warning message link to see the resource quotas list in toplology page: T-19-TC06
54-
Given user is at the Topology page
55-
When user clicks on link to view resource quota details
17+
18+
19+
@regression
20+
Scenario: multiple resources reached quota: T-19-TC02
21+
Given user has created workload with resource type deployment
22+
And user has created two resource quotas using 'testData/resource-quota/resource-quota.yaml' file
23+
When user navigates to Topology page
24+
And user clicks on link to view resource quota details
5625
Then user is redirected to resource quota list page
57-
58-
59-
@regression
60-
Scenario: Click on warning message link to see the resource quotas list in Add page: T-19-TC07
61-
Given user is at the Add page
62-
When user clicks on link to view resource quota details
63-
And user is redirected to resource quota list page
64-
And user deletes resource quotas created
65-
Then user should not be able to see the resource quotas "resourcequota1" and "resourcequota2"
66-
67-
68-
@regression
69-
Scenario: Delete the application created: A-04-TC01: T-19-TC08
70-
Given user is at the Topology page
71-
When user right clicks on Application Grouping "devfile-sample-app"
72-
And user clicks on Delete application
73-
And user enters the name "devfile-sample-app" in the Delete application modal and clicks on Delete button
26+
7427

frontend/packages/topology/integration-tests/support/step-definitions/topology/resource-quota-warning.ts

Lines changed: 13 additions & 88 deletions
Original file line numberDiff line numberDiff line change
@@ -2,48 +2,24 @@ import { Given, When, Then } from 'cypress-cucumber-preprocessor/steps';
22
import { detailsPage } from '@console/cypress-integration-tests/views/details-page';
33
import { listPage } from '@console/cypress-integration-tests/views/list-page';
44
import { modal } from '@console/cypress-integration-tests/views/modal';
5+
import * as yamlView from '@console/cypress-integration-tests/views/yaml-editor';
56
import { devNavigationMenu } from '@console/dev-console/integration-tests/support/constants';
67
import {
78
navigateTo,
8-
yamlEditor,
99
createGitWorkloadIfNotExistsOnTopologyPage,
1010
topologyHelper,
11-
gitPage,
12-
devFilePage,
1311
topologyPage,
12+
app,
1413
} from '@console/dev-console/integration-tests/support/pages';
15-
import * as yamlView from '../../../../../integration-tests-cypress/views/yaml-editor';
16-
import { topologyPO } from '../../page-objects/topology-po';
1714

18-
const deteleResourceQuota = (resourceQuotaName: string) => {
19-
listPage.filter.byName(resourceQuotaName);
20-
listPage.rows.clickRowByName(resourceQuotaName);
15+
const deteleResourceQuota = () => {
2116
detailsPage.isLoaded();
2217
detailsPage.clickPageActionFromDropdown('Delete ResourceQuota');
2318
modal.shouldBeOpened();
2419
modal.submit();
2520
modal.shouldBeClosed();
2621
};
2722

28-
Given('user is at the Topology page', () => {
29-
navigateTo(devNavigationMenu.Topology);
30-
});
31-
32-
Given('user is at the Add page', () => {
33-
navigateTo(devNavigationMenu.Add);
34-
});
35-
36-
When('user right clicks on topology empty graph', () => {
37-
cy.get(topologyPO.graph.emptyGraph).rightclick(1, 1);
38-
});
39-
40-
When('user selects {string} option from Add to Project context menu', (option: string) => {
41-
cy.get(topologyPO.graph.contextMenuOptions.addToProject)
42-
.focus()
43-
.trigger('mouseover');
44-
cy.byTestActionID(option).click({ force: true });
45-
});
46-
4723
Given('user has created workload with resource type deployment', () => {
4824
createGitWorkloadIfNotExistsOnTopologyPage(
4925
'https://github.com/sclorg/nodejs-ex.git',
@@ -54,92 +30,41 @@ Given('user has created workload with resource type deployment', () => {
5430
topologyHelper.verifyWorkloadInTopologyPage('ex-node-js');
5531
});
5632

57-
When('user enters Git Repo URL as {string} in Import from Git form', (gitUrl: string) => {
58-
gitPage.enterGitUrl(gitUrl);
59-
devFilePage.verifyValidatedMessage(gitUrl);
33+
Given('user has created two resource quotas using {string} file', (yamlLocation) => {
34+
cy.exec(`oc apply -f ${yamlLocation}`);
35+
app.waitForDocumentLoad();
6036
});
6137

62-
When('user enters workload name as {string}', (name: string) => {
63-
gitPage.enterWorkloadName(name);
64-
});
65-
66-
When('user clicks Create button on Add page', () => {
67-
gitPage.clickCreate();
68-
});
69-
70-
Then('user will be redirected to Topology page', () => {
38+
When('user navigates to Topology page', () => {
39+
navigateTo(devNavigationMenu.Topology);
7140
topologyPage.verifyTopologyPage();
7241
});
7342

74-
Then('user is able to see workload {string} in topology page', (workloadName: string) => {
75-
topologyPage.verifyWorkloadInTopologyPage(workloadName);
76-
});
77-
78-
Given('user clicks on import YAML button', () => {
79-
cy.get('[data-test="import-yaml"]').click();
80-
cy.get('.yaml-editor').should('be.visible');
81-
});
82-
83-
When('user clicks on Create button', () => {
84-
cy.get('[data-test="save-changes"]').click();
85-
});
86-
87-
When('user enters the {string} file data to YAML Editor', (yamlFile: string) => {
88-
yamlEditor.isLoaded();
89-
yamlEditor.clearYAMLEditor();
90-
yamlEditor.setEditorContent(yamlFile);
91-
});
92-
9343
When('user clicks on link to view resource quota details', () => {
9444
cy.byTestID('resource-quota-warning').click();
9545
});
9646

9747
Then('user is redirected to resource quota details page', () => {
9848
cy.get('h2').should('contain.text', 'ResourceQuota details');
49+
deteleResourceQuota();
9950
});
10051

10152
Then('user is redirected to resource quota list page', () => {
10253
listPage.rows.shouldBeLoaded();
10354
});
10455

105-
When('user deletes resource quotas created', () => {
106-
deteleResourceQuota('resourcequota1');
107-
deteleResourceQuota('resourcequota2');
108-
});
109-
110-
When('user clicks on Delete application', () => {
111-
cy.get('.odc-topology-context-menu')
112-
.contains('Delete application')
113-
.click();
114-
});
115-
116-
When(
117-
'user enters the name {string} in the Delete application modal and clicks on Delete button',
118-
(appName: string) => {
119-
topologyPage.deleteApplication(appName);
120-
},
121-
);
122-
123-
When('user right clicks on Application Grouping {string}', (appName: string) => {
124-
topologyPage.rightClickOnApplicationGroupings(appName);
125-
});
126-
12756
When(
12857
'user creates resource quota {string} by entering {string} file data',
12958
(resourceQuotaName: string, yamlLocation: string) => {
59+
cy.get('[data-test="import-yaml"]').click();
60+
cy.get('.yaml-editor').should('be.visible');
13061
cy.readFile(yamlLocation).then((str) => {
13162
const myArray = str.split('---');
13263
resourceQuotaName === 'resourcequota1'
13364
? yamlView.setEditorContent(myArray[0])
13465
: yamlView.setEditorContent(myArray[1]);
13566
});
136-
},
137-
);
138-
139-
Then(
140-
'user should not be able to see the resource quotas {string} and {string}',
141-
(resourcequota1: string, resourcequota2: string) => {
142-
listPage.rows.shouldNotExist(resourcequota1);
143-
listPage.rows.shouldNotExist(resourcequota2);
67+
cy.get('[data-test="save-changes"]').click();
68+
cy.get('h2').should('contain.text', 'ResourceQuota details');
14469
},
14570
);

0 commit comments

Comments
 (0)