Playwright showing strange behaviour: not respecting TimeOut values and GUI run is different...

Discussão em 'Angular' iniciado por Pianoman, Abril 30, 2025.

  1. Pianoman

    Pianoman Guest

    I am testing my Angular 19 project using Playwright. I have built a game in angular and need a very long test run, maybe something like 15 minutes. Whatever I try, the run stops after 60.000ms (1 minute) with a timeout error. I run my tests using the --ui option:

    npx playwright test --ui --config=playwright.config.js



    Here is my config:

    // @ts-check
    const {defineConfig, devices} = require('@playwright/test');

    console.log(`Setting up the environment`);

    /**
    * Read environment variables from file.
    * https://github.com/motdotla/dotenv
    */
    // require('dotenv').config({ path: path.resolve(__dirname, '.env') });

    /**
    * @see https://playwright.dev/docs/test-configuration
    */
    module.exports = defineConfig({
    timeout: 25 * 60 * 1000,
    globalTimeout: 30 * 60 * 1000,
    expect: {
    timeout: 3 * 60 * 1000,
    },
    testDir: './tests',
    fullyParallel: false,
    forbidOnly: !!process.env.CI,
    retries: process.env.CI ? 2 : 0,
    workers: 1,
    reporter: 'html',
    use: {

    locale: 'nl-NL',
    actionTimeout: 10 * 60 * 1000,
    trace: 'on-first-retry',
    launchOptions: {
    firefoxUserPrefs: {
    'media.autoplay.default': 2 // 2 = block all autoplay
    }
    }
    },

    /* Configure projects for major browsers */
    projects: [
    {
    name: 'firefox',
    locale: 'nl-NL',
    use: {...devices['Desktop Firefox']},
    /*dependencies: ['setup']*/
    },

    ],

    });

    console.log(`Setting up the environment done`);



    And my test file:

    test('Play Interventions - create named intervention and play', async ({page, context}) => {
    test.setTimeout(15 * 60 * 1000);
    page.setDefaultTimeout(5 * 60 * 1000)

    ....


    And no matter the setup / config or calls to test.setTimeout(), the tests always ends after 60 seconds.

    So I thought maybe to try it using the (Jetbrains) IDE runner. Then, the test will not find the right aria role/label and stops early. Now I have i18n implemented in Angular, but the default is dutch (NL) for Development mode. I run my Angular project with ng serve. I added a config option in the Playwright setup to set the locale (locale: 'nl-NL',) but that doesn't help either.

    Any help would be greatly appreciated.

    Greetings Martin

    So I'm stuck... I've read quite a lot, looked at the Playwright website

    Continue reading...

Compartilhe esta Página