Skip to content

Commit 2f2b8d9

Browse files
committed
fix broken tests
1 parent 2bc8b12 commit 2f2b8d9

File tree

3 files changed

+19
-25
lines changed

3 files changed

+19
-25
lines changed

zeppelin-web-angular/e2e/models/home-page.ts

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -117,12 +117,12 @@ export class HomePage extends BasePage {
117117
}
118118

119119
async navigateToHome(): Promise<void> {
120-
await this.page.goto('/', { waitUntil: 'load' });
120+
await this.page.goto('/');
121121
await this.waitForPageLoad();
122122
}
123123

124124
async navigateToLogin(): Promise<void> {
125-
await this.page.goto('/#/login', { waitUntil: 'load' });
125+
await this.page.goto('/#/login');
126126
await this.waitForPageLoad();
127127
// Wait for potential redirect to complete by checking URL change
128128
await waitForUrlNotContaining(this.page, '#/login');
@@ -189,6 +189,8 @@ export class HomePage extends BasePage {
189189
}
190190

191191
async filterNotes(searchTerm: string): Promise<void> {
192+
await this.page.waitForLoadState('domcontentloaded', { timeout: 10000 });
193+
await this.nodeList.filterInput.waitFor({ state: 'visible', timeout: 5000 });
192194
await this.nodeList.filterInput.fill(searchTerm);
193195
}
194196

zeppelin-web-angular/e2e/models/home-page.util.ts

Lines changed: 9 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -114,7 +114,7 @@ export class HomePageUtil {
114114
await expect(this.homePage.notebookList).toBeVisible();
115115

116116
// Additional wait for content to load
117-
await this.page.waitForTimeout(1000);
117+
await this.page.waitForLoadState('networkidle', { timeout: 15000 });
118118
}
119119

120120
async verifyNotebookRefreshFunctionality(): Promise<void> {
@@ -183,31 +183,25 @@ export class HomePageUtil {
183183
async verifyCreateNewNoteWorkflow(): Promise<void> {
184184
await this.homePage.clickCreateNewNote();
185185

186-
await this.page.waitForFunction(
187-
() => {
188-
return document.querySelector('zeppelin-note-create') !== null;
189-
},
190-
{ timeout: 10000 }
191-
);
186+
await this.page.waitForFunction(() => document.querySelector('zeppelin-note-create') !== null, { timeout: 10000 });
192187
}
193188

194189
async verifyImportNoteWorkflow(): Promise<void> {
195190
await this.homePage.clickImportNote();
196191

197-
await this.page.waitForFunction(
198-
() => {
199-
return document.querySelector('zeppelin-note-import') !== null;
200-
},
201-
{ timeout: 10000 }
202-
);
192+
await this.page.waitForFunction(() => document.querySelector('zeppelin-note-import') !== null, { timeout: 10000 });
203193
}
204194

205195
async testFilterFunctionality(filterTerm: string): Promise<void> {
196+
await this.page.waitForLoadState('networkidle', { timeout: 10000 });
206197
await this.homePage.filterNotes(filterTerm);
207198

208-
await this.page.waitForTimeout(1000);
199+
const notebookTreeLocator = this.page.locator('nz-tree .node');
209200

210-
const filteredResults = await this.page.locator('nz-tree .node').count();
201+
await notebookTreeLocator.first().waitFor({ state: 'attached', timeout: 15000 });
202+
await expect(notebookTreeLocator.first()).toBeVisible({ timeout: 20000 });
203+
204+
const filteredResults = await notebookTreeLocator.count();
211205
expect(filteredResults).toBeGreaterThanOrEqual(0);
212206
}
213207

zeppelin-web-angular/e2e/tests/home/home-page-note-operations.spec.ts

Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,8 @@ test.describe('Home Page Note Operations', () => {
2424
await page.goto('/');
2525
await waitForZeppelinReady(page);
2626
await performLoginIfRequired(page);
27-
await page.waitForSelector('zeppelin-node-list', { timeout: 15000 });
27+
const noteListLocator = page.locator('zeppelin-node-list');
28+
await expect(noteListLocator).toBeVisible({ timeout: 15000 });
2829
});
2930

3031
test.describe('Given note operations are available', () => {
@@ -93,13 +94,10 @@ test.describe('Home Page Note Operations', () => {
9394

9495
await page
9596
.waitForFunction(
96-
() => {
97-
return (
98-
document.querySelector('zeppelin-note-rename') !== null ||
99-
document.querySelector('[role="dialog"]') !== null ||
100-
document.querySelector('.ant-modal') !== null
101-
);
102-
},
97+
() =>
98+
document.querySelector('zeppelin-note-rename') !== null ||
99+
document.querySelector('[role="dialog"]') !== null ||
100+
document.querySelector('.ant-modal') !== null,
103101
{ timeout: 5000 }
104102
)
105103
.catch(() => {

0 commit comments

Comments
 (0)