Skip to content

Commit 513f3f8

Browse files
Separated e2e tests for add and topology pages
1 parent 66d2c91 commit 513f3f8

File tree

5 files changed

+228
-25
lines changed

5 files changed

+228
-25
lines changed
Lines changed: 60 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,60 @@
1+
@add-flow @ODC6771
2+
Feature: Update user in 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.
4+
5+
Background:
6+
Given user is at developer perspective
7+
And user has created or selected namespace "aut-topology"
8+
9+
10+
@regression
11+
Scenario: Deploy git workload with devfile from topology page: A-15-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: A-15-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 Create button to create ResourceQuota
27+
Then user is redirected to resource quota details page
28+
29+
30+
@regression
31+
Scenario: check resource quota reached warning message in Add page: A-15-TC03
32+
Given user is at the Add 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: user creates another resource quota: A-15-TC04
39+
Given user clicks on import YAML button
40+
When user creates resource quota 'resourcequota2' by entering "testData/resource-quota/resource-quota.yaml" file data
41+
And user clicks Create button to create ResourceQuota
42+
Then user is redirected to resource quota details page
43+
44+
45+
@regression
46+
Scenario: Click on warning message link to see the resource quotas list in Add page: A-15-TC05
47+
Given user is at the Add page
48+
When user clicks on link to view resource quota details
49+
And user is redirected to resource quota list page
50+
And user deletes resource quotas created
51+
Then user should not be able to see the resource quotas "resourcequota1" and "resourcequota2"
52+
53+
54+
@regression
55+
Scenario: Delete the application created: A-15-TC06
56+
Given user is at the Topology page
57+
When user right clicks on Application Grouping "devfile-sample-app"
58+
And user clicks on Delete application
59+
And user enters the name "devfile-sample-app" in the Delete application modal and clicks on Delete button
60+
Lines changed: 145 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,145 @@
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 { devNavigationMenu } from '@console/dev-console/integration-tests/support/constants';
6+
import {
7+
navigateTo,
8+
yamlEditor,
9+
createGitWorkloadIfNotExistsOnTopologyPage,
10+
topologyHelper,
11+
gitPage,
12+
devFilePage,
13+
topologyPage,
14+
} from '@console/dev-console/integration-tests/support/pages';
15+
import { topologyPO } from '@console/topology/integration-tests/support/page-objects/topology-po';
16+
import * as yamlView from '../../../../../integration-tests-cypress/views/yaml-editor';
17+
18+
const deteleResourceQuota = (resourceQuotaName: string) => {
19+
listPage.filter.byName(resourceQuotaName);
20+
listPage.rows.clickRowByName(resourceQuotaName);
21+
detailsPage.isLoaded();
22+
detailsPage.clickPageActionFromDropdown('Delete ResourceQuota');
23+
modal.shouldBeOpened();
24+
modal.submit();
25+
modal.shouldBeClosed();
26+
};
27+
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+
47+
Given('user has created workload with resource type deployment', () => {
48+
createGitWorkloadIfNotExistsOnTopologyPage(
49+
'https://github.com/sclorg/nodejs-ex.git',
50+
'ex-node-js',
51+
'deployment',
52+
'nodejs-ex-git-app',
53+
);
54+
topologyHelper.verifyWorkloadInTopologyPage('ex-node-js');
55+
});
56+
57+
When('user enters Git Repo URL as {string} in Import from Git form', (gitUrl: string) => {
58+
gitPage.enterGitUrl(gitUrl);
59+
devFilePage.verifyValidatedMessage(gitUrl);
60+
});
61+
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', () => {
71+
topologyPage.verifyTopologyPage();
72+
});
73+
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 Create button to create ResourceQuota', () => {
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+
93+
When('user clicks on link to view resource quota details', () => {
94+
cy.byTestID('resource-quota-warning').click();
95+
});
96+
97+
Then('user is redirected to resource quota details page', () => {
98+
cy.get('h2').should('contain.text', 'ResourceQuota details');
99+
});
100+
101+
Then('user is redirected to resource quota list page', () => {
102+
listPage.rows.shouldBeLoaded();
103+
});
104+
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+
127+
When(
128+
'user creates resource quota {string} by entering {string} file data',
129+
(resourceQuotaName: string, yamlLocation: string) => {
130+
cy.readFile(yamlLocation).then((str) => {
131+
const myArray = str.split('---');
132+
resourceQuotaName === 'resourcequota1'
133+
? yamlView.setEditorContent(myArray[0])
134+
: yamlView.setEditorContent(myArray[1]);
135+
});
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);
144+
},
145+
);
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-topology
6+
spec:
7+
hard:
8+
pods: '1'
9+
---
10+
apiVersion: v1
11+
kind: ResourceQuota
12+
metadata:
13+
name: resourcequota2
14+
namespace: aut-topology
15+
spec:
16+
hard:
17+
pods: '1'

frontend/packages/topology/integration-tests/features/topology/resource-quota-warning.feature

Lines changed: 6 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
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
@@ -35,38 +35,23 @@ Feature: Update user in topology and add flow if Quotas has been reached in a na
3535

3636

3737
@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
38+
Scenario: user creates another resource quota: T-19-TC04
4639
Given user clicks on import YAML button
4740
When user creates resource quota 'resourcequota2' by entering "testData/resource-quota/resource-quota.yaml" file data
4841
And user clicks on Create button
4942
Then user is redirected to resource quota details page
5043

5144

5245
@regression
53-
Scenario: Click on warning message link to see the resource quotas list in toplology page: T-19-TC06
46+
Scenario: Click on warning message link to see the resource quotas list in toplology page: T-19-TC05
5447
Given user is at the Topology page
55-
When user clicks on link to view resource quota details
56-
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
6248
When user clicks on link to view resource quota details
6349
And user is redirected to resource quota list page
6450
And user deletes resource quotas created
65-
Then user should not be able to see the resource quotas "resourcequota1" and "resourcequota2"
6651

6752

6853
@regression
69-
Scenario: Delete the application created: A-04-TC01: T-19-TC08
54+
Scenario: Delete the application created: T-19-TC06
7055
Given user is at the Topology page
7156
When user right clicks on Application Grouping "devfile-sample-app"
7257
And user clicks on Delete application

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

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -29,10 +29,6 @@ Given('user is at the Topology page', () => {
2929
navigateTo(devNavigationMenu.Topology);
3030
});
3131

32-
Given('user is at the Add page', () => {
33-
navigateTo(devNavigationMenu.Add);
34-
});
35-
3632
When('user right clicks on topology empty graph', () => {
3733
cy.get(topologyPO.graph.emptyGraph).rightclick(1, 1);
3834
});

0 commit comments

Comments
 (0)