[Codecept Playwright] - Not able to maximize the window. windowSize = "maximize" not working properly
還沒有人認領這個 Issue。
評估
- 難度
- 4/5
- 預估耗時
- 3-5 天
- 新手友好度
- 25/100
- Issue 類型
- 缺陷
- 描述清晰度
- 需要釐清
- 活躍度
- 停滯
- 技術堆疊
- javascript, node.js, playwright
- 領域
- testing
研究方向
從 conf.js 中的 Playwright helper 設定開始,特別檢查 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 天 10 小時
- 30 天內合併 PR
- 18
貢獻指南
從這裡開始
- 先讀完整個 Issue,再讀專案的貢獻指南。
- 在 Issue 下留言說明你要接手 —— 這能避免兩個人做同樣的事。
- Fork 儲存庫,在一個分支上完成修改。
- 送出 Pull Request,並在描述裡引用這個 Issue 編號。
codeceptjs/CodeceptJS 的其他 Issue
-
stale
難度 2/5 1-3 小時 新手友好度 72/100
codeceptjs/CodeceptJS#5420 · 1 則留言 ·
-
stale
難度 2/5 1-3 小時 新手友好度 76/100
codeceptjs/CodeceptJS#5358 · 1 則留言 ·
-
stale
難度 2/5 1-3 小時 新手友好度 78/100
codeceptjs/CodeceptJS#4958 · 10 則留言 · 2 個 reaction ·
-
stale
難度 1/5 1 小時以內 新手友好度 72/100
codeceptjs/CodeceptJS#4778 · 3 則留言 ·
-
stale
難度 4/5 3-5 天 新手友好度 38/100
codeceptjs/CodeceptJS#5618 · 1 則留言 ·
查看 codeceptjs/CodeceptJS 的全部 Issue
相似的 Issue
-
難度 2/5 1-3 小時 新手友好度 70/100
-
難度 2/5 1-3 小時 新手友好度 75/100
mksglu/context-mode#1200 ·
-
難度 2/5 1-3 小時 新手友好度 75/100
neondatabase/website#5944 ·
-
module: core
難度 2/5 1-3 小時 新手友好度 75/100
bigbluebutton/bigbluebutton#25849 ·
-
難度 2/5 1-3 小時 新手友好度 75/100
jaegertracing/jaeger-ui#4506 ·