Skip to content

Commit

Permalink
Fixed topology package e2e tests
Browse files Browse the repository at this point in the history
  • Loading branch information
sanketpathak committed Nov 30, 2023
1 parent 14e9bd7 commit b0d7bea
Show file tree
Hide file tree
Showing 17 changed files with 93 additions and 35 deletions.
Expand Up @@ -50,5 +50,6 @@ export const devFilePage = {
cy.log(`Issue with git url ${gitUrl}, maybe a private repo url. Please check it`);
}
});
cy.get(gitPO.gitSection.validatedMessage).should('have.text', 'Validated');
},
};
Expand Up @@ -215,7 +215,7 @@ export const navigateTo = (opt: devNavigationMenu) => {
case devNavigationMenu.Consoles: {
cy.get('body').then(($body) => {
if ($body.text().includes('Consoles')) {
cy.byLegacyTestID('dev-perspective-nav').contains('Consoles').click();
cy.byTestID('draggable-pinned-resource-item').contains('Consoles').click();
cy.byTestID('cluster').should('be.visible').click();
} else {
cy.get(devNavigationMenuPO.search).click();
Expand Down Expand Up @@ -289,6 +289,13 @@ export const projectNameSpace = {
});
// Bug: ODC-6164 - is created related to Accessibility violation - Until bug fix, below line is commented to execute the scripts in CI
// cy.testA11y('Create Project modal');
cy.url().then(($url) => {
if ($url.includes('topology/all-namespaces')) {
cy.get('.odc-namespaced-page__content').should('be.visible');
} else if ($url.includes('topology/ns')) {
cy.byLegacyTestID('item-filter').should('be.visible');
}
});
cy.byTestID('dropdown-text-filter').type(projectName);
cy.get('[data-test-id="namespace-bar-dropdown"] span.pf-v5-c-menu-toggle__text')
.first()
Expand Down
@@ -1,4 +1,4 @@
@topology @smoke
@manual @topology @smoke
Feature: Perform actions on topology
User will be able to create workloads and perform actions on topology page

Expand Down
@@ -1,6 +1,6 @@
@topology @ODC6771
Feature: Update user in topology page if Quotas has been reached in a namespace
If any resource reached resource quota limit, a warning alert will be displayed for the user in Topology page.
If any resource reached resource quota limit, a warning alert will be displayed for the user in Topology page.

Background:
Given user is at developer perspective
Expand All @@ -14,16 +14,16 @@ Feature: Update user in topology page if Quotas has been reached in a namespace
And user navigates to Topology page
And user clicks on link to view resource quota details
Then user is redirected to resource quota details page


@regression
Scenario: multiple resources reached quota: T-19-TC02
Given user has created workload with resource type deployment
And user has created two resource quotas using 'testData/resource-quota/resource-quota.yaml' file
When user navigates to Topology page
And user clicks on link to view resource quota details
Then user is redirected to resource quota list page


@regression
Scenario: deployment node has yellow border around it and side-panel shows alert when resource quota is reached: T-19-TC03
Expand All @@ -33,17 +33,18 @@ Feature: Update user in topology page if Quotas has been reached in a namespace
When user clicks on workload 'ex-node-js1'
And user can see sidebar opens with Resources tab selected by default
Then user is able to see resource quota alert
And user is able to see yellow border around 'ex-node-js1' workload
And user is able to see yellow border around 'ex-node-js1' workload


@regression
Scenario: checking background color of deployment node for resource quota alert: T-19-TC04
Given user is at Topology page
When user continously clicks on zoom-out button until it gets maximum zoomed out
Then user is able to see yellow background on workload for resource quota alert


@regression
Scenario: deployment node shows alert when resource quota is reached in list view: T-19-TC05
Given user is at the Topology page
When user clicks on List view button
Then user will see resource quota alert in 'ex-node-js1' list node
Then user will see resource quota alert in 'ex-node-js1' list node
Expand Up @@ -174,7 +174,7 @@ Feature: Topology chart area
Then user is able to see options like Samples, Import from Git, Container Image, From Dockerfile, From Devfile, From Catalog, Database, Operator Backed, Helm Charts, Event Source, Channel


@regression
@regression
Scenario: Add to Project in topology: T-06-TC17
Given user is at the Topology page
When user right clicks on the empty chart area
Expand All @@ -194,8 +194,8 @@ Feature: Topology chart area
And user clicks on Create button
# Crunchy Postgres for Kubernetes operator not installing correctly, won't able to create a postgres.
And user hovers on Add to Project and clicks on "Operator Backed"
And user selects Redis and clicks on Create
And user fills the "Operator Backed" form with yaml at "test-data/redis-standalone.yaml" and clicks Create
And user selects "Postgres Cluster" and clicks on Create
And user fills the "Operator Backed" form with yaml at "test-data/hippo-postgres-cluster.yaml" and clicks Create
And user hovers on Add to Project and clicks on "Helm Charts"
And user selects Nodejs and clicks on Install Helm Charts
And user fills the "Helm Chart" form and clicks Create
Expand Down Expand Up @@ -425,7 +425,9 @@ Feature: Topology chart area
And user can see "Error" in Status section on service binding connnector topology sidebar


@regression @odc-4944
@regression @odc-4944 @broken-test
# Redis operator having issues after 0.14 updates, it does not appears in topology
# https://github.com/OT-CONTAINER-KIT/redis-operator/issues/526
Scenario: Connected status on Service binding details page: T-06-TC35
Given user has created namespace "aut-connected-sb"
And user has installed Service Binding operator
Expand All @@ -440,7 +442,9 @@ Feature: Topology chart area
Then user will see "Connected" Status on Service binding details page


@regression @odc-4944
@regression @odc-4944 @broken-test
# Redis operator having issues after 0.14 updates, it does not appears in topology
# https://github.com/OT-CONTAINER-KIT/redis-operator/issues/526
Scenario: Error status on Service binding details page: T-06-TC36
Given user has created namespace "aut-error-sb"
And user has installed Service Binding operator
Expand All @@ -455,7 +459,9 @@ Feature: Topology chart area
Then user will see "Error" Status on Service binding details page


@regression @odc-7120
@regression @odc-7120 @broken-test
# Redis operator having issues after 0.14 updates, it does not appears in topology
# https://github.com/OT-CONTAINER-KIT/redis-operator/issues/526
Scenario: Create connection using import YAML with Service Binding using Label Selector: T-06-TC37
Given user has created namespace "aut-connected-sb-ls"
And user has installed Service Binding operator
Expand All @@ -472,7 +478,9 @@ Feature: Topology chart area
Then user will see service binding connection


@regression @odc-7120
@regression @odc-7120 @broken-test
# Redis operator having issues after 0.14 updates, it does not appears in topology
# https://github.com/OT-CONTAINER-KIT/redis-operator/issues/526
Scenario: Label specified in Label Selector section on Service binding details page: T-06-TC38
Given user has created namespace "aut-label-details-sb"
And user has installed Service Binding operator
Expand All @@ -488,7 +496,9 @@ Feature: Topology chart area
Then user will see "app=node-ej" in Label Selector section on Service binding details page


@regression @odc-7120
@regression @odc-7120 @broken-test
# Redis operator having issues after 0.14 updates, it does not appears in topology
# https://github.com/OT-CONTAINER-KIT/redis-operator/issues/526
Scenario: Label specified in Label Selector section on Service binding side panel: T-06-TC39
Given user has created namespace "aut-label-panel-sb"
And user has installed Service Binding operator
Expand Down
Expand Up @@ -61,7 +61,7 @@ Feature: Editing an application
Then user will be redirected to Topology with the updated resource limits


@smoke @broken-test
@smoke
Scenario: Editing deployment using form view: T-09-TC05
Given user has created workload "rolling-update" with resource type "Deployment"
When user right clicks on the workload "rolling-update" to open the Context Menu
Expand Down
Expand Up @@ -16,6 +16,7 @@ Feature: Sidebar in topology
And user can see sidebar Details, Resources and Observe tabs
And user verifies name of the node "nodejs-ex-git" and Action drop down present on top of the sidebar
And user is able to see health check notification
And user can see show waiting pods with errors
And user can see traffic details for pod
And user can see close button

Expand Down
Expand Up @@ -22,7 +22,7 @@ export const chartAreaPO = {
eventsource: '[data-test-action="Event Source"]',
channel: '[data-test-action="Channel"]',
filterItem: 'input[placeholder="Filter by keyword..."]',
sampleGo: '[data-test="Sample-Go"]',
sampleBuilderGo: '[data-test="BuilderImage-Go"]',
submitButton: '[data-test-id="submit-button"]',
deployImage: '[data-test-id="deploy-image-search-term"]',
validationText: '#form-input-searchTerm-field-helper',
Expand Down
Expand Up @@ -289,7 +289,7 @@ export const topologyPO = {
resourseTitle: '[data-test-id="resource-title"]',
appformName: '[data-test-id="application-form-app-name"]',
djangoPostgreSQL: '[data-test="item-name-Django + PostgreSQL-Templates"]',
NETSample: '[data-test="item-name-.NET-Samples"]',
NETSample: '[data-test="item-name-.NET-Builder Images"]',
monitorApp: '[data-test="item-name-Monitor your sample application-Quick Starts"]',
nodejsDevfiles: '[data-test="item-name-Basic Node.js-Devfiles"]',
nodejsSamples: '[data-test="item-name-Basic Node.js-Samples"]',
Expand Down
Expand Up @@ -60,7 +60,7 @@ export const createWorkloadUsingOptions = (optionName: string, optionalData?: st
const yamlLocation = `support/${optionalData}`;
yamlEditor.setEditorContent(yamlLocation);
cy.get(chartAreaPO.saveChanges).click();
cy.get('[aria-label="Breadcrumb"]').should('contain', 'Redis details');
cy.get('[aria-label="Breadcrumb"]').should('contain', 'details');
navigateTo(devNavigationMenu.Topology);
break;

Expand Down
Expand Up @@ -74,6 +74,12 @@ export const editDeployment = {
cy.get(topologyPO.deploymentStrategy.preLifecycleHook.failurePolicy).click();
cy.get(`[id="${failurePolicy}-link"]`).click();
cy.get(topologyPO.deploymentStrategy.tickButton).click();
cy.on('uncaught:exception', (err) => {
expect(err.message).toContain(
'When Cypress detects uncaught errors originating from your application it will automatically fail the current test.',
); // .to.include
return false;
});
},
selectProject: (projectName: string) => {
cy.get(`[id="${projectName}-link"]`).click();
Expand Down
Expand Up @@ -286,8 +286,17 @@ export const topologyPage = {
},
clickOnApplicationGroupings: (appName: string) => {
cy.reload();
app.waitForLoad();
guidedTour.close();
const id = `[data-id="group:${appName}"] .odc-resource-icon-application`;
cy.get(id).next('text').click({ force: true });
cy.log(id);
cy.get('[data-test-id="base-node-handler"] image').should('be.visible');
cy.get('body').then(($el) => {
if ($el.find(topologyPO.sidePane.applicationGroupingsTitle).length === 0) {
cy.get(id).next('text').click({ force: true });
}
});
// cy.get(id).next('text').click({ force: true });
},
verifyApplicationGroupingsDeleted: (appName: string) => {
cy.reload();
Expand Down
Expand Up @@ -216,7 +216,7 @@ Then('user will see {string} modal', (modalName: string) => {

Then('user will see alert {string}', (alertName: string) => {
app.waitForDocumentLoad();
cy.get('[aria-label="Default Alert"]').should('be.visible').should('contain', alertName);
cy.get('.modal-body-content').contains(alertName).should('be.visible');
modal.cancel();
});

Expand Down Expand Up @@ -297,7 +297,7 @@ When('user clicks on Samples', () => {

When('user selects go sample', () => {
cy.get(chartAreaPO.filterItem).type('Go');
cy.get(chartAreaPO.sampleGo).click();
cy.get(chartAreaPO.sampleBuilderGo).click();
});

When('user hovers on Add to Project and clicks on {string}', (optionName: string) => {
Expand Down Expand Up @@ -329,9 +329,9 @@ When('user selects Postgres Database and clicks on Instantiate Template', () =>
cy.get(chartAreaPO.overlayCreate).click({ force: true });
});

When('user selects Redis and clicks on Create', () => {
cy.get(chartAreaPO.filterItem).type('redis');
cy.get(chartAreaPO.operatorBackedRedis).click();
When('user selects {string} and clicks on Create', (operator: string) => {
cy.get(chartAreaPO.filterItem).type(operator);
cy.get(chartAreaPO.operatorBackedPostgres).click();
cy.get(chartAreaPO.overlayCreate).click({ force: true });
});

Expand Down Expand Up @@ -360,7 +360,7 @@ Then(
'hello-openshift',
'python-app',
'postgres',
'redis-standalone',
'hippo',
'helm-nodejs',
'api-server-source',
'channel',
Expand Down
Expand Up @@ -84,7 +84,7 @@ Then('user will be redirected to Topology with the updated resource limits', ()
});

When('user selects {string} Strategy type under Deployment Strategy', (strategyType: string) => {
cy.wait(50000);
cy.wait(60000);
cy.get(formPO.cancel).click();
editDeployment.selectDeploymentStrategyType(strategyType);
});
Expand Down
Expand Up @@ -41,7 +41,7 @@ Given('user created a workload and is at topology list view', () => {
false,
);
navigateTo(devNavigationMenu.Topology);
cy.get(topologyPO.quickSearchPO.listView).click();
topologyPage.verifyUserIsInListView();
});

Given('user is at topology list view', () => {
Expand Down Expand Up @@ -101,7 +101,7 @@ Then(
);

When('user selects .Net core option', () => {
cy.get(topologyPO.quickSearchPO.NETSample).click();
cy.get(topologyPO.quickSearchPO.NETSample).should('have.length', '2').eq(1).click();
});

When('user clicks on Create Application', () => {
Expand Down Expand Up @@ -151,7 +151,7 @@ Then('user will be redirected to the search results of the Quick Starts Catalog'
});

When('user selects Basic NodeJS Devfiles option', () => {
cy.get(topologyPO.quickSearchPO.nodejsDevfiles).click();
cy.get(topologyPO.quickSearchPO.nodejsDevfiles).eq(0).click();
});

When('user clicks on Create button in the Import from Devfile page', () => {
Expand All @@ -171,7 +171,7 @@ Then(
);

When('user selects Basic NodeJS Samples option', () => {
cy.get(topologyPO.quickSearchPO.nodejsSamples).click();
cy.get(topologyPO.quickSearchPO.nodejsDevfiles).eq(1).click();
});

When('user clicks on Create Devfile Samples', () => {
Expand Down
@@ -1,5 +1,6 @@
import { Given, When, Then, And } from 'cypress-cucumber-preprocessor/steps';
import { detailsPage } from '@console/cypress-integration-tests/views/details-page';
import { guidedTour } from '@console/cypress-integration-tests/views/guided-tour';
import { listPage } from '@console/cypress-integration-tests/views/list-page';
import { modal } from '@console/cypress-integration-tests/views/modal';
import * as yamlView from '@console/cypress-integration-tests/views/yaml-editor';
Expand Down Expand Up @@ -33,7 +34,9 @@ Given('user has created workload with resource type deployment', () => {
});

Given('user has created two resource quotas using {string} file', (yamlLocation) => {
cy.exec(`oc apply -f ${yamlLocation} -n ${Cypress.env('NAMESPACE')}`);
cy.exec(`oc apply -f ${yamlLocation} -n ${Cypress.env('NAMESPACE')}`).then(function (result) {
cy.log(result.stdout);
});
app.waitForDocumentLoad();
});

Expand All @@ -43,6 +46,9 @@ When('user navigates to Topology page', () => {
});

When('user clicks on link to view resource quota details', () => {
cy.reload();
app.waitForLoad();
guidedTour.close();
cy.byTestID('resource-quota-warning').click();
});

Expand Down
@@ -1,9 +1,14 @@
import { Given, When, Then } from 'cypress-cucumber-preprocessor/steps';
import { devNavigationMenu } from '@console/dev-console/integration-tests/support/constants';
import { guidedTour } from '@console/cypress-integration-tests/views/guided-tour';
import {
devNavigationMenu,
switchPerspective,
} from '@console/dev-console/integration-tests/support/constants';
import {
app,
createGitWorkload,
navigateTo,
perspective,
projectNameSpace,
topologyActions,
} from '@console/dev-console/integration-tests/support/pages';
Expand Down Expand Up @@ -85,6 +90,7 @@ When('user enters key as {string}', (annotationKey: string) => {
When('user enters value as {string}', (annotationValue: string) => {
cy.get(topologyPO.deploymentStrategy.envValue).last().clear().type(annotationValue);
cy.get(topologyPO.graph.deleteWorkload).click();
cy.byLegacyTestID('modal-title').should('not.exist', { timeout: 20000 });
});

Then('user can see route decorator has been hidden for workload {string}', (appName: string) => {
Expand Down Expand Up @@ -150,10 +156,21 @@ When('user clicks on {string} from action menu', (actionItem: string) => {
topologyActions.selectAction(actionItem);
});

Then('user can see show waiting pods with errors', () => {
topologySidePane.selectTab('Resources');
cy.get(topologyPO.sidePane.resourcesTab.waitingPods).should('be.visible');
});

Then('user can see traffic details for pod', () => {
topologySidePane.selectTab('Resources');
topologySidePane.verifySection('Pods');
cy.wait(20000);
cy.reload(true);
app.waitForLoad();
guidedTour.close();
cy.get(topologyPO.sidePane.resourcesTab.waitingPods, { timeout: 100000 }).should('not.exist');
perspective.switchTo(switchPerspective.Administrator);
perspective.switchTo(switchPerspective.Developer);
cy.get(topologyPO.sidePane.resourcesTab.podTrafficStatus, { timeout: 100000 }).should(
'be.visible',
);
Expand Down

0 comments on commit b0d7bea

Please sign in to comment.