Skip to content

Commit fd129e6

Browse files
Merge pull request #14684 from sanketpathak/merge-admin-dev-perspective-ci-tests
ODC-7735: Edit ci tests to have step to enable developer perspective
2 parents e0ec6b5 + 5019fff commit fd129e6

31 files changed

Lines changed: 313 additions & 94 deletions

File tree

frontend/packages/dev-console/integration-tests/support/commands/hooks.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
import { guidedTour } from '@console/cypress-integration-tests/views/guided-tour';
21
import { quickStartSidebarPO } from '../pageObjects/quickStarts-po';
2+
import { checkDeveloperPerspective } from '../pages/functions/checkDeveloperPerspective';
33

44
// To ignore the resizeObserverLoopErrors on CI, adding below code
55
const resizeObserverLoopErrRe = /^[^(ResizeObserver loop limit exceeded)]/;
@@ -19,7 +19,7 @@ before(() => {
1919
const bridgePasswordPassword: string = Cypress.env('BRIDGE_HTPASSWD_PASSWORD') || 'test';
2020
cy.login(bridgePasswordIDP, bridgePasswordUsername, bridgePasswordPassword);
2121
cy.document().its('readyState').should('eq', 'complete');
22-
guidedTour.close();
22+
checkDeveloperPerspective();
2323
});
2424

2525
after(() => {
Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
import { guidedTour } from '@console/cypress-integration-tests/views/guided-tour';
2+
3+
export const checkDeveloperPerspective = () => {
4+
cy.byLegacyTestID('perspective-switcher-toggle').click();
5+
cy.get('body').then(($body) => {
6+
if ($body.find('[data-test-id="perspective-switcher-menu-option"]').length !== 0) {
7+
cy.log('perspective switcher menu enabled');
8+
cy.byLegacyTestID('perspective-switcher-menu-option').contains('Developer');
9+
cy.byLegacyTestID('perspective-switcher-toggle').click();
10+
} else {
11+
cy.exec(
12+
`oc patch console.operator.openshift.io/cluster --type='merge' -p '{"spec":{"customization":{"perspectives":[{"id":"dev","visibility":{"state":"Enabled"}}]}}}'`,
13+
{ failOnNonZeroExit: true },
14+
).then((result) => {
15+
cy.log(result.stderr);
16+
});
17+
cy.reload(true);
18+
cy.document().its('readyState').should('eq', 'complete');
19+
cy.exec(` oc rollout status -w deploy/console -n openshift-console`, {
20+
failOnNonZeroExit: true,
21+
}).then((result) => {
22+
cy.log(result.stderr);
23+
});
24+
cy.log('perspective switcher menu refreshed');
25+
}
26+
guidedTour.close();
27+
});
28+
};

frontend/packages/dev-console/integration-tests/support/pages/search-resources/search-page.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ const dataTestIdPref: string = 'data-test-id';
88
export function performResourceSearching(resourceName: string) {
99
cy.get('[aria-label="Type to filter"]').click();
1010

11-
cy.get('input[placeholder="Resources"]').clear().type(resourceName);
11+
cy.get('input[placeholder="Resources"]').clear().focus().type(resourceName);
1212
cy.get(`label[id$="${resourceName}"]`).click();
1313
}
1414

@@ -27,6 +27,7 @@ export const searchResource = {
2727
});
2828
cy.get(adminNavigationMenuPO.home.search).click();
2929
performResourceSearching(resourceName);
30+
cy.get('[id="resource-dropdown-listbox"]').scrollTo('top', { ensureScrollable: false });
3031
cy.byLegacyTestID('close-icon').should('be.visible').click({ force: true });
3132
},
3233

frontend/packages/helm-plugin/integration-tests/features/helm-release.feature

Lines changed: 18 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -9,16 +9,16 @@ Feature: Helm Release
99

1010

1111
Scenario: Open the Helm tab on the navigation bar when helm charts are absent: HR-05-TC01
12-
Given user is at developer perspective
13-
When user clicks on the Helm tab
14-
Then user will be redirected to Helm releases page
12+
Given user is at administrator perspective
13+
When user clicks on the Helm Release tab in admin perspective
14+
Then user will be redirected to Helm releases page under Helm tab
1515
And user is able to see the message "No Helm Releases found"
1616
And user will get the link to install helm charts from developer catalog
1717

1818

1919
Scenario: Create Helm Release page details: HR-05-TC02
20-
Given user is at Add page
21-
When user selects "Helm Chart" card from add page
20+
Given user is at Software Catalog page
21+
When user selects Helm Charts type from Software Catalog page
2222
And user searches and selects "Nodejs" card from catalog page
2323
And user clicks on the Create button on side bar
2424
Then Create Helm Release page is displayed
@@ -29,8 +29,8 @@ Feature: Helm Release
2929

3030

3131
Scenario: Install Helm Chart from +Add Page using Form View: HR-06-TC04
32-
Given user is at Add page
33-
When user selects "Helm Chart" card from add page
32+
Given user is at Software Catalog page
33+
When user selects Helm Charts type from Software Catalog page
3434
And user searches and selects "Nodejs" card from catalog page
3535
And user clicks on the Create button on side bar
3636
And user enters Release Name as "nodejs-release"
@@ -39,8 +39,8 @@ Feature: Helm Release
3939
And Topology page have the helm chart workload "nodejs-release"
4040

4141
Scenario: Helm release status verification: HR-01-TC04
42-
Given user is at the Helm page
43-
And user is able to see "nodejs-release" in helm page
42+
Given user is at the Helm Release tab in admin perspective
43+
And user is able to see "nodejs-release" in helm page in admin view
4444
And user is able to see the status and status icon of "nodejs-release" under helm releases tab
4545
And user is able to see the "PendingInstall", "PendingUpgrade" and "PendingRollback" options under filter bar
4646
When user clicks on the helm release name "nodejs-release"
@@ -50,28 +50,27 @@ Feature: Helm Release
5050
And user is able to see the status and status icon of Revision history page
5151

5252
Scenario: Context menu options of helm release: HR-01-TC01
53-
Given user is at the Topology page
53+
Given user is at the Topology page in admin view
5454
When user right clicks on the helm release "nodejs-release" to open the context menu
5555
Then user is able to see the context menu with actions Upgrade and Delete Helm Release
5656

5757

5858
Scenario: Open the Helm tab on the navigation bar when helm charts are present: HR-05-TC05
59-
Given user is at the Helm page
60-
When user clicks on the Helm tab
61-
Then user will be redirected to Helm releases page
59+
Given user is at the Helm Release tab in admin perspective
60+
Then user will be redirected to Helm releases page under Helm tab
6261
And user will see the helm charts listed
6362

6463

6564
Scenario: Filter out deployed Helm Charts: HR-05-TC06
66-
Given user is at the Helm page
65+
Given user is at the Helm Release tab in admin perspective
6766
When user clicks on the filter drop down
6867
And user selects checkbox for the "Deployed" Helm charts
6968
Then the checkbox for the "Deployed" Helm chart is checked
7069
And helm charts with status "Deployed" are listed
7170

7271

7372
Scenario: Helm release details page: HR-05-TC13
74-
Given user is at the Helm page
73+
Given user is at the Helm Release tab in admin perspective
7574
When user clicks on the helm release name "nodejs-release"
7675
Then user will see the Details page opened
7776
And user will see the Resources tab
@@ -86,7 +85,7 @@ Feature: Helm Release
8685

8786

8887
Scenario: Perform Upgrade action on Helm Release through Context Menu: HR-08-TC04
89-
Given user is at the Topology page
88+
Given user is at the Topology page in admin view
9089
When user right clicks on the helm release "nodejs-release" to open the context menu
9190
And user clicks on the "Upgrade" action
9291
And user upgrades the chart Version
@@ -100,11 +99,11 @@ Feature: Helm Release
10099
And user clicks on the "Upgrade" action
101100
And user upgrades the chart Version
102101
And user clicks on the upgrade button
103-
Then user will be redirected to Helm Releases page
102+
Then user will be redirected to Helm Releases page under Helm tab
104103

105104

106105
Scenario: Perform Rollback action on Helm Release through Context Menu: HR-08-TC03
107-
Given user is at the Topology page
106+
Given user is at the Topology page in admin view
108107
And user is on the topology sidebar of the helm release "nodejs-release"
109108
When user clicks on the Actions drop down menu
110109
And user clicks on the "Rollback" action
@@ -114,7 +113,7 @@ Feature: Helm Release
114113

115114

116115
Scenario: Delete Helm Release through Context Menu: HR-01-TC03
117-
Given user is at the Topology page
116+
Given user is at the Topology page in admin view
118117
When user right clicks on the helm release "nodejs-release" to open the context menu
119118
And user clicks on the "Delete Helm Release" action
120119
And user enters the release name "nodejs-release"

frontend/packages/helm-plugin/integration-tests/features/helm/helm-navigation.feature

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ Feature: Navigations on Helm Chart
99
# The test expects that there are no helm releases but there is from the previous feature run.
1010
@broken-test
1111
Scenario: Open the Helm tab on the navigation bar when helm charts are absent: HR-05-TC01
12-
When user clicks on the Helm tab
12+
When user clicks on the Helm tab in dev perspective
1313
Then user will be redirected to Helm releases page
1414
And user is able to see the message "No Helm Releases found"
1515
And user will get the link to install helm charts from developer catalog
@@ -49,7 +49,7 @@ Feature: Navigations on Helm Chart
4949
@smoke
5050
Scenario: Open the Helm tab on the navigation bar when helm charts are present: HR-05-TC05
5151
Given user is at the Helm page
52-
When user clicks on the Helm tab
52+
When user clicks on the Helm tab in dev perspective
5353
Then user will be redirected to Helm releases page
5454
And user will see the helm charts listed
5555

frontend/packages/helm-plugin/integration-tests/features/helm/helm-page-tabs.feature

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ Feature: Add repositories tab in Helm navigation item
1111
@regression
1212
Scenario: Helm Page on developer perspective: HR-09-TC01
1313
Given user is at developer perspective
14-
When user clicks on the Helm tab
14+
When user clicks on the Helm tab in dev perspective
1515
Then user is able to see Helm Releases and Repositories Tabs
1616
And user is able to see the message "No Helm Releases found"
1717
And user is able to see the link "Browse the catalog to discover available Helm Charts"

frontend/packages/helm-plugin/integration-tests/support/commands/hooks.ts

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
import { guidedTour } from '@console/cypress-integration-tests/views/guided-tour';
2+
13
// To ignore the resizeObserverLoopErrors on CI, adding below code
24
const resizeObserverLoopErrRe = /^[^(ResizeObserver loop limit exceeded)]/;
35
/* eslint-disable consistent-return */
@@ -15,16 +17,17 @@ before(() => {
1517
const bridgePasswordPassword: string = Cypress.env('BRIDGE_HTPASSWD_PASSWORD') || 'test';
1618
cy.login(bridgePasswordIDP, bridgePasswordUsername, bridgePasswordPassword);
1719
cy.document().its('readyState').should('eq', 'complete');
18-
// set the user settings location to local storage, so that no need of deleting config map from openshift-console-user-settings namespace
1920
cy.window().then((win: any) => {
2021
win.SERVER_FLAGS.userSettingsLocation = 'localstorage';
2122
});
2223
// Default helm repo has been changed to a new repo, so executing below line to fix that issue
2324
cy.exec('oc apply -f test-data/red-hat-helm-charts.yaml');
25+
guidedTour.close();
2426
});
2527

2628
beforeEach(() => {
27-
cy.initDeveloper();
29+
cy.initAdmin();
30+
cy.byLegacyTestID('topology-header').should('exist').click({ force: true });
2831
});
2932

3033
after(() => {

frontend/packages/helm-plugin/integration-tests/support/step-definitions/common/common.ts

Lines changed: 15 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@ import { nav } from '@console/cypress-integration-tests/views/nav';
44
import {
55
devNavigationMenu,
66
switchPerspective,
7-
addOptions,
87
catalogCards,
98
catalogTypes,
109
} from '@console/dev-console/integration-tests/support/constants';
@@ -24,6 +23,10 @@ Given('user is at developer perspective', () => {
2423
// cy.testA11y('Developer perspective with guider tour modal');
2524
});
2625

26+
Given('user is at administrator perspective', () => {
27+
perspective.switchTo(switchPerspective.Administrator);
28+
});
29+
2730
Given('user has created or selected namespace {string}', (projectName: string) => {
2831
Cypress.env('NAMESPACE', projectName);
2932
projectNameSpace.selectOrCreateProject(`${projectName}`);
@@ -34,6 +37,11 @@ Given('user is at the Topology page', () => {
3437
topologyPage.verifyTopologyPage();
3538
});
3639

40+
Given('user is at the Topology page in admin view', () => {
41+
cy.byLegacyTestID('topology-header').should('exist').click({ force: true });
42+
topologyPage.verifyTopologyPage();
43+
});
44+
3745
When('user enters Git Repo url as {string}', (gitUrl: string) => {
3846
gitPage.enterGitUrl(gitUrl);
3947
gitPage.verifyValidatedMessage(gitUrl);
@@ -85,8 +93,12 @@ When('user selects {string} card from add page', (cardName: string) => {
8593
addPage.selectCardFromOptions(cardName);
8694
});
8795

88-
Given('user is at Developer Catalog page', () => {
89-
addPage.selectCardFromOptions(addOptions.DeveloperCatalog);
96+
Given('user is at Software Catalog page', () => {
97+
cy.byLegacyTestID('developer-catalog-header').should('exist').click({ force: true });
98+
});
99+
100+
When('user selects Helm Charts type from Software Catalog page', () => {
101+
catalogPage.selectCatalogType(catalogTypes.HelmCharts);
90102
});
91103

92104
When('user switches to the {string} tab', (tab: string) => {

frontend/packages/helm-plugin/integration-tests/support/step-definitions/helm/helm-navigation.ts

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,14 +33,19 @@ Given('user is at developer perspective', () => {
3333
perspective.switchTo(switchPerspective.Developer);
3434
});
3535

36-
When('user clicks on the Helm tab', () => {
36+
When('user clicks on the Helm tab in dev perspective', () => {
37+
cy.get('[data-quickstart-id="qs-admin-nav-helm"]').should('be.visible').click({ force: true });
3738
navigateTo(devNavigationMenu.Helm);
3839
});
3940

4041
Then('user will be redirected to Helm releases page', () => {
4142
detailsPage.titleShouldContain('Helm');
4243
});
4344

45+
Then('user will be redirected to Helm releases page under Helm tab', () => {
46+
detailsPage.titleShouldContain(pageTitle.HelmReleases);
47+
});
48+
4449
Then('user is able to see the message {string}', (noHelmReleasesFound: string) => {
4550
helmPage.verifyMessage(noHelmReleasesFound);
4651
});
@@ -92,6 +97,11 @@ Given('user is at the Helm page', () => {
9297
navigateTo(devNavigationMenu.Helm);
9398
});
9499

100+
Given('user is at the Helm Release tab in admin perspective', () => {
101+
cy.byLegacyTestID('helm-releases-header').should('exist').click({ force: true });
102+
detailsPage.titleShouldContain(pageTitle.HelmReleases);
103+
});
104+
95105
When('user selects checkbox for the Deployed Helm charts', (workloadName: string) => {
96106
topologyPage.verifyWorkloadInTopologyPage(workloadName);
97107
});

frontend/packages/helm-plugin/integration-tests/support/step-definitions/helm/helm-release.ts

Lines changed: 15 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,10 @@
11
import { Given, When, Then } from 'cypress-cucumber-preprocessor/steps';
2-
import {
3-
devNavigationMenu,
4-
pageTitle,
5-
helmActions,
6-
} from '@console/dev-console/integration-tests/support/constants';
2+
import { pageTitle, helmActions } from '@console/dev-console/integration-tests/support/constants';
73
import { helmPO } from '@console/dev-console/integration-tests/support/pageObjects';
84
import {
95
topologyPage,
106
topologySidePane,
117
app,
12-
navigateTo,
138
createHelmChartFromAddPage,
149
} from '@console/dev-console/integration-tests/support/pages';
1510
import { detailsPage } from '../../../../../integration-tests-cypress/views/details-page';
@@ -80,12 +75,23 @@ Then(
8075
);
8176

8277
Given('user is on the Helm page with helm release {string}', (helmRelease: string) => {
83-
navigateTo(devNavigationMenu.Helm);
78+
cy.get('[data-quickstart-id="qs-admin-nav-helm"]').should('be.visible').click({ force: true });
79+
cy.byLegacyTestID('helm-releases-header').should('exist').click({ force: true });
80+
detailsPage.titleShouldContain(pageTitle.HelmReleases);
81+
helmPage.search(helmRelease);
82+
});
83+
84+
Given('user is able to see {string} in helm page in admin view', (helmRelease: string) => {
85+
cy.byLegacyTestID('helm-releases-header').should('exist').click({ force: true });
8486
helmPage.search(helmRelease);
8587
});
8688

87-
Then('user will be redirected to Helm Releases page', () => {
88-
detailsPage.titleShouldContain(pageTitle.Helm);
89+
When('user clicks on the Helm Release tab in admin perspective', () => {
90+
cy.byLegacyTestID('helm-releases-header').should('exist').click({ force: true });
91+
});
92+
93+
Then('user will be redirected to Helm Releases page under Helm tab', () => {
94+
detailsPage.titleShouldContain(pageTitle.HelmReleases);
8995
});
9096

9197
When('user clicks on the Kebab menu', () => {

0 commit comments

Comments
 (0)