overriding the configuration for the multi-session by passing a second parameter don't work

オープン
#4,401 コメント 1 件 リアクション 0 件 担当者 0 名 GitHub で見る

まだ誰も着手していません。

評価

難易度
3/5
見積もり時間
1〜2日
初心者へのやさしさ
35/100
issue の種類
バグ
明瞭さ
おおむね明確
活発さ
停滞
技術スタック
javascript, node.js, playwright
領域
testing-qa

調査の方向性

まず codecept.conf.ts の session 関数と Playwright helper の設定から始め、次に、2 番目のパラメーターを使って、提示された multi-session の例を再現します。session オプションがデフォルト設定とどのように結合されるかを追跡し、デフォルトの代わりに上書きされたブラウザーとデバイスの設定が使用されることを確認します。

索引モデルが issue の本文から書いたものです。

説明

stale
What are you trying to achieve?

I'm trying to override the configuration for multi-session by passing a second parameter to the session function. I want the configuration to apply the overridden settings, but it doesn't work as expected.

What do you get instead?

The overriding doesn't apply; the default configuration in codecept.conf.ts is still being applied.

Provide console output if related. Use --verbose mode for more details.

> crossdevices@1.0.0 codeceptjs
> codeceptjs run --verbose

***************************************
nodeInfo:  16.18.1
osInfo:  macOS 14.4
cpuInfo:  (8) arm64 Apple M2
chromeInfo:  126.0.6478.61
edgeInfo:  126.0.2592.61
firefoxInfo:  undefined
safariInfo:  17.4
If you need more detailed info, just run this: npx codeceptjs info
***************************************
CodeceptJS v3.6.3 #StandWithUkraine
Using test root "/Users/raspfr/repo/poc/crossdevices"
Helpers: Playwright
Plugins: screenshotOnFail, tryTo, retryFailedStep, retryTo, eachElement

login --
    [1]  Starting recording promises
    Timeouts: 
 › [Session] Starting singleton browser session
  test something
    I am on page "https://www.google.com"
    › [Browser:Error] Permissions policy violation: unload is not allowed in this document.
    I wait 5
 › [New Context] {"browser":"webkit","emulate":{"userAgent":"Mozilla/5.0 (iPhone; CPU iPhone OS 16_0 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/17.4 Mobile/15E148 Safari/604.1","viewport":{"width":393,"height":660},"screen":{"width":393,"height":852},"deviceScaleFactor":3,"isMobile":true,"hasTouch":true,"defaultBrowserType":"webkit"}}
    mobile: I am on page "https://www.google.com"
    › [Browser:Info] Autofocus processing was blocked because a document already has a focused element.
    › [Browser:Error] Permissions policy violation: unload is not allowed in this document.
    mobile: I wait 5
  ✔ OK in 11410ms


  OK  | 1 passed   // 13s

Provide test source code if related

import { devices } from "playwright";

Feature("login");

Scenario("test something", ({ I }) => {
  I.amOnPage("https://www.google.com");
  I.wait(5);
  session(
    "mobile",
    {
      browser: "webkit",
      emulate: devices["iPhone 14 Pro"],
    },
    () => {
      I.amOnPage("https://www.google.com");
      I.wait(5);
    }
  );
});

Details

CodeceptJS version: 3.6.3
NodeJS Version: 20.14.5
Operating System: MacOS 14.4 (23E214)
playwright 1.44.1

  • Configuration file:
import { setHeadlessWhen, setCommonPlugins } from "@codeceptjs/configure";
import { devices } from "playwright";

// turn on headless mode when running with HEADLESS=true environment variable
// export HEADLESS=true && npx codeceptjs run
setHeadlessWhen(process.env.HEADLESS);

// enable all common plugins https://github.com/codeceptjs/configure#setcommonplugins
setCommonPlugins();

export const config: CodeceptJS.MainConfig = {
  tests: "./*_test.ts",
  output: "./output",
  helpers: {
    Playwright: {
      browser: "chromium",
      emulate: devices["Chrome Desktop"],
      url: "http://localhost",
      show: true,
    },
  },
  include: {
    I: "./steps_file",
  },
  name: "crossdevices",
};

multisession_issue

主要言語
JavaScript
スター
4.2k
フォーク
756
平均マージ
2日 9時間
マージ済み PR(30日)
16

コントリビューションガイド

コントリビューションガイドを開く

はじめの一歩

  1. issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
  2. 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
  3. リポジトリをフォークし、ブランチを切って変更します。
  4. issue 番号を参照したプルリクエストを送ります。

codeceptjs/CodeceptJS のほかの issue

codeceptjs/CodeceptJS の issue をすべて見る

似ている issue

JavaScript の issue をもっと見る

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。