Issue 1:
System info

Playwright Version: [v1.35.0]

Operating System: [Debian Bookworm]

Browser: [Chromium]

Other info: Python 3.11

Source code

I provided exact source code that allows reproducing the issue locally.

from playwright.sync_api import sync_playwright

import time
import sys

with sync_playwright() as p:
browser = p.chromium.launch(headless=False)
page = browser.new_page()
page.goto("https://paste.ononoki.org/")

page.locator('xpath=//textarea[@id="message"]').type("HELLO WORLD")
page.get_by_role("button", name="send").click()
page.wait_for_load_state()
print(page.url)

time.sleep(10)
browser.close()
sys.exit()

Steps

[Run the test]

Expected

The actual target URL (ie. where the button takes you) should be printed.

Actual

The code prints https://paste.ononoki.org/ rather than the target url (eg something like https://paste.ononoki.org/?18f7b2d1ee31024c#BMXkAs1MzWBm5Jot4Yc3XPGFH9sTDXFeFBsBneusvAaZ).

page.wait_for_load_state("domcontentloaded") has no effect either.

Issue 2:
System info

Playwright Version: Version 1.36.1

Operating System: Windows 11

Browser: All

Other info:

Source code

playwright.config.ts:

import { defineConfig, devices } from '@playwright/test';

/**
* See https://playwright.dev/docs/test-configuration.
*/
export default defineConfig({
testDir: './e2e/playwright/tests/',
outputDir: './e2e/playwright/test-results/',
// Run tests in files in parallel
fullyParallel: true,
// Fail the build on CI if you accidentally left test.only in the source code.
forbidOnly: !!process.env.CI,
// Retry on CI only */
retries: process.env.CI ? 2 : 0,
// The maximum number of concurrent worker processes to use for parallelizing tests. Can be set as percentage of logical CPU cores, e.g. '50%'.
workers: process.env.CI ? '50%' : '50%',
// Reporter to use. See https://playwright.dev/docs/test-reporters
reporter: process.env.CI ? 'line' : [['html', { outputFolder: './e2e/playwright/reports/' }]],
// Shared settings for all the projects below. See https://playwright.dev/docs/api/class-testoptions.

use: {
// Base URL to use in actions like `await page.goto('/')`.
baseURL: process.env.WEBAPP_URL || 'https://dev-cropmanager.vfltest.dk/#/',
// Collect trace when retrying the failed test. See https://playwright.dev/docs/trace-viewer
trace: 'on-first-retry',
},

// Configure projects for major browsers
projects: [
{
name: 'chromium',
use: { ...devices['Desktop Chrome'] },
},

{
name: 'firefox',
use: { ...devices['Desktop Firefox'] },
},
],
});

authtest.spec.ts:

import { expect, test } from '@playwright/test';

test.use({ storageState: './e2e/playwright/.auth/premium.json' });

test('basic test', async ({ page }) => {
await page.goto('./');

await expect(page).toHaveTitle(/CropManager/);
});

auth.setup.ts:

import { expect, test as setup } from '@playwright/test';

const premiumFile = './e2e/playwright/.auth/premium.json';

setup('authenticate as premium user', async ({ page }) => {
// Perform authentication steps. Replace these actions with your own.
await page.goto('./');
await page.getByRole('button', { name: 'LOG PÅ CROPMANAGER' }).click();

await page.getByLabel('Brugerkonto').fill('PublicUser');
await page.getByLabel('Adgangskode').fill('WeLoveTestCafe');
await page.getByRole('button', { name: 'Log på' }).click();
// Wait until the page receives the cookies.
//
// Sometimes login flow sets cookies in the process of several redirects.
// Wait for the final URL to ensure that the cookies are actually set.
await page.waitForURL('https://dev-cropmanager.vfltest.dk/#/');
await expect(page.getByRole('button', { name: 'LOG PÅ CROPMANAGER' })).toBeVisible();

// End of authentication steps.
await page.context().storageState({ path: premiumFile });
});

Folder structure:

e2e/playwright/.auth

e2e/playwright/tests/auth.setup.ts

e2e/playwright/tests/authtest.spec.ts

playwright.config.ts

Steps

Run the test with provided auth (multiple roles login)

Expected

Expected a premium.json to be created in .auth folder when test was run.

It seems the auth.setup.ts is never run - Am i missing something in configuration? Documentation doesn't state it.

If I for instance comment out this line, the test will pass: // test.use({ storageState: './e2e/playwright/.auth/premium.json' });

Actual

Error: Error reading storage state from ./e2e/playwright/.auth/premium.json:

ENOENT: no such file or directory