[Codecept Playwright] - Not able to maximize the window. windowSize = "maximize" not working properly

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

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

評価

難易度
4/5
見積もり時間
3〜5日
初心者へのやさしさ
25/100
issue の種類
バグ
明瞭さ
説明が足りない
活発さ
停滞
技術スタック
javascript, node.js, playwright
領域
testing

調査の方向性

conf.js の Playwright ヘルパー設定、特に windowSize、chromium.args、viewport から始め、CodeceptJS 3.6.7 と Node.js 20.12.2 を使用して Windows 11 で動作を再現します。設定した Playwright ブラウザーが、別途起動したブラウザーやページの手動置換を必要とせず、確実に最大化された状態で開けば完了です。

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

説明

I want to maximize the window where my app fit to the entire screen perfectly

By using the option (windowSize = "maximize") in conf.js file does not work.

  • CodeceptJS version: 3.6.7
  • NodeJS Version: 20.12.2
  • Operating System: Windows 11
  • playwright
  • Configuration file:
    const { default: test } = require("playwright/test");

exports.config = {
output: './output',
tests: './other_tests/**.test.js',
helpers: {
Playwright: {
browser: 'chromium',
url: 'localhost:3000',
show: true,
getPageTimeout: 180000,
waitForTimeout: 180000,
waitForNavigation: "networkidle0",
restart: "session",
keepBrowserState: true,
keepCookies: true,
windowSize: "maximize",
chromium: {
args: ['--start-maximized'],
viewport: null
}
},
Generics: {
require: "./helpers/generics.js"
},
ExpectHelper: {}
},
include: {
I: './steps_file.js'
},
timeout: 560,
gherkin: {
features: './features/*.feature',
steps: ['./step_definitions/steps.js'],
},
plugins: {
screenshotOnFail: {
enabled: true
},
tryTo: {
enabled: true
},
allure: {
enabled: true,
require: '@codeceptjs/allure-legacy',
}
},
name: 'test_Automation'
}

I even tried to extend playwright method where I able to maximize the window but not sure how to reuse the new context as I need to close the one created by codeceptjs fixture.

const { chromium } = require('playwright');

Feature('Maximize Browser Window');

Scenario('Maximize window using Playwright', async ({ I }) => {
I.amOnPage('http://localhost'); // Replace with your URL

I.usePlaywrightTo('maximize browser window', async ({ page }) => {
// Close the existing browser context
const browser = page.context().browser();
await browser.close();

// Launch a new browser instance with the --start-maximized argument
const newBrowser = await chromium.launch({
  headless: false,
  args: ["--start-maximized"],
});

// Create a new browser context with a maximized viewport
const context = await newBrowser.newContext({ viewport: null });
const newPage = await context.newPage();

// Navigate to the specified URL
await newPage.goto('http://localhost'); // Replace with your URL

// Set the new page for further CodeceptJS steps
I._setPage(newPage);

});

// Continue with your test steps using the new page
I.see('Welcome');
});

主要言語
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 を短くまとめたダイジェスト。