From 4f93e874fe82003138410d343444739b6719696a Mon Sep 17 00:00:00 2001 From: Nathan Wang Date: Mon, 11 Mar 2024 15:45:49 +0800 Subject: [PATCH] chore: extend the timeout of e2e local assertion because of the poor condition of local api. --- frontend/e2e/fixtures/index.ts | 3 ++- frontend/e2e/pages/metrics/ReportStep.ts | 4 ++-- frontend/playwright.config.ts | 4 ++-- 3 files changed, 6 insertions(+), 5 deletions(-) diff --git a/frontend/e2e/fixtures/index.ts b/frontend/e2e/fixtures/index.ts index 206c15906f..a80af0ae8b 100644 --- a/frontend/e2e/fixtures/index.ts +++ b/frontend/e2e/fixtures/index.ts @@ -4,4 +4,5 @@ export const E2E_PROJECT_NAME = 'E2EProjectName'; export const CONFIG_STEP_SAVING_FILENAME = 'config-step.json'; export const METRICS_STEP_SAVING_FILENAME = 'metrics-step.json'; -export const E2E_EXPECT_TIMEOUT = 30 * 1000; +export const E2E_EXPECT_LOCAL_TIMEOUT = 30 * 1000; +export const E2E_EXPECT_CI_TIMEOUT = 30 * 3 * 1000; diff --git a/frontend/e2e/pages/metrics/ReportStep.ts b/frontend/e2e/pages/metrics/ReportStep.ts index 7d3f0c5d6d..d4bc6ccfe4 100644 --- a/frontend/e2e/pages/metrics/ReportStep.ts +++ b/frontend/e2e/pages/metrics/ReportStep.ts @@ -1,7 +1,7 @@ import { checkDownloadReport, downloadFileAndCheck } from 'e2e/utils/download'; import { expect, Locator, Page } from '@playwright/test'; -import { E2E_EXPECT_TIMEOUT } from '../../fixtures'; +import { E2E_EXPECT_CI_TIMEOUT } from '../../fixtures'; import { parse } from 'csv-parse/sync'; import path from 'path'; import fs from 'fs'; @@ -116,7 +116,7 @@ export class ReportStep { } async confirmGeneratedReport() { - await expect(this.page.getByRole('alert')).toContainText('Help Information', { timeout: E2E_EXPECT_TIMEOUT * 3 }); + await expect(this.page.getByRole('alert')).toContainText('Help Information', { timeout: E2E_EXPECT_CI_TIMEOUT }); await expect(this.page.getByRole('alert')).toContainText( 'The file will expire in 30 minutes, please download it in time.', ); diff --git a/frontend/playwright.config.ts b/frontend/playwright.config.ts index 94823198b0..07f40949ec 100644 --- a/frontend/playwright.config.ts +++ b/frontend/playwright.config.ts @@ -1,4 +1,4 @@ -import { E2E_EXPECT_TIMEOUT, VIEWPORT_DEFAULT } from 'e2e/fixtures'; +import { E2E_EXPECT_LOCAL_TIMEOUT, E2E_EXPECT_CI_TIMEOUT, VIEWPORT_DEFAULT } from 'e2e/fixtures'; import { defineConfig, devices } from '@playwright/test'; /** @@ -17,7 +17,7 @@ export default defineConfig({ timeout: 3 * 60 * 1000, testDir: './e2e', expect: { - timeout: E2E_EXPECT_TIMEOUT, + timeout: process.env.CI ? E2E_EXPECT_CI_TIMEOUT : E2E_EXPECT_LOCAL_TIMEOUT, }, /* Run tests in files in parallel */ fullyParallel: true,