Skip to content

Commit 180918d

Browse files
authored
fix(e2e): wait for projects page before filtering (RHOAIENG-57594) (#7255)
* fix(e2e): wait for projects page before filtering (RHOAIENG-57594) After visitWithLogin('/projects'), the React app may still be initializing. Calling filterProjectByName immediately races against the page render — if the toolbar hasn't appeared within the default 4 s command timeout, the test fails with "view not loading". Add projectListPage.waitForPageAndToolbar() (15 s title + 30 s toolbar) after visitWithLogin in the three tests that were missing it, matching the pattern already used in the permissions tests. Made-with: Cursor * fix(e2e): bake toolbar wait into ProjectListPage.navigate() (RHOAIENG-57594) Instead of scattering waitForPageAndToolbar() calls at every call site, move the title+toolbar visibility guard into the private wait() method that both navigate() and visit() already call. This ensures every future test that uses either method gets the full render gate for free. Also standardise the three beforeEach blocks that called cy.visitWithLogin('/projects', USER) directly — convert them to the canonical cy.visitWithLogin('/', USER) + projectListPage.navigate() pattern so private wait() covers them too, and the now-redundant waitForPageAndToolbar() public method is removed entirely. * fix(e2e): move timeout to query command in ProjectListPage.wait() Passing { timeout } as the second arg to .should() is silently ignored by Cypress — for 'be.visible' assertions Chai treats it as an unused value argument. The timeout must be on the query command so Cypress uses it to control retry duration. Move both timeouts from .should() to cy.findByTestId() where they will actually take effect. * fix(e2e): move toolbar wait into filterProjectByName (RHOAIENG-57594) Waiting for projects-table-toolbar in private wait() broke mock tests that exercise the empty-state path (shouldBeEmpty) — the toolbar is never rendered when there are no projects, so the assertion timed out. The toolbar guard belongs in filterProjectByName(), the only caller that actually interacts with the toolbar. private wait() keeps just the page-title check, which works for all page states. --------- Co-authored-by: Bob Gregor <Bob Gregor>
1 parent 7e25239 commit 180918d

6 files changed

Lines changed: 8 additions & 12 deletions

File tree

packages/cypress/cypress/pages/projects.ts

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -77,20 +77,14 @@ class ProjectListPage {
7777
}
7878

7979
private wait() {
80-
cy.findByTestId('app-page-title');
80+
cy.findByTestId('app-page-title', { timeout: 15000 }).should('be.visible');
8181
cy.testA11y();
8282
}
8383

8484
findPageTitle() {
8585
return cy.findByTestId('app-page-title');
8686
}
8787

88-
waitForPageAndToolbar() {
89-
this.findPageTitle().should('be.visible', { timeout: 15000 });
90-
this.getTableToolbar().find().should('be.visible', { timeout: 30000 });
91-
return this;
92-
}
93-
9488
shouldHaveProjects() {
9589
this.findProjectsTable().should('exist');
9690
return this;
@@ -151,6 +145,7 @@ class ProjectListPage {
151145
* @param projectName Project Name
152146
*/
153147
filterProjectByName = (projectName: string) => {
148+
cy.findByTestId('projects-table-toolbar', { timeout: 30000 }).should('be.visible');
154149
const projectListToolbar = projectListPage.getTableToolbar();
155150
projectListToolbar.findNameFilter().type(projectName);
156151
};

packages/cypress/cypress/tests/e2e/dataScienceProjects/clusterStorage/testClusterStorageAccessModes.cy.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -78,9 +78,10 @@ describe('Cluster Storage Access Modes Tests', () => {
7878

7979
beforeEach(() => {
8080
cy.step('Log into the application');
81-
cy.visitWithLogin('/projects', HTPASSWD_CLUSTER_ADMIN_USER);
81+
cy.visitWithLogin('/', HTPASSWD_CLUSTER_ADMIN_USER);
8282

8383
cy.step(`Navigate to the Project list tab and search for ${projectName}`);
84+
projectListPage.navigate();
8485
projectListPage.filterProjectByName(projectName);
8586
projectListPage.findProjectLink(projectName).click();
8687

packages/cypress/cypress/tests/e2e/dataScienceProjects/testProjectAdminPermissions.cy.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -129,7 +129,6 @@ describe('Verify that users can provide admin project permissions to non-admin u
129129

130130
cy.step('Verify that the user has access to the created project and can access Permissions');
131131
projectListPage.navigate();
132-
projectListPage.waitForPageAndToolbar();
133132
projectListPage.filterProjectByName(projectName);
134133
projectListPage.findProjectLink(projectName).click();
135134
projectDetails.findSectionTab('permissions').click();

packages/cypress/cypress/tests/e2e/dataScienceProjects/testProjectContributorPermissions.cy.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,6 @@ describe('Verify that users can provide contributor project permissions to non-a
7979
'Verify that the user has access to the created project but cannot access Permissions',
8080
);
8181
projectListPage.navigate();
82-
projectListPage.waitForPageAndToolbar();
8382
projectListPage.filterProjectByName(projectName);
8483
projectListPage.findProjectLink(projectName).click();
8584
cy.log('Attempting to find permissions tab which should not be visible');

packages/cypress/cypress/tests/e2e/dataScienceProjects/workbenches/testWorkbenchStorageClasses.cy.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -110,9 +110,10 @@ describe('Workbench Storage Classes Tests', () => {
110110

111111
beforeEach(() => {
112112
cy.step('Log into the application');
113-
cy.visitWithLogin('/projects', HTPASSWD_CLUSTER_ADMIN_USER);
113+
cy.visitWithLogin('/', HTPASSWD_CLUSTER_ADMIN_USER);
114114

115115
cy.step(`Navigate to the Project list tab and search for ${projectName}`);
116+
projectListPage.navigate();
116117
projectListPage.filterProjectByName(projectName);
117118
projectListPage.findProjectLink(projectName).click();
118119
});

packages/cypress/cypress/tests/e2e/storageClasses/clusterStorage.cy.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,9 +46,10 @@ describe('Regular Users can make use of the Storage Classes in the Cluster Stora
4646
{ tags: ['@Smoke', '@SmokeSet2', '@Dashboard', '@NonConcurrent'] },
4747
() => {
4848
// Authentication and navigation
49-
cy.visitWithLogin('/projects', LDAP_CONTRIBUTOR_USER);
49+
cy.visitWithLogin('/', LDAP_CONTRIBUTOR_USER);
5050
// Open the project
5151
cy.step(`Navigate to the Project list tab and search for ${dspName}`);
52+
projectListPage.navigate();
5253
projectListPage.filterProjectByName(dspName);
5354
projectListPage.findProjectLink(dspName).click();
5455
cy.step('Navigate to the Cluster Storage tab and disable all non-default storage classes');

0 commit comments

Comments
 (0)