Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ODC-7735: Edit ci tests to have step to enable developer perspective #14684

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { guidedTour } from '@console/cypress-integration-tests/views/guided-tour';
import { quickStartSidebarPO } from '../pageObjects/quickStarts-po';
import { checkDeveloperPerspective } from '../pages/functions/checkDeveloperPerspective';

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

after(() => {
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
import { guidedTour } from '@console/cypress-integration-tests/views/guided-tour';

export const checkDeveloperPerspective = () => {
cy.byLegacyTestID('perspective-switcher-toggle').click();
cy.get('body').then(($body) => {
if ($body.find('[data-test-id="perspective-switcher-menu-option"]').length !== 0) {
cy.log('perspective switcher menu enabled');
cy.byLegacyTestID('perspective-switcher-menu-option').contains('Developer');
cy.byLegacyTestID('perspective-switcher-toggle').click();
} else {
cy.exec(
`oc patch console.operator.openshift.io/cluster --type='merge' -p '{"spec":{"customization":{"perspectives":[{"id":"dev","visibility":{"state":"Enabled"}}]}}}'`,
{ failOnNonZeroExit: true },
).then((result) => {
cy.log(result.stderr);
});
cy.reload(true);
cy.document().its('readyState').should('eq', 'complete');
cy.exec(` oc rollout status -w deploy/console -n openshift-console`, {
failOnNonZeroExit: true,
}).then((result) => {
cy.log(result.stderr);
});
cy.log('perspective switcher menu refreshed');
}
guidedTour.close();
});
};
Original file line number Diff line number Diff line change
Expand Up @@ -9,16 +9,16 @@ Feature: Helm Release


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


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


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

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

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


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


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


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


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


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


Scenario: Delete Helm Release through Context Menu: HR-01-TC03
Given user is at the Topology page
Given user is at the Topology page in admin view
When user right clicks on the helm release "nodejs-release" to open the context menu
And user clicks on the "Delete Helm Release" action
And user enters the release name "nodejs-release"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ Feature: Navigations on Helm Chart
# The test expects that there are no helm releases but there is from the previous feature run.
@broken-test
Scenario: Open the Helm tab on the navigation bar when helm charts are absent: HR-05-TC01
When user clicks on the Helm tab
When user clicks on the Helm tab in dev perspective
Then user will be redirected to Helm releases page
And user is able to see the message "No Helm Releases found"
And user will get the link to install helm charts from developer catalog
Expand Down Expand Up @@ -49,7 +49,7 @@ Feature: Navigations on Helm Chart
@smoke
Scenario: Open the Helm tab on the navigation bar when helm charts are present: HR-05-TC05
Given user is at the Helm page
When user clicks on the Helm tab
When user clicks on the Helm tab in dev perspective
Then user will be redirected to Helm releases page
And user will see the helm charts listed

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ Feature: Add repositories tab in Helm navigation item
@regression
Scenario: Helm Page on developer perspective: HR-09-TC01
Given user is at developer perspective
When user clicks on the Helm tab
When user clicks on the Helm tab in dev perspective
Then user is able to see Helm Releases and Repositories Tabs
And user is able to see the message "No Helm Releases found"
And user is able to see the link "Browse the catalog to discover available Helm Charts"
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
import { guidedTour } from '@console/cypress-integration-tests/views/guided-tour';

// To ignore the resizeObserverLoopErrors on CI, adding below code
const resizeObserverLoopErrRe = /^[^(ResizeObserver loop limit exceeded)]/;
/* eslint-disable consistent-return */
Expand All @@ -15,16 +17,17 @@ before(() => {
const bridgePasswordPassword: string = Cypress.env('BRIDGE_HTPASSWD_PASSWORD') || 'test';
cy.login(bridgePasswordIDP, bridgePasswordUsername, bridgePasswordPassword);
cy.document().its('readyState').should('eq', 'complete');
// set the user settings location to local storage, so that no need of deleting config map from openshift-console-user-settings namespace
cy.window().then((win: any) => {
win.SERVER_FLAGS.userSettingsLocation = 'localstorage';
});
// Default helm repo has been changed to a new repo, so executing below line to fix that issue
cy.exec('oc apply -f test-data/red-hat-helm-charts.yaml');
guidedTour.close();
});

beforeEach(() => {
cy.initDeveloper();
cy.initAdmin();
cy.byLegacyTestID('topology-header').should('exist').click({ force: true });
});

after(() => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ import { nav } from '@console/cypress-integration-tests/views/nav';
import {
devNavigationMenu,
switchPerspective,
addOptions,
catalogCards,
catalogTypes,
} from '@console/dev-console/integration-tests/support/constants';
Expand All @@ -24,6 +23,10 @@ Given('user is at developer perspective', () => {
// cy.testA11y('Developer perspective with guider tour modal');
});

Given('user is at administrator perspective', () => {
perspective.switchTo(switchPerspective.Administrator);
});

Given('user has created or selected namespace {string}', (projectName: string) => {
Cypress.env('NAMESPACE', projectName);
projectNameSpace.selectOrCreateProject(`${projectName}`);
Expand All @@ -34,6 +37,11 @@ Given('user is at the Topology page', () => {
topologyPage.verifyTopologyPage();
});

Given('user is at the Topology page in admin view', () => {
cy.byLegacyTestID('topology-header').should('exist').click({ force: true });
topologyPage.verifyTopologyPage();
});

When('user enters Git Repo url as {string}', (gitUrl: string) => {
gitPage.enterGitUrl(gitUrl);
gitPage.verifyValidatedMessage(gitUrl);
Expand Down Expand Up @@ -85,8 +93,12 @@ When('user selects {string} card from add page', (cardName: string) => {
addPage.selectCardFromOptions(cardName);
});

Given('user is at Developer Catalog page', () => {
addPage.selectCardFromOptions(addOptions.DeveloperCatalog);
Given('user is at Software Catalog page', () => {
cy.byLegacyTestID('developer-catalog-header').should('exist').click({ force: true });
});

When('user selects Helm Charts type from Software Catalog page', () => {
catalogPage.selectCatalogType(catalogTypes.HelmCharts);
});

When('user switches to the {string} tab', (tab: string) => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,14 +33,19 @@ Given('user is at developer perspective', () => {
perspective.switchTo(switchPerspective.Developer);
});

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

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

Then('user will be redirected to Helm releases page under Helm tab', () => {
detailsPage.titleShouldContain(pageTitle.HelmReleases);
});

Then('user is able to see the message {string}', (noHelmReleasesFound: string) => {
helmPage.verifyMessage(noHelmReleasesFound);
});
Expand Down Expand Up @@ -92,6 +97,11 @@ Given('user is at the Helm page', () => {
navigateTo(devNavigationMenu.Helm);
});

Given('user is at the Helm Release tab in admin perspective', () => {
cy.byLegacyTestID('helm-releases-header').should('exist').click({ force: true });
detailsPage.titleShouldContain(pageTitle.HelmReleases);
});

When('user selects checkbox for the Deployed Helm charts', (workloadName: string) => {
topologyPage.verifyWorkloadInTopologyPage(workloadName);
});
Expand Down
Original file line number Diff line number Diff line change
@@ -1,15 +1,10 @@
import { Given, When, Then } from 'cypress-cucumber-preprocessor/steps';
import {
devNavigationMenu,
pageTitle,
helmActions,
} from '@console/dev-console/integration-tests/support/constants';
import { pageTitle, helmActions } from '@console/dev-console/integration-tests/support/constants';
import { helmPO } from '@console/dev-console/integration-tests/support/pageObjects';
import {
topologyPage,
topologySidePane,
app,
navigateTo,
createHelmChartFromAddPage,
} from '@console/dev-console/integration-tests/support/pages';
import { detailsPage } from '../../../../../integration-tests-cypress/views/details-page';
Expand Down Expand Up @@ -80,12 +75,23 @@ Then(
);

Given('user is on the Helm page with helm release {string}', (helmRelease: string) => {
navigateTo(devNavigationMenu.Helm);
cy.get('[data-quickstart-id="qs-admin-nav-helm"]').should('be.visible').click({ force: true });
cy.byLegacyTestID('helm-releases-header').should('exist').click({ force: true });
detailsPage.titleShouldContain(pageTitle.HelmReleases);
helmPage.search(helmRelease);
});

Given('user is able to see {string} in helm page in admin view', (helmRelease: string) => {
cy.byLegacyTestID('helm-releases-header').should('exist').click({ force: true });
helmPage.search(helmRelease);
});

Then('user will be redirected to Helm Releases page', () => {
detailsPage.titleShouldContain(pageTitle.Helm);
When('user clicks on the Helm Release tab in admin perspective', () => {
cy.byLegacyTestID('helm-releases-header').should('exist').click({ force: true });
});

Then('user will be redirected to Helm Releases page under Helm tab', () => {
detailsPage.titleShouldContain(pageTitle.HelmReleases);
});

When('user clicks on the Kebab menu', () => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,14 +24,16 @@ describe('Auth test', () => {
const passwd = Cypress.env('BRIDGE_HTPASSWD_PASSWORD') || 'test';
cy.login(idp, username, passwd);
cy.url().should('include', Cypress.config('baseUrl'));

// test Developer perspective is default for test user and guided tour is displayed
nav.sidenav.switcher.shouldHaveText('Developer');
// Below line to be uncommented after pr https://github.com/openshift/console-operator/pull/954 is merged
// nav.sidenav.switcher.shouldHaveText('Administrator');
guidedTour.isOpen();
guidedTour.close();
masthead.username.shouldHaveText(username);

cy.log('switches from dev to admin perspective');
nav.sidenav.switcher.shouldHaveText('Developer');
// nav.sidenav.switcher.shouldHaveText('Developer');
nav.sidenav.switcher.changePerspectiveTo('Administrator');
nav.sidenav.switcher.shouldHaveText('Administrator');

Expand Down Expand Up @@ -69,8 +71,8 @@ describe('Auth test', () => {
// test guided tour is displayed first time switching to 'Developer' perspective
// skip if running localhost
if (!Cypress.config('baseUrl').includes('localhost')) {
nav.sidenav.switcher.changePerspectiveTo('Developer');
nav.sidenav.switcher.shouldHaveText('Developer');
// nav.sidenav.switcher.changePerspectiveTo('Developer');
// nav.sidenav.switcher.shouldHaveText('Developer');
guidedTour.isOpen();
guidedTour.close();
nav.sidenav.switcher.changePerspectiveTo('Administrator');
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import { checkDeveloperPerspective } from '@console/dev-console/integration-tests/support/pages/functions/checkDeveloperPerspective';
import { checkErrors } from '../../support';
import { detailsPage } from '../../views/details-page';
import { guidedTour } from '../../views/guided-tour';
Expand Down Expand Up @@ -135,6 +136,7 @@ describe('Test perspective query parameters', () => {
cy.visit('/k8s/cluster/projects');
listPage.rows.shouldBeLoaded();
guidedTour.close();
checkDeveloperPerspective();
});

afterEach(() => {
Expand Down
Loading