Skip to content

WTO-324: Fix for WTO regular user tests #15048

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

Open
wants to merge 8 commits into
base: main
Choose a base branch
from
Open
Original file line number Diff line number Diff line change
Expand Up @@ -4,14 +4,14 @@ Feature: Web Terminal

Background:
Given user has logged in as basic user
And user has installed webTerminal in namespace "aut-terminal-basic"
# And user has installed webTerminal in namespace "aut-terminal-basic"
And user has created or selected namespace "aut-terminal-basic"

@regression
Scenario: Open existing Web Terminal instance: WT-01-TC01
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 sets timeout to "1" Minute
And user clicks on Start button
Then user will see the terminal window
And user close current Web Terminal session
Expand Down
Original file line number Diff line number Diff line change
@@ -1,18 +1,14 @@
import { Given, When, Then, And } from 'cypress-cucumber-preprocessor/steps';
import { guidedTour } from '@console/cypress-integration-tests/views/guided-tour';
import { switchPerspective } from '@console/dev-console/integration-tests/support/constants';
import { devNavigationMenuPO } from '@console/dev-console/integration-tests/support/pageObjects';
import {
perspective,
projectNameSpace,
} from '@console/dev-console/integration-tests/support/pages';
import { perspective } from '@console/dev-console/integration-tests/support/pages';
import { checkDeveloperPerspective } from '@console/dev-console/integration-tests/support/pages/functions/checkDeveloperPerspective';
import { checkTerminalIcon } from '@console/dev-console/integration-tests/support/pages/functions/checkTerminalIcon';
import { webTerminalPage } from '@console/webterminal-plugin/integration-tests/support/step-definitions/pages/web-terminal/webTerminal-page';

const idp = Cypress.env('BRIDGE_HTPASSWD_IDP') || 'consoledeveloper';
const username = Cypress.env('BRIDGE_HTPASSWD_USERNAME') || 'consoledeveloper';
const password = Cypress.env('BRIDGE_HTPASSWD_PASSWORD') || 'developer';
const idp = Cypress.env('BRIDGE_HTPASSWD_IDP') || 'test';
const username = Cypress.env('BRIDGE_HTPASSWD_USERNAME') || 'test';
const password = Cypress.env('BRIDGE_HTPASSWD_PASSWORD') || 'test';
const kubeAdmUserName = Cypress.env('KUBEADMIN_NAME') || 'kubeadmin';
const kubeAdmUserPass = Cypress.env('BRIDGE_KUBEADMIN_PASSWORD');

Expand Down Expand Up @@ -77,8 +73,6 @@ And('user has logged in as basic user', () => {
// sometimes guide tour is not closed properly without delay
cy.wait(1000);
guidedTour.close();
perspective.switchTo(switchPerspective.Developer);
cy.get(devNavigationMenuPO.project).click();
});

Given('user is at developer perspective', () => {
Expand All @@ -89,8 +83,3 @@ Given('user is at developer perspective', () => {
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}`);
});
Original file line number Diff line number Diff line change
@@ -1,13 +1,6 @@
import { switchPerspective } from '@console/dev-console/integration-tests/support/constants';
import { formPO } from '@console/dev-console/integration-tests/support/pageObjects';
import { webTerminalPO } from '@console/dev-console/integration-tests/support/pageObjects/webterminal-po';
import {
app,
perspective,
projectNameSpace,
} from '@console/dev-console/integration-tests/support/pages/app';
import { searchResource } from '@console/dev-console/integration-tests/support/pages/search-resources/search-page';
import { webTerminalPage } from './webTerminal-page';
import { app } from '@console/dev-console/integration-tests/support/pages/app';

export const initTerminalPage = {
clickOnProjectDropDown: () => {
Expand All @@ -25,26 +18,8 @@ export const initTerminalPage = {

clickStartButton: () => {
cy.get(formPO.create).should('be.enabled').click({ force: true });
cy.get('body').then(($body) => {
cy.wait(5000);
// Due to initialization issue if multiple operators present OCPBUGS-44891
if ($body.find('[data-test="loading-box-body"]').length === 0) {
cy.log('loading did not go through');
cy.wait(10000);
cy.get(webTerminalPO.terminalCloseWindowBtn).click();
cy.reload();
app.waitForDocumentLoad();
perspective.switchTo(switchPerspective.Administrator);
cy.byLegacyTestID('topology-header').should('exist').click({ force: true });
projectNameSpace.selectProject('openshift-terminal');
webTerminalPage.clickOpenCloudShellBtn();
searchResource.searchResourceByNameAsAdmin('DevWorkspace');
searchResource.selectSearchedItem('terminal');
// cy.get('[data-test="loading-indicator"]').should('not.exist', { timeout: 210000 });
} else {
cy.wait(5000);
}
});
cy.get('[data-test="loading-box-body"]').should('exist', { timeout: 5000 }); // wait for "loading..." appears
cy.get('[data-test="loading-box-body"]').should('not.exist', { timeout: 180000 }); // wait for terminal loading
},

selectProject: (projectName: string) => {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,12 @@
import { When, Then, And, Given } from 'cypress-cucumber-preprocessor/steps';
import { installWebterminalOperatorUsingCLI } from '@console/dev-console/integration-tests/support/pages';
import {
adminNavigationMenuPO,
devNavigationMenuPO,
} from '@console/dev-console/integration-tests/support/pageObjects';
import {
installWebterminalOperatorUsingCLI,
projectNameSpace,
} from '@console/dev-console/integration-tests/support/pages';
import { webTerminalPage } from '@console/webterminal-plugin/integration-tests/support/step-definitions/pages/web-terminal/webTerminal-page';

Given('user with basic rights has installed Web Terminal operator', () => {
Expand All @@ -17,7 +24,7 @@ Then('user will see the terminal window opened in new tab', () => {
});

And('user does nothing with displayed terminal window 1 minutes', () => {
const terminalIdlingTimeout: number = Number(Cypress.env('TERMINAL_IDLING_TIMEOUT')) || 60000;
const terminalIdlingTimeout: number = Number(Cypress.env('TERMINAL_IDLING_TIMEOUT')) || 180000; // [workaround] changed to 180 seconds due to https://issues.redhat.com/browse/WTO-334
cy.wait(terminalIdlingTimeout);
webTerminalPage.verifyInnactivityMessage(terminalIdlingTimeout);
});
Expand All @@ -28,3 +35,11 @@ Then(
webTerminalPage.verifyRestartTerminalButton();
},
);

Given('user has created or selected namespace {string}', (projectName: string) => {
Cypress.env('NAMESPACE', projectName);
cy.get(adminNavigationMenuPO.workloads.main).click();
cy.get(devNavigationMenuPO.topology).click();
projectNameSpace.selectOrCreateProject(`${projectName}`);
// cy.get(devNavigationMenuPO.project).click();
});
Original file line number Diff line number Diff line change
Expand Up @@ -128,3 +128,9 @@ Then('user will see the terminal instance for namespace {string}', (nameSpace: s
// Disabling following line due to terminal loading issue from backend at the first load
// devWorkspacePage.verifyDevWsResourceStatus(devWorkspaceStatuses.running);
});

Given('user has created or selected namespace {string}', (projectName: string) => {
Cypress.env('NAMESPACE', projectName);
projectNameSpace.selectOrCreateProject(`${projectName}`);
// cy.get(devNavigationMenuPO.project).click();
});