Skip to content

Commit cb75f70

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

3 files changed

Lines changed: 15 additions & 24 deletions

File tree

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

Lines changed: 3 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,7 @@ export class HomePage extends BasePage {
189189
}
190190

191191
async filterNotes(searchTerm: string): Promise<void> {
192+
await this.nodeList.filterInput.waitFor({ state: 'visible', timeout: 5000 });
192193
await this.nodeList.filterInput.fill(searchTerm);
193194
}
194195

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

Lines changed: 6 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -183,31 +183,23 @@ 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> {
206196
await this.homePage.filterNotes(filterTerm);
207197

208-
await this.page.waitForTimeout(1000);
198+
const notebookTreeLocator = this.page.locator('nz-tree .node');
199+
await notebookTreeLocator.first().waitFor({ state: 'attached', timeout: 5000 });
200+
await this.page.waitForLoadState('domcontentloaded');
209201

210-
const filteredResults = await this.page.locator('nz-tree .node').count();
202+
const filteredResults = await notebookTreeLocator.count();
211203
expect(filteredResults).toBeGreaterThanOrEqual(0);
212204
}
213205

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)