- 编剧版本:[v1.35.1]
- 操作系统:[macOS 13.4]
- 浏览器:[全部]
- VS代码:1.79.2
- 节点:16.15.1
配置文件
import { defineConfig, devices } from "@playwright/test";
import dotenv from "dotenv";
/**
* See https://playwright.dev/docs/test-configuration.
*/
/**
* Read environment variables from file.
* https://github.com/motdotla/dotenv
*/
dotenv.config();
export default defineConfig({
testDir: "./tests",
projects: [
{ name: "setup", testMatch: ["**/*.setup.ts"], teardown: "teardown" },
{ name: "teardown", testMatch: ["**/*.setup.ts"] },
{
name: "chromium",
use: {
...devices["Desktop Chrome"],
viewport: { width: 1280, height: 768 }
},
testMatch: ["**/*.spec.ts"],
dependencies: ["setup"]
},
{
name: "firefox",
use: {
...devices["Desktop Firefox"],
viewport: { width: 1280, height: 768 }
},
testMatch: ["**/*.spec.ts"],
dependencies: ["setup"]
},
{
name: "webkit",
use: {
...devices["Desktop Safari"],
viewport: { width: 1280, height: 768 }
},
testMatch: ["**/*.spec.ts"],
dependencies: ["setup"]
}
],
/* Shared settings for all projects. See https://playwright.dev/docs/api/class-testoptions. */
use: {
/* Maximum time each action such as `click()` can take. Defaults to 0 (no limit). */
actionTimeout: 0,
/* Base URL to use in actions like `await page.goto('/')`. */
baseURL: process.env.BASE_URL,
trace: "retain-on-failure",
headless: true
/*launchOptions: {
slowMo: 100 //Slow test execution down by 100ms, helpful for debugging
}*/
},
/* Maximum time one test can run for. */
timeout: 2 * 60 * 1000,
globalTimeout: 25 * 60 * 1000,
expect: {
/**
* Maximum time expect() should wait for the condition to be met.
* For example in `await expect(locator).toHaveText();`
*/
timeout: 5000
},
maxFailures: process.env.CI ? 16 : undefined,
/* Run tests in files in parallel */
fullyParallel: false,
/* Fail the build on CI if you accidentally left test.only in the source code. */
forbidOnly: !!process.env.CI,
retries: process.env.CI ? 3 : 1,
/* Use 3 works locally. Use workers equal to 50% of available cores on CI - UNTESTED */
workers: process.env.CI ? "50%" : 3,
/* Reporters to use. See https://playwright.dev/docs/test-reporters */
reporter: [
["html", { open: "never" }],
["./reporters/resultChecker"], //This outputs a file with the current branch and overall run result, to be consumed by GitHub Actions
["./reporters/failed-test-reporter.ts"], //This outputs a log of which tests have failed the last time they were executed, so just the failures can be rerun while debugging
["./reporters/better-dot-reporter.ts"]
]
});
脚步
- 升级到 Playwright 1.35(之前使用 1.34)
- 通过 VSCode 终端运行我们的完整回归套件
pnpx playwright test --project chromium
(我们的是使用 Rush 管理的 monorepo,所以我们不使用npx
)
预计 测试运行将照常完成
实际
测试运行中途停止,通常接近结束,并且没有完成。我们之前没有globalTimeout
在配置中设置值,因此我添加了一个值来帮助尝试诊断这一问题。设置完成后,运行程序将在超过该值时中止(如上面的配置所示设置为 25 分钟,成功运行通常需要大约 10 分钟),但如果没有配置超时,我将不得不手动取消ctrl+C
它一旦明显跑步者不再响应,VSCode 终端就会出现。
我知道这将是一个很难重现的问题,因为它似乎是我们套件中的某些特定内容。不幸的是,由于它包含有关我们应用程序的专有信息,我无法提供整个存储库。至少有两名团队成员(我和我们的一名开发人员)出现了该问题,因此在使用 1.35 时这似乎很常见。
我已经完成了 1.34 的成功运行和 1.35 的挂起/中止运行,均使用DEBUG=pw:api
日志输出并将其保存到文件中。这些文件包含不记名令牌,因此出于安全原因,我宁愿不将它们附在此处,但如果它们可能有助于确定原因,我很乐意直接通过电子邮件发送给它们。
最近运行的点报告器输出因全局超时而中止:
Running 158 tests using 3 workers
··········································································°·····
···················°······°°······································°··°×T
Timed out waiting 1500s for the test suite to run
Timed out waiting 1500s for the teardown for start workers to run
1) [chromium] › 04_managedentities.spec.ts:894:9 › Managed Entities › Create & manage new Legal Entity › ME15 - Deleting a business entity with ownership stake in another business entity @notvisual
"afterAll" hook timeout of 120000ms exceeded.
969 | });
970 |
> 971 | test.afterAll(async () => {
| ^
972 | await deleteAllLegalEntities();
973 | });
974 | });
at /Users/sarahwoodhouse/Documents/repos/core-platform/apps/gelt-frontend-autotests/tests/04_managedentities.spec.ts:971:10
Retry #1 ───────────────────────────────────────────────────────────────────────────────────────
"afterAll" hook timeout of 120000ms exceeded.
969 | });
970 |
> 971 | test.afterAll(async () => {
| ^
972 | await deleteAllLegalEntities();
973 | });
974 | });
at /Users/sarahwoodhouse/Documents/repos/core-platform/apps/gelt-frontend-autotests/tests/04_managedentities.spec.ts:971:10
Slow test file: [chromium] › 01_taxprofile.spec.ts (4.7m)
Slow test file: [chromium] › 03_docvault.spec.ts (3.7m)
Slow test file: [chromium] › 05_assets.cryptoaccount.spec.ts (2.2m)
Slow test file: [chromium] › 02_assets.privateinvestment.spec.ts (2.0m)
Slow test file: [chromium] › 04_managedentities.spec.ts (1.4m)
Consider splitting slow test files to speed up parallel execution
1 failed
[chromium] › 04_managedentities.spec.ts:894:9 › Managed Entities › Create & manage new Legal Entity › ME15 - Deleting a business entity with ownership stake in another business entity @notvisual
13 skipped
144 passed (25.0m)
2 errors were not a part of any test, see above for details