[BUG] Global options not working with simple test case
See original GitHub issueContext:
- Playwright Version: 1.21
- Operating System: Linux
- Node.js version: v16.14.1
- Browser: Chromium
System:
- OS: Linux 5.17 openSUSE Tumbleweed 20220404
- Memory: 4.66 GB / 15.29 GB
- Container: Yes
Binaries:
- Node: 16.14.1 - /usr/bin/node
- npm: 8.5.0 - /usr/bin/npm
Languages:
- Bash: 5.1.16 - /usr/bin/bash
Code Snippet
I have the following three files in a src
folder:
test-main.test.ts
import { test } from "@playwright/test";
test("basic test", async ({ context }) => {
const page = await context.newPage();
await page.goto("https://google.com");
await page.waitForTimeout(31 * 1000);
});
playwright.config.ts
import { PlaywrightTestConfig } from "@playwright/test";
const config: PlaywrightTestConfig = {
reporter: "list",
testDir: "./src",
timeout: 60 * 1000,
globalSetup: require.resolve("./global-setup"),
};
export default config;
global-setup.ts
import { chromium, FullConfig } from "@playwright/test";
async function globalSetup(config: FullConfig) {
const baseURL = "http://google.de//";
const storageStatepath = "storageState.json";
const browser = await chromium.launch({ headless: false });
const page = await browser.newPage();
await page.goto(baseURL);
await page.click("#gksS1d");
await page.fill("#identifierId", id);
await page.click("#identifierNext");
await page.fill("#password", password);
await page.click("#passwordNext");
await page.context().storageState({ path: storageStatepath });
await browser.close();
}
export default globalSetup;
Describe the bug
I should not need to authenticate in the test case as I use the global setup to do so (see https://playwright.dev/docs/test-advanced#global-setup-and-teardown). However, the pop up for log in still occur in the test case.
This bug is may be related to https://github.com/microsoft/playwright/issues/13681
Issue Analytics
- State:
- Created a year ago
- Comments:9 (5 by maintainers)
Top Results From Across the Web
Default Test Case Options | ReadyAPI Documentation
This topic describes the default options for newly created test cases. You can change these options later in the Test Case Options dialog....
Read more >java - Class Not Found Exception when running JUnit test
Basic problem here is Mr Eclipse does not find the compiled class. Then, I set the output folder as ... Option 1: Set...
Read more >How to Write Test Cases: The Ultimate Guide with Examples
Tutorial #2: Sample Test Case Template with Examples [Download] (must ... Bugs sheet should list all the issues encountered during testing.
Read more >Define, capture, triage, and manage software bugs in Azure ...
Test tools to capture bugs; Built-in integration across Azure DevOps to track bugs linked to builds, releases, and tests. Note. Bug work item ......
Read more >googletest/advanced.md at main - GitHub
This lets you provide a more readable error message in case of failure and avoid all of the issues described below. Adding Traces...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Thanks @pavelfeldman 😃
I moved the config file from the src folder to the root folder and it worked as expected. Also the problem with the timeout in #13681 is solved with this small fix.
It would be great if the explanation could be mentioned in the docs.
This unfortunately does not help. I have a simple log statement in the
global-setup
but it is not printed.The usage of
require.resolve()
is also in the docs.