Skip to content

Commit 5fd0f89

Browse files
stefanonardoclaude
andcommitted
OCPBUGS-82510: Fix web-terminal-adminuser e2e tests broken by createRoot
Replace clickStartButton's synchronous $body.find() check with a Cypress retry-based assertion. createRoot defers renders, so the old check always failed and triggered a recovery path that broke the test state. Also fix broken cos-status-box selectors, move workspace cleanup to Background, and add scrollIntoView() to the perspective switcher toggle. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
1 parent 982f7c1 commit 5fd0f89

File tree

5 files changed

+13
-34
lines changed

5 files changed

+13
-34
lines changed

frontend/packages/integration-tests/views/nav.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ export const nav = {
1111
// dropdown menu inside the toggle element, so .text() on the toggle
1212
// itself would include menu item labels.
1313
cy.byLegacyTestID('perspective-switcher-toggle')
14+
.scrollIntoView()
1415
.should('be.visible')
1516
.then(($toggle) => {
1617
if (text === switchPerspective.Administrator) {
@@ -32,6 +33,7 @@ export const nav = {
3233
case 'Admin':
3334
case 'admin':
3435
cy.byLegacyTestID('perspective-switcher-toggle')
36+
.scrollIntoView()
3537
.should('be.visible')
3638
.then(($toggle) => {
3739
if ($toggle.attr('id') === 'core-platform-perspective') {
@@ -76,6 +78,7 @@ export const nav = {
7678
// dropdown menu item text (PF appends the menu inside the toggle
7779
// element via popperProps.appendTo).
7880
cy.byLegacyTestID('perspective-switcher-toggle')
81+
.scrollIntoView()
7982
.should('be.visible')
8083
.find('.pf-v6-c-menu-toggle__text')
8184
.invoke('text')

frontend/packages/webterminal-plugin/integration-tests/features/web-terminal/web-terminal-adminuser.feature

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,7 @@ Feature: Web Terminal for Admin user
66

77
Background:
88
Given user has logged in
9-
# And user is at administrator perspective
10-
# And user has created or selected namespace "aut-terminal"
9+
And user has closed existing terminal workspace
1110

1211

1312
@regression @ODC-6463
@@ -33,7 +32,6 @@ Feature: Web Terminal for Admin user
3332
And user clicks on Start button
3433
Then user will see the terminal instance for namespace "openshift-terminal"
3534
And user ID obtained by API should match with user id in yaml editor for "openshift-terminal" namespace
36-
And user has closed existing terminal workspace
3735

3836

3937
@smoke @ODC-6745
@@ -44,4 +42,3 @@ Feature: Web Terminal for Admin user
4442
Then user will see the terminal window
4543
And user will see the terminal instance for namespace "openshift-terminal"
4644
And user ID obtained by API should match with user id in yaml editor for "openshift-terminal" namespace
47-
And user has closed existing terminal workspace

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ Given('user can see terminal icon on masthead', () => {
4848

4949
When('user clicks on the Web Terminal icon on the Masthead', () => {
5050
webTerminalPage.clickOpenCloudShellBtn();
51-
cy.get('cos-status-box cos-status-box--loading').should('not.exist');
51+
cy.get('[data-test="loading-box"]').should('not.exist');
5252
});
5353

5454
Then('user will see the terminal window', () => {

frontend/packages/webterminal-plugin/integration-tests/support/step-definitions/pages/web-terminal/initTerminal-page.ts

Lines changed: 7 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,6 @@
1-
import { switchPerspective } from '@console/dev-console/integration-tests/support/constants';
21
import { formPO } from '@console/dev-console/integration-tests/support/pageObjects';
32
import { webTerminalPO } from '@console/dev-console/integration-tests/support/pageObjects/webterminal-po';
4-
import {
5-
app,
6-
perspective,
7-
projectNameSpace,
8-
} from '@console/dev-console/integration-tests/support/pages/app';
9-
import { searchResource } from '@console/dev-console/integration-tests/support/pages/search-resources/search-page';
10-
import { webTerminalPage } from './webTerminal-page';
3+
import { app } from '@console/dev-console/integration-tests/support/pages/app';
114

125
export const initTerminalPage = {
136
clickOnProjectDropDown: () => {
@@ -25,26 +18,12 @@ export const initTerminalPage = {
2518

2619
clickStartButton: () => {
2720
cy.get(formPO.create).should('be.enabled').click({ force: true });
28-
cy.get('body').then(($body) => {
29-
cy.wait(5000);
30-
// Due to initialization issue if multiple operators present OCPBUGS-44891
31-
if ($body.find('[data-test="loading-box-body"]').length === 0) {
32-
cy.log('loading did not go through');
33-
cy.wait(10000);
34-
cy.get(webTerminalPO.closeTerminalIcon).click();
35-
cy.reload();
36-
app.waitForDocumentLoad();
37-
perspective.switchTo(switchPerspective.Administrator);
38-
cy.byLegacyTestID('topology-header').should('exist').click({ force: true });
39-
projectNameSpace.selectProject('openshift-terminal');
40-
webTerminalPage.clickOpenCloudShellBtn();
41-
searchResource.searchResourceByNameAsAdmin('DevWorkspace');
42-
searchResource.selectSearchedItem('terminal');
43-
// cy.get('[data-test="loading-indicator"]').should('not.exist', { timeout: 210000 });
44-
} else {
45-
cy.wait(5000);
46-
}
47-
});
21+
// Wait for the loading indicator to appear after clicking Start.
22+
// The previous implementation used a synchronous $body.find() check that
23+
// relied on React committing the update before Cypress's .then() callback
24+
// ran. Under createRoot, renders are deferred so the check always failed,
25+
// triggering a recovery path that left the app in a broken state (OCPBUGS-82510).
26+
cy.get('[data-test="loading-box-body"]').should('exist');
4827
},
4928

5029
selectProject: (projectName: string) => {

frontend/packages/webterminal-plugin/integration-tests/support/step-definitions/web-terminal/web-terminal-adminuser.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ Given('user can see terminal icon on masthead', () => {
4242

4343
When('user clicks on the Web Terminal icon on the Masthead', () => {
4444
cy.get(webTerminalPO.webTerminalIcon).click();
45-
cy.get('cos-status-box cos-status-box--loading').should('not.exist');
45+
cy.get('[data-test="loading-box"]').should('not.exist');
4646
});
4747

4848
When('user clicks advanced option for Timeout', () => {

0 commit comments

Comments
 (0)