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

[release-4.18] OCPBUGS-50647: Enable web terminal tests #14758

Open
wants to merge 2 commits into
base: release-4.18
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
4 changes: 2 additions & 2 deletions frontend/integration-tests/test-cypress.sh
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ if [ -n "${nightly-}" ] && [ -z "${pkg-}" ]; then
yarn run test-cypress-pipelines-nightly
yarn run test-cypress-topology-nightly
yarn run test-cypress-knative-nightly
# yarn run test-cypress-webterminal-nightly
yarn run test-cypress-webterminal-nightly

exit $err;
fi
Expand All @@ -93,12 +93,12 @@ if [ -n "${headless-}" ] && [ -z "${pkg-}" ]; then
yarn run test-cypress-console-headless
yarn run test-cypress-dev-console-headless
yarn run test-cypress-olm-headless
yarn run test-cypress-webterminal-headless
yarn run test-cypress-helm-headless
yarn run test-cypress-knative-headless
yarn run test-cypress-topology-headless
yarn run test-cypress-pipelines-headless
yarn run test-cypress-shipwright-headless
# yarn run test-cypress-webterminal-headless
exit;
fi

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,8 @@ Example:
oc login -u kubeadmin -p $BRIDGE_KUBEADMIN_PASSWORD
oc apply -f ./frontend/packages/console-shared/src/test-data/htpasswd-secret.yaml
oc patch oauths cluster --patch "$(cat ./frontend/packages/console-shared/src/test-data/patch-htpasswd.yaml)" --type=merge
./test-cypress.sh -p dev-console
<!-- Under frontend folder run -->
./integration-tests/test-cypress.sh -p dev-console
```

**Screen shots**:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,7 @@ export enum operators {
RHOAS = 'RHOAS',
Jaeger = 'Red Hat OpenShift distributed tracing platform',
BuildsForOpenshiftOperator = 'builds for Red Hat OpenShift Operator',
DevWorkspaceOperator = 'DevWorkspace Operator',
}

export enum operatorNamespaces {
Expand All @@ -63,6 +64,7 @@ export enum operatorNamespaces {
BuildsForOpenshiftOperator = 'openshift-operators',
WebTerminalOperator = 'openshift-operators',
RedHatIntegrationCamelK = 'openshift-operators',
DevWorkspaceOperator = 'openshift-operators',
}

export enum operatorSubscriptions {
Expand All @@ -72,6 +74,7 @@ export enum operatorSubscriptions {
BuildsForOpenshiftOperator = 'openshift-builds-operator',
WebTerminalOperator = 'web-terminal',
RedHatIntegrationCamelK = 'red-hat-camel-k',
DevWorkspaceOperator = 'devworkspace-operator',
}

export enum operatorPackage {
Expand All @@ -81,6 +84,7 @@ export enum operatorPackage {
BuildsForOpenshiftOperator = 'openshift-builds-operator',
WebTerminalOperator = 'web-terminal',
RedHatIntegrationCamelK = 'red-hat-camel-k',
DevWorkspaceOperator = 'devworkspace-operator',
}

export enum authenticationType {
Expand Down

This file was deleted.

Original file line number Diff line number Diff line change
@@ -1,4 +1,8 @@
export const webTerminalPO = {
webTerminalIcon: '[data-tour-id="tour-cloud-shell-button"]',
addTerminalIcon: '[data-test="add-terminal-icon"]',
closeTerminalIcon: '[data-test="close-terminal-icon"]',
tabsList: '[data-test="multi-tab-terminal"] ul',
openCommandLine: 'button[data-tour-id="tour-cloud-shell-button"]',
terminalWindow: 'canvas.xterm-cursor-layer',
terminalWindowWithEnabledMouseEvent: 'div.xterm-screen>canvas.xterm-cursor-layer',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -139,7 +139,7 @@ export const navigateTo = (opt: devNavigationMenu) => {
case devNavigationMenu.Search: {
cy.get(devNavigationMenuPO.search).click();
cy.get('h1').contains(pageTitle.Search);
cy.testA11y('Search Page in dev perspective');
// cy.testA11y('Search Page in dev perspective');
break;
}
case devNavigationMenu.Helm: {
Expand Down Expand Up @@ -180,7 +180,7 @@ export const navigateTo = (opt: devNavigationMenu) => {
} else {
cy.get(devNavigationMenuPO.search).click();
cy.get('[aria-label="Options menu"]').click();
cy.get('[placeholder="Select Resource"]').should('be.visible').type('route');
cy.get('[placeholder="Resources"]').should('be.visible').type('route');
cy.get('[data-filter-text="RTRoute"]').then(($el) => {
if ($el.text().includes('route.openshift.io/v1')) {
cy.wrap($el).contains('route.openshift.io/v1').click();
Expand All @@ -206,7 +206,7 @@ export const navigateTo = (opt: devNavigationMenu) => {
} else {
cy.get(devNavigationMenuPO.search).click();
cy.get('[aria-label="Options menu"]').click();
cy.get('[placeholder="Select Resource"]').should('be.visible').type('Deployment');
cy.get('[placeholder="Resources"]').should('be.visible').type('Deployment');
cy.get('[data-filter-text="DDeployment"]').click();
cy.get('.co-search-group__pin-toggle').should('be.visible').click();
cy.wait(3000);
Expand All @@ -228,7 +228,7 @@ export const navigateTo = (opt: devNavigationMenu) => {
} else {
cy.get(devNavigationMenuPO.search).click();
cy.get('[aria-label="Options menu"]').click();
cy.get('[placeholder="Select Resource"]').should('be.visible').type('console');
cy.get('[placeholder="Resources"]').should('be.visible').type('console');
cy.get('[data-filter-text="CConsole"]').then(($el) => {
if ($el.text().includes('operator.openshift.io')) {
cy.wrap($el).contains('operator.openshift.io').click();
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { webTerminalPO } from '../../pageObjects/web-terminal-po';
import { webTerminalPO } from '../../pageObjects/webterminal-po';

export const addTerminals = (n: number) => {
for (let i = 0; i < n; i++) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,45 @@ export const checkWebterminalOperatorStatus = (retries: number = 5) => {
}
};

export const checkDevWorkspaceOperatorStatus = (retries: number = 5) => {
const namespace = operatorNamespaces.DevWorkspaceOperator;
const controllerResourceName = 'devworkspace-controller';
const serverResourceName = 'devworkspace-webhook-server';

if (retries === 0) {
throw new Error('Failed to install devworkspace operator - Pod timeout');
} else {
cy.exec(
`oc wait --for=condition=ready pod -l app.kubernetes.io/name=${controllerResourceName} -n ${namespace} --timeout=300s`,
{
failOnNonZeroExit: false,
},
).then(function (result) {
if (result.stdout.includes('condition met')) {
cy.log(`Success: ${result.stdout}`);
} else {
cy.log(result.stderr);
cy.wait(30000);
checkDevWorkspaceOperatorStatus(retries - 1);
}
});
cy.exec(
`oc wait --for=condition=ready pod -l app.kubernetes.io/name=${serverResourceName} -n ${namespace} --timeout=300s`,
{
failOnNonZeroExit: false,
},
).then(function (result) {
if (result.stdout.includes('condition met')) {
cy.log(`Success: ${result.stdout}`);
} else {
cy.log(result.stderr);
cy.wait(30000);
checkDevWorkspaceOperatorStatus(retries - 1);
}
});
}
};

export const checkShipwrightOperatorStatus = (retries: number = 5) => {
const namespace = operatorNamespaces.ShipwrightOperator;
const resourceName = operatorSubscriptions.ShipwrightOperator;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { webTerminalPO } from '../../pageObjects/web-terminal-po';
import { webTerminalPO } from '../../pageObjects/webterminal-po';

export const checkTerminalIcon = (tries: number = 10) => {
if (tries < 1) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ import {
checkBuildsForOpenshiftOperatorStatus,
checkWebterminalOperatorStatus,
checkRedHatIntegrationCamelKOperatorStatus,
checkDevWorkspaceOperatorStatus,
} from './checkOperatorStatus';
import {
createKnativeEventingUsingCLI,
Expand Down Expand Up @@ -42,6 +43,9 @@ export const checkOperatorStatus = (operator: operators) => {
case operators.WebTerminalOperator:
checkWebterminalOperatorStatus();
break;
case operators.DevWorkspaceOperator:
checkDevWorkspaceOperatorStatus();
break;
case operators.RedHatIntegrationCamelK:
checkRedHatIntegrationCamelKOperatorStatus();
break;
Expand Down Expand Up @@ -101,6 +105,10 @@ export const installOperatorUsingCLI = (operator: operators) => {
yamlFile =
'../../shipwright-plugin/integration-tests/testData/buildsForOpenshiftOperatorInstallation/buildsSubscription.yaml';
break;
case operators.DevWorkspaceOperator:
yamlFile =
'../../webterminal-plugin/integration-tests/testData/devworkspaceOperatorSubscription.yaml';
break;
case operators.WebTerminalOperator:
yamlFile =
'../../webterminal-plugin/integration-tests/testData/webterminalOperatorSubscription.yaml';
Expand Down Expand Up @@ -154,6 +162,11 @@ export const checkSubscriptionStatus = (operator: operators) => {
namespace = operatorNamespaces.BuildsForOpenshiftOperator;
subscriptionName = operatorSubscriptions.BuildsForOpenshiftOperator;
break;
case operators.DevWorkspaceOperator:
operatorPackageName = operatorPackage.DevWorkspaceOperator;
namespace = operatorNamespaces.DevWorkspaceOperator;
subscriptionName = operatorSubscriptions.DevWorkspaceOperator;
break;
case operators.WebTerminalOperator:
operatorPackageName = operatorPackage.WebTerminalOperator;
namespace = operatorNamespaces.WebTerminalOperator;
Expand Down Expand Up @@ -206,6 +219,7 @@ export const installBuildsForOpenshiftOperatorUsingCLI = () => {
};

export const installWebterminalOperatorUsingCLI = () => {
// verifyAndInstallOperatorUsingCLI(operators.DevWorkspaceOperator);
verifyAndInstallOperatorUsingCLI(operators.WebTerminalOperator);
};

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,10 @@ import { navigateToAdminMenu } from '../app';
const dataTestIdPref: string = 'data-test-id';

export function performResourceSearching(resourceName: string) {
cy.get('div').contains('Resources').click();
cy.get('input[placeholder="Select Resource"]').clear().type(resourceName);
cy.get(`input[id$=${resourceName}]`).click();
cy.get('[aria-label="Type to filter"]').click();

cy.get('input[placeholder="Resources"]').clear().type(resourceName);
cy.get(`label[id$="${resourceName}"]`).click();
}

export const searchResource = {
Expand All @@ -26,6 +27,7 @@ export const searchResource = {
});
cy.get(adminNavigationMenuPO.home.search).click();
performResourceSearching(resourceName);
cy.byLegacyTestID('close-icon').should('be.visible').click({ force: true });
},

verifyItemInSearchResults: (item: string) => {
Expand All @@ -37,6 +39,6 @@ export const searchResource = {
},

selectSearchedItem: (searchedItem: string) => {
cy.get(`[${dataTestIdPref}^=${searchedItem}]`).should('be.visible').click();
cy.get(`[${dataTestIdPref}^=${searchedItem}]`).should('be.visible').click({ force: true });
},
};
3 changes: 2 additions & 1 deletion frontend/packages/knative-plugin/integration-tests/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -95,5 +95,6 @@ To Execute the scripts on Remote cluster, use below commands
oc login -u kubeadmin -p $BRIDGE_KUBEADMIN_PASSWORD
oc apply -f ./frontend/packages/console-shared/src/test-data/htpasswd-secret.yaml
oc patch oauths cluster --patch "$(cat ./frontend/packages/console-shared/src/test-data/patch-htpasswd.yaml)" --type=merge
./test-cypress.sh -p knative -h true
<!-- Under frontend folder run -->
./integration-tests/test-cypress.sh -p knative -h true
```
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ module.exports = defineConfig({
requestTimeout: 15000,
responseTimeout: 15000,
fixturesFolder: 'testData',
video: true,
reporter: '../../../node_modules/cypress-multi-reporters',
reporterOptions: {
configFile: 'reporter-config.json',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,8 @@ Feature: Web Terminal
As a basic user, I should be able to use web terminal

Background:
Given user with basic rights has installed Web Terminal operator
Given user has logged in as basic user
And user has installed webTerminal in namespace "aut-terminal-basic"
And user has logged in as basic user
And user has created or selected namespace "aut-terminal-basic"

@regression
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,28 +5,43 @@ Feature: Web Terminal for Admin user

Background:
Given user has logged in as admin user
And user has installed Web Terminal operator
And user is at developer perspective
# And user has created or selected namespace "aut-terminal"

@smoke @odc-6745
Scenario: Create new project and use Web Terminal: WT-02-TC01
Given user can see terminal icon on masthead
When user clicks on the Web Terminal icon on the Masthead
And user clicks advanced option for Timeout
And user sets timeout to 1 Minute
And user clicks on Start button
Then user will see the terminal window
Then user will see the terminal instance for namespace "openshift-terminal"
And user ID obtained by API should match with user id in yaml editor for "openshift-terminal" namespace

@regression @odc-6463
Scenario Outline: User is able to open and close multiple terminals in the cloudshell: WT-02-TC02
Scenario Outline: User is able to open and close multiple terminals in the cloudshell: WT-02-TC01
Given user can see terminal icon on masthead
When user clicks on the Web Terminal icon on the Masthead
And user opens <number_of_terminals> additional web terminal tabs
And user closed "<closed_terminal>" web terminal tab
Then user is able see <open_terminals> web terminal tabs
And user closed web terminal window

Examples:
| number_of_terminals | closed_terminal | open_terminals |
| 3 | 2nd | 3 |


@smoke @odc-6745
Scenario: Create new project with timeout and use Web Terminal: WT-02-TC02
Given user can see terminal icon on masthead
When user clicks on the Web Terminal icon on the Masthead
And user clicks advanced option for Timeout
And user sets timeout to "10" Minute
And user clicks on Start button
Then user will see the terminal instance for namespace "openshift-terminal"
And user ID obtained by API should match with user id in yaml editor for "openshift-terminal" namespace
And user has closed existing terminal workspace


@smoke @odc-6745
Scenario: Create new project and use Web Terminal: WT-02-TC03
Given user can see terminal icon on masthead
When user clicks on the Web Terminal icon on the Masthead
And user clicks on Start button
Then user will see the terminal window
And user will see the terminal instance for namespace "openshift-terminal"
And user ID obtained by API should match with user id in yaml editor for "openshift-terminal" namespace
And user has closed existing terminal workspace

Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
import { checkErrors } from '@console/cypress-integration-tests/support';
import { guidedTour } from '@console/cypress-integration-tests/views/guided-tour';
import { installWebterminalOperatorUsingCLI } from '@console/dev-console/integration-tests/support/pages';

before(() => {
cy.login();
cy.document().its('readyState').should('eq', 'complete');
guidedTour.close();
installWebterminalOperatorUsingCLI();
});

after(() => {
const namespaces: string[] = Cypress.env('NAMESPACES') || [];
cy.log(`Deleting "${namespaces.join(' ')}" namespace`);
cy.exec(`oc delete namespace ${namespaces.join(' ')}`, {
failOnNonZeroExit: false,
timeout: 180000,
});
});

beforeEach(() => {
cy.initDeveloper();
});

afterEach(() => {
checkErrors();
});
Original file line number Diff line number Diff line change
Expand Up @@ -5,4 +5,4 @@ import '@console/cypress-integration-tests/support/login';
import '@console/cypress-integration-tests/support/project';
import '@console/cypress-integration-tests/support';
import '@console/dev-console/integration-tests/support/commands/app';
import '@console/dev-console/integration-tests/support/commands/hooks';
import './hooks';
Original file line number Diff line number Diff line change
Expand Up @@ -43,9 +43,11 @@ Given('user can see terminal icon on masthead', () => {

When('user clicks on the Web Terminal icon on the Masthead', () => {
webTerminalPage.clickOpenCloudShellBtn();
cy.get('cos-status-box cos-status-box--loading').should('not.exist');
});

Then('user will see the terminal window', () => {
cy.wait(15000);
webTerminalPage.verifyConnectionRediness();
});

Expand Down
Loading