After hook is NOT working and browser does NOT close when more than 1 Feature sections exists in test file

未关闭
#4,696 1 条评论 0 个 reaction 已指派 0 人 在 GitHub 查看

还没有人认领这个 Issue。

评估

难度
4/5
预计耗时
3-5 天
新手友好度
35/100
Issue 类型
缺陷
描述清晰度
需要澄清
活跃度
冷清
领域
testing

调研方向

从与 tests/*_tests.ts 匹配的测试以及所示的 CodeceptJS 配置开始,重点关注多个 Feature 部分、restart: true 和 Puppeteer helper 之间的交互。使用多个 Feature 部分复现该问题,并跟踪 After 和 AfterSuite 是否运行。完成的标准是 hooks 能够执行,并且每次测试后浏览器页面都会关闭,而不会累积进程。

由索引模型根据 Issue 内容生成。

描述

stale
What are you trying to achieve?

When there are more than 1 Feature sections in the test file:

  • the browser/page does NOT close after each test, so at the end I have many browsers opened, which slowing down my system.
  • the After and AfterSuite hooks are NOT working at all (are NOT called).

Tests behave (passed/failed) normally and the next test is conducted on newly opened browser, but After and AfterSuite hooks are NOT even called after test(s). Additional hooks / teardown implemented in the codecept.conf do NOT help. Any suggestion?

What do you get instead?

Tests behave (passed/failed) normally and the next test is conducted on newly opened browser, but After and AfterSuite hooks are NOT even called after test(s). Additional hooks / teardown implemented in the codecept.conf do NOT help, so at the end I have many browsers/threads opened, which slowing down my system.

Details
  • CodeceptJS version: 3.6.10
  • NodeJS Version: 20.15.0
  • Operating System: Win11 Pro
  • puppeteer version: 23.11.1
  • Configuration file:
/// <reference types='./steps' />
import { testConfig } from "./testConfig";

const fullScreen: string = "false";

export const config: CodeceptJS.MainConfig = {
  tests: "./tests/*_tests.ts",
  timeout: 60,
  output: "./output",

  helpers: {
    REST: {},
    Puppeteer: {
      url: testUrl,
      browser: "chrome",
      show: true,
      fullPageScreenshots: true,
      uniqueScreenshotNames: false,
      waitForNavigation: ["load", "domcontentloaded"] as any,
      pressKeyDelay: 7,
      waitForTimeout: 30000,
      restart: true,
      windowSize: screenResolution.join("x") as any,
      chrome: {
        args: ["--no-sandbox", `--lang=${lang}`, fullScreen === "true" ? "--start-fullscreen" : ""],
      },
    },
    CustomHelper: {
      require: "./helpers/customHelper.ts",
    },
    AssertWrapper: {
      require: "codeceptjs-assert",
    },
    ResembleHelper: {
      require: "codeceptjs-resemblehelper",
      screenshotFolder: "./output/",
      baseFolder: "./screenshots/base/",
      diffFolder: "./screenshots/diff/",
      prepareBaseImage: false,
      tolerance: 2,
      needsSameDimension: true,
    },
  },
};
主要语言
JavaScript
星标
4.2k
派生
756
平均合并
2 天 9 小时
30 天内合并 PR
16

贡献指南

打开贡献指南

从这里开始

  1. 先读完整个 Issue,再读项目的贡献指南。
  2. 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
  3. Fork 仓库,在一个分支上完成修改。
  4. 提交 Pull Request,并在描述里引用这个 Issue 编号。

codeceptjs/CodeceptJS 的其他 Issue

查看 codeceptjs/CodeceptJS 的全部 Issue

相似的 Issue

更多 JavaScript Issue

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。