fix(tests): even more tests pass now, just need to fix these last 2
This commit is contained in:
parent
761cb752be
commit
20300286ef
|
|
@ -160,10 +160,10 @@ test.describe('OCR Multiple Languages', () => {
|
|||
|
||||
// Wait for page to be fully loaded and rendered (WebKit needs more time)
|
||||
await page.waitForLoadState('networkidle');
|
||||
await page.waitForTimeout(2000);
|
||||
await helpers.waitForWebKitStability();
|
||||
|
||||
// Wait for the dropzone to be ready
|
||||
await expect(page.locator('text=Drag & drop files here')).toBeVisible({ timeout: 10000 });
|
||||
await expect(page.locator('text=Drag & drop files here')).toBeVisible({ timeout: 15000 });
|
||||
|
||||
// Upload Spanish test document - try multiple selectors for better WebKit compatibility
|
||||
let fileInput = page.locator('input[type="file"]').first();
|
||||
|
|
@ -237,10 +237,10 @@ test.describe('OCR Multiple Languages', () => {
|
|||
|
||||
// Wait for page to be fully loaded and rendered (WebKit needs more time)
|
||||
await page.waitForLoadState('networkidle');
|
||||
await page.waitForTimeout(2000);
|
||||
await helpers.waitForWebKitStability();
|
||||
|
||||
// Wait for the dropzone to be ready
|
||||
await expect(page.locator('text=Drag & drop files here')).toBeVisible({ timeout: 10000 });
|
||||
await expect(page.locator('text=Drag & drop files here')).toBeVisible({ timeout: 15000 });
|
||||
|
||||
// Upload English test document - try multiple selectors for better WebKit compatibility
|
||||
let fileInput = page.locator('input[type="file"]').first();
|
||||
|
|
|
|||
|
|
@ -41,9 +41,56 @@ export class TestHelpers {
|
|||
);
|
||||
}
|
||||
|
||||
async waitForWebKitStability() {
|
||||
const browserName = await this.page.evaluate(() => navigator.userAgent);
|
||||
const isWebKit = browserName.includes('WebKit') && !browserName.includes('Chrome');
|
||||
|
||||
if (isWebKit) {
|
||||
console.log('WebKit stability waiting initiated...');
|
||||
|
||||
// Wait for network to be completely idle
|
||||
await this.page.waitForLoadState('networkidle');
|
||||
await this.page.waitForTimeout(3000);
|
||||
|
||||
// Wait for JavaScript to finish executing
|
||||
await this.page.waitForFunction(() => {
|
||||
return document.readyState === 'complete' &&
|
||||
typeof window !== 'undefined';
|
||||
}, { timeout: 15000 });
|
||||
|
||||
// Extra stability wait
|
||||
await this.page.waitForTimeout(2000);
|
||||
console.log('WebKit stability waiting completed');
|
||||
}
|
||||
}
|
||||
|
||||
async navigateToPage(path: string) {
|
||||
await this.page.goto(path);
|
||||
await this.waitForLoadingToComplete();
|
||||
|
||||
// WebKit-specific stability waiting
|
||||
const browserName = await this.page.evaluate(() => navigator.userAgent);
|
||||
const isWebKit = browserName.includes('WebKit') && !browserName.includes('Chrome');
|
||||
|
||||
if (isWebKit) {
|
||||
console.log('WebKit detected - adding stability waiting for page:', path);
|
||||
|
||||
// Wait for network to be completely idle
|
||||
await this.page.waitForLoadState('networkidle');
|
||||
await this.page.waitForTimeout(3000);
|
||||
|
||||
// Wait for JavaScript to finish executing and ensure we're not stuck on login
|
||||
await this.page.waitForFunction(() => {
|
||||
return document.readyState === 'complete' &&
|
||||
typeof window !== 'undefined' &&
|
||||
!window.location.href.includes('/login') &&
|
||||
!window.location.pathname.includes('/login');
|
||||
}, { timeout: 20000 });
|
||||
|
||||
// Extra stability wait
|
||||
await this.page.waitForTimeout(2000);
|
||||
console.log('WebKit stability waiting completed for:', path);
|
||||
}
|
||||
}
|
||||
|
||||
async takeScreenshotOnFailure(testName: string) {
|
||||
|
|
|
|||
Loading…
Reference in New Issue