fix: optimize test timeouts and wait conditions for better stability
This commit is contained in:
@@ -22,9 +22,10 @@ export default defineConfig({
|
|||||||
suiteTitle: false,
|
suiteTitle: false,
|
||||||
}],
|
}],
|
||||||
],
|
],
|
||||||
timeout: 60000,
|
timeout: 90000,
|
||||||
expect: {
|
expect: {
|
||||||
timeout: 30000,
|
timeout: 45000,
|
||||||
|
toHaveScreenshot: { timeout: 60000 },
|
||||||
},
|
},
|
||||||
use: {
|
use: {
|
||||||
baseURL: env.baseURL,
|
baseURL: env.baseURL,
|
||||||
@@ -33,8 +34,8 @@ export default defineConfig({
|
|||||||
video: env.video,
|
video: env.video,
|
||||||
headless: env.headless,
|
headless: env.headless,
|
||||||
viewport: { width: 1280, height: 720 },
|
viewport: { width: 1280, height: 720 },
|
||||||
actionTimeout: 30000,
|
actionTimeout: 45000,
|
||||||
navigationTimeout: 60000,
|
navigationTimeout: 90000,
|
||||||
launchOptions: {
|
launchOptions: {
|
||||||
slowMo: env.slowMo,
|
slowMo: env.slowMo,
|
||||||
},
|
},
|
||||||
|
|||||||
@@ -22,6 +22,12 @@ export type TestFixtures = {
|
|||||||
};
|
};
|
||||||
|
|
||||||
export const test = base.extend<TestFixtures>({
|
export const test = base.extend<TestFixtures>({
|
||||||
|
page: async ({ page }, use) => {
|
||||||
|
page.setDefaultTimeout(45000);
|
||||||
|
page.setDefaultNavigationTimeout(90000);
|
||||||
|
await use(page);
|
||||||
|
},
|
||||||
|
|
||||||
homePage: async ({ page }, use) => {
|
homePage: async ({ page }, use) => {
|
||||||
const homePage = new HomePage(page);
|
const homePage = new HomePage(page);
|
||||||
await use(homePage);
|
await use(homePage);
|
||||||
|
|||||||
@@ -68,9 +68,9 @@ export class HomePage extends BasePage {
|
|||||||
}
|
}
|
||||||
|
|
||||||
async waitForPageLoad(): Promise<void> {
|
async waitForPageLoad(): Promise<void> {
|
||||||
await this.waitForLoadState('networkidle');
|
await this.waitForLoadState('domcontentloaded');
|
||||||
await this.header.waitFor({ state: 'visible' });
|
await this.header.waitFor({ state: 'visible', timeout: 15000 });
|
||||||
await this.heroSection.waitFor({ state: 'visible' });
|
await this.heroSection.waitFor({ state: 'visible', timeout: 15000 });
|
||||||
}
|
}
|
||||||
|
|
||||||
async getNavigationItems(): Promise<Locator[]> {
|
async getNavigationItems(): Promise<Locator[]> {
|
||||||
|
|||||||
Reference in New Issue
Block a user