Skip to content

Commit df1d0f5

Browse files
committed
fix broken tests
1 parent eea335a commit df1d0f5

File tree

12 files changed

+60
-68
lines changed

12 files changed

+60
-68
lines changed

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ export class BasePage {
2424
async waitForPageLoad(): Promise<void> {
2525
await this.page.waitForLoadState('domcontentloaded');
2626
try {
27-
await this.loadingScreen.waitFor({ state: 'hidden', timeout: 5000 });
27+
await this.loadingScreen.waitFor({ state: 'hidden', timeout: 15000 });
2828
} catch {
2929
console.log('Loading screen not found');
3030
}

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

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

119119
async navigateToHome(): Promise<void> {
120-
await this.page.goto('/', { waitUntil: 'load' });
120+
await this.page.goto('/', {
121+
waitUntil: 'load',
122+
timeout: 60000
123+
});
121124
await this.waitForPageLoad();
122125
}
123126

124127
async navigateToLogin(): Promise<void> {
125-
await this.page.goto('/#/login', { waitUntil: 'load' });
128+
await this.page.goto('/#/login');
126129
await this.waitForPageLoad();
127130
// Wait for potential redirect to complete by checking URL change
128131
await waitForUrlNotContaining(this.page, '#/login');

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

Lines changed: 4 additions & 14 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,29 +183,19 @@ 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+
await this.page.waitForLoadState('networkidle', { timeout: 15000 });
209199

210200
const filteredResults = await this.page.locator('nz-tree .node').count();
211201
expect(filteredResults).toBeGreaterThanOrEqual(0);

zeppelin-web-angular/e2e/models/notebook-keyboard-page.ts

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -65,8 +65,10 @@ export class NotebookKeyboardPage extends BasePage {
6565
console.warn('Initial navigation failed, trying alternative approach:', navigationError);
6666

6767
// Fallback: Try a more basic navigation
68-
await this.page.goto(`/#/notebook/${noteId}`);
69-
await this.page.waitForTimeout(2000);
68+
await this.page.goto(`/#/notebook/${noteId}`, {
69+
waitUntil: 'load',
70+
timeout: 60000
71+
});
7072

7173
// Check if we at least have the notebook structure
7274
const hasNotebookStructure = await this.page.evaluate(

zeppelin-web-angular/e2e/models/notebook-repos-page.ts

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,10 @@ export class NotebookReposPage extends BasePage {
2727
}
2828

2929
async navigate(): Promise<void> {
30-
await this.page.goto('/#/notebook-repos', { waitUntil: 'load' });
30+
await this.page.goto('/#/notebook-repos', {
31+
waitUntil: 'domcontentloaded',
32+
timeout: 60000
33+
});
3134
await this.page.waitForURL('**/#/notebook-repos', { timeout: 15000 });
3235
await waitForZeppelinReady(this.page);
3336
await this.page.waitForLoadState('networkidle', { timeout: 15000 });

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ export class WorkspacePage extends BasePage {
2626
}
2727

2828
async navigateToWorkspace(): Promise<void> {
29-
await this.page.goto('/', { waitUntil: 'load' });
29+
await this.page.goto('/');
3030
await this.waitForPageLoad();
3131
}
3232
}

zeppelin-web-angular/e2e/tests/app.spec.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ test.describe('Zeppelin App Component', () => {
2222
test.beforeEach(async ({ page }) => {
2323
basePage = new BasePage(page);
2424

25-
await page.goto('/', { waitUntil: 'load' });
25+
await page.goto('/');
2626
});
2727

2828
test('should have correct component selector and structure', async ({ page }) => {
@@ -157,7 +157,7 @@ test.describe('Zeppelin App Component', () => {
157157
}
158158

159159
// Return to home
160-
await page.goto('/', { waitUntil: 'load' });
160+
await page.goto('/');
161161
await waitForZeppelinReady(page);
162162
await expect(zeppelinRoot).toBeAttached();
163163
});

zeppelin-web-angular/e2e/tests/authentication/anonymous-login-redirect.spec.ts

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ test.describe('Anonymous User Login Redirect', () => {
3939

4040
test.describe('Given an anonymous user is already logged in', () => {
4141
test.beforeEach(async ({ page }) => {
42-
await page.goto('/', { waitUntil: 'load' });
42+
await page.goto('/');
4343
await waitForZeppelinReady(page);
4444
});
4545

@@ -58,15 +58,15 @@ test.describe('Anonymous User Login Redirect', () => {
5858
test('When accessing login page directly, Then should display all home page elements correctly', async ({
5959
page
6060
}) => {
61-
await page.goto('/#/login', { waitUntil: 'load' });
61+
await page.goto('/#/login');
6262
await waitForZeppelinReady(page);
6363
await page.waitForURL(url => !url.toString().includes('#/login'));
6464

6565
await homePageUtil.verifyHomePageElements();
6666
});
6767

6868
test('When clicking Zeppelin logo after redirect, Then should maintain home URL and content', async ({ page }) => {
69-
await page.goto('/#/login', { waitUntil: 'load' });
69+
await page.goto('/#/login');
7070
await waitForZeppelinReady(page);
7171
await page.waitForURL(url => !url.toString().includes('#/login'));
7272

@@ -79,7 +79,7 @@ test.describe('Anonymous User Login Redirect', () => {
7979
});
8080

8181
test('When accessing login page, Then should redirect and maintain anonymous user state', async ({ page }) => {
82-
await page.goto('/#/login', { waitUntil: 'load' });
82+
await page.goto('/#/login');
8383
await waitForZeppelinReady(page);
8484
await page.waitForURL(url => !url.toString().includes('#/login'));
8585

@@ -92,7 +92,7 @@ test.describe('Anonymous User Login Redirect', () => {
9292
});
9393

9494
test('When accessing login page, Then should display welcome heading and main sections', async ({ page }) => {
95-
await page.goto('/#/login', { waitUntil: 'load' });
95+
await page.goto('/#/login');
9696
await waitForZeppelinReady(page);
9797
await page.waitForURL(url => !url.toString().includes('#/login'));
9898

@@ -103,7 +103,7 @@ test.describe('Anonymous User Login Redirect', () => {
103103
});
104104

105105
test('When accessing login page, Then should display notebook functionalities', async ({ page }) => {
106-
await page.goto('/#/login', { waitUntil: 'load' });
106+
await page.goto('/#/login');
107107
await waitForZeppelinReady(page);
108108
await page.waitForURL(url => !url.toString().includes('#/login'));
109109

@@ -119,7 +119,7 @@ test.describe('Anonymous User Login Redirect', () => {
119119
test('When accessing login page, Then should display external links in help and community sections', async ({
120120
page
121121
}) => {
122-
await page.goto('/#/login', { waitUntil: 'load' });
122+
await page.goto('/#/login');
123123
await waitForZeppelinReady(page);
124124
await page.waitForURL(url => !url.toString().includes('#/login'));
125125

@@ -145,14 +145,14 @@ test.describe('Anonymous User Login Redirect', () => {
145145
test('When navigating between home and login URLs, Then should maintain consistent user experience', async ({
146146
page
147147
}) => {
148-
await page.goto('/', { waitUntil: 'load' });
148+
await page.goto('/');
149149
await waitForZeppelinReady(page);
150150

151151
const homeMetadata = await homePageUtil.getHomePageMetadata();
152152
expect(homeMetadata.path).toContain('#/');
153153
expect(homeMetadata.isAnonymous).toBe(true);
154154

155-
await page.goto('/#/login', { waitUntil: 'load' });
155+
await page.goto('/#/login');
156156
await waitForZeppelinReady(page);
157157
await page.waitForURL(url => !url.toString().includes('#/login'));
158158

@@ -167,7 +167,7 @@ test.describe('Anonymous User Login Redirect', () => {
167167

168168
test('When multiple page loads occur on login URL, Then should consistently redirect to home', async ({ page }) => {
169169
for (let i = 0; i < 3; i++) {
170-
await page.goto('/#/login', { waitUntil: 'load' });
170+
await page.goto('/#/login');
171171
await waitForZeppelinReady(page);
172172
await waitForUrlNotContaining(page, '#/login');
173173

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(() => {

zeppelin-web-angular/e2e/tests/notebook/published/published-paragraph.spec.ts

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -37,9 +37,8 @@ test.describe('Published Paragraph', () => {
3737

3838
// Handle the welcome modal if it appears
3939
const cancelButton = page.locator('.ant-modal-root button', { hasText: 'Cancel' });
40-
if ((await cancelButton.count()) > 0) {
41-
await cancelButton.click();
42-
}
40+
await cancelButton.click({ timeout: 5000 });
41+
await cancelButton.waitFor({ state: 'hidden', timeout: 5000 });
4342

4443
testUtil = new PublishedParagraphTestUtil(page);
4544
testNotebook = await testUtil.createTestNotebook();

0 commit comments

Comments
 (0)