microsoft / playwright

Playwright is a framework for Web Testing and Automation. It allows testing Chromium, Firefox and WebKit with a single API.
https://playwright.dev
Apache License 2.0
66.43k stars 3.63k forks source link

[Question] How can I debug `npx playwright test` in headless mode #13381

Closed ChenShuy1 closed 2 years ago

ChenShuy1 commented 2 years ago

Hi. I use docker to build playwright container, there is a problem that I execute npx playwright test and get Timeout error with no helpful info
There is one part of my test-result.json

{
          "title": "未命名",
          "ok": false,
          "tags": [],
          "tests": [
            {
              "timeout": 50000,
              "annotations": [],
              "expectedStatus": "passed",
              "projectName": "",
              "results": [
                {
                  "workerIndex": 1,
                  "status": "timedOut",
                  "duration": 413373,
                  "error": {
                    "message": "\u001b[31mTimeout of 50000ms exceeded.\u001b[39m"
                  },
                  "stdout": [],
                  "stderr": [],
                  "retry": 0,
                  "attachments": []
                }
              ],
              "status": "unexpected"
            }
          ],
          "file": "record-123/test-123.spec.mjs",
          "line": 103,
          "column": 1
        }

If I use PWDEBUG=1 npx playwright test, I get

browserType.launch: Browser closed.
    ==================== Browser output: ====================
    <launching> /ms-playwright/chromium-978106/chrome-linux/chrome --disable-background-networking --enable-features=NetworkService,NetworkServiceInProcess --disable-background-timer-throttling --disable-backgrounding-occluded-windows --disable-breakpad --disable-client-side-phishing-detection --disable-component-extensions-with-background-pages --disable-default-apps --disable-dev-shm-usage --disable-extensions --disable-features=ImprovedCookieControls,LazyFrameLoading,GlobalMediaControls,DestroyProfileOnBrowserClose,MediaRouter,AcceptCHFrame,AutoExpandDetailsElement,CertificateTransparencyComponentUpdater --allow-pre-commit-input --disable-hang-monitor --disable-ipc-flooding-protection --disable-popup-blocking --disable-prompt-on-repost --disable-renderer-backgrounding --disable-sync --force-color-profile=srgb --metrics-recording-only --no-first-run --enable-automation --password-store=basic --use-mock-keychain --no-service-autorun --export-tagged-pdf --no-sandbox --user-data-dir=/tmp/playwright_chromiumdev_profile-1ALG1o --remote-debugging-pipe --no-startup-window
    <launched> pid=1575
    [pid=1575][err] [1575:1575:0407/044633.793900:ERROR:ozone_platform_x11.cc(247)] Missing X server or $DISPLAY
    [pid=1575][err] [1575:1575:0407/044633.794034:ERROR:env.cc(225)] The platform failed to initialize.  Exiting.
    =========================== logs ===========================
    <launching> /ms-playwright/chromium-978106/chrome-linux/chrome --disable-background-networking --enable-features=NetworkService,NetworkServiceInProcess --disable-background-timer-throttling --disable-backgrounding-occluded-windows --disable-breakpad --disable-client-side-phishing-detection --disable-component-extensions-with-background-pages --disable-default-apps --disable-dev-shm-usage --disable-extensions --disable-features=ImprovedCookieControls,LazyFrameLoading,GlobalMediaControls,DestroyProfileOnBrowserClose,MediaRouter,AcceptCHFrame,AutoExpandDetailsElement,CertificateTransparencyComponentUpdater --allow-pre-commit-input --disable-hang-monitor --disable-ipc-flooding-protection --disable-popup-blocking --disable-prompt-on-repost --disable-renderer-backgrounding --disable-sync --force-color-profile=srgb --metrics-recording-only --no-first-run --enable-automation --password-store=basic --use-mock-keychain --no-service-autorun --export-tagged-pdf --no-sandbox --user-data-dir=/tmp/playwright_chromiumdev_profile-1ALG1o --remote-debugging-pipe --no-startup-window
    <launched> pid=1575
    [pid=1575][err] [1575:1575:0407/044633.793900:ERROR:ozone_platform_x11.cc(247)] Missing X server or $DISPLAY
    [pid=1575][err] [1575:1575:0407/044633.794034:ERROR:env.cc(225)] The platform failed to initialize.  Exiting.
    ============================================================

        at Object._baseTest.extend.browser.scope [as fn] (/appops/node_modules/@playwright/test/lib/index.js:183:51)
        at /appops/node_modules/@playwright/test/lib/fixtures.js:78:81

More Infomation: cat /etc/issue

Ubuntu 20.04.4 LTS \n \l

cat /proc/version

Linux version 4.19.87-(xxxx)-1 (root@(xxxxxxx)) (gcc version 8.3.0 (Debian 8.3.0-6)) #2 SMP Mon Sep 7 07:50:31 UTC 2020

dockerfile:

FROM mcr.microsoft.com/playwright:v1.20.1-focal

WORKDIR /appops

COPY *.json /appops/

RUN npm config set registry http://rnpm.hz.netease.com/

RUN npm install

RUN PLAYWRIGHT_BROWSERS_PATH=./ms-playwright npx playwright install --with-deps

RUN chmod 4755 ./ms-playwright

COPY . /appops

RUN npm run tsc

CMD npm start

look for your answer!

liuxingbaoyu commented 2 years ago

https://github.com/microsoft/playwright/issues/11719#issuecomment-1025747892

try xvfb

ChenShuy1 commented 2 years ago

@liuxingbaoyu Same:

# xvfb-run npx playwright test

Running 2 tests using 2 workers

  ✓  test-123.spec.mjs:59:1 › 页面测试所需文件下载 (784ms)
  ✘  test-123.spec.mjs:103:1 › 未命名 (7m)

  1) test-123.spec.mjs:103:1 › 未命名 =================================================================

    Timeout of 50000ms exceeded.

  1 failed
    test-123.spec.mjs:103:1 › 未命名 ==================================================================
  1 passed (7m)

And I also try DEBUG=pw:api

# DEBUG=pw:api npx playwright test

Running 2 tests using 2 workers

  ✓  test-123.spec.mjs:59:1 › 页面测试所需文件下载 (590ms)
  ✘  test-123.spec.mjs:103:1 › 未命名 (6m)
  pw:api => browserType.launch started +0ms

  1) test-123.spec.mjs:103:1 › 未命名 =================================================================

    Timeout of 50000ms exceeded.

  1 failed
    test-123.spec.mjs:103:1 › 未命名 ==================================================================
  1 passed (7m)
mxschmitt commented 2 years ago

You need to run your browser headless: true or xvfb-run npx playwright test.

In the next version we have a better error for that.

ChenShuy1 commented 2 years ago

browser

@mxschmitt But I just want my test run in headless mode. Obviously it cant show more details tell me why the chromium start failed.

mxschmitt commented 2 years ago

Could you share your config with us?

ChenShuy1 commented 2 years ago

It's quite simple:

const config = {
  reporter: [
    [ 'json', { outputFile: './test-result.json' }],
    [ 'html', { open: 'never' }],
  ],
  use: {
    headless: true,
    ignoreHTTPSErrors: true,
  },
};

module.exports = config;
mxschmitt commented 2 years ago

Ah my bad, did not fully read it.

using PWDEBUG=1 starts the Playwright inspector, this requires a window server/desktop. What you want is probably just DEBUG=pw:api or what are your goals? This will print debug logs.

ChenShuy1 commented 2 years ago

@liuxingbaoyu Same:

# xvfb-run npx playwright test

Running 2 tests using 2 workers

  ✓  test-123.spec.mjs:59:1 › 页面测试所需文件下载 (784ms)
  ✘  test-123.spec.mjs:103:1 › 未命名 (7m)

  1) test-123.spec.mjs:103:1 › 未命名 =================================================================

    Timeout of 50000ms exceeded.

  1 failed
    test-123.spec.mjs:103:1 › 未命名 ==================================================================
  1 passed (7m)

And I also try DEBUG=pw:api

# DEBUG=pw:api npx playwright test

Running 2 tests using 2 workers

  ✓  test-123.spec.mjs:59:1 › 页面测试所需文件下载 (590ms)
  ✘  test-123.spec.mjs:103:1 › 未命名 (6m)
  pw:api => browserType.launch started +0ms

  1) test-123.spec.mjs:103:1 › 未命名 =================================================================

    Timeout of 50000ms exceeded.

  1 failed
    test-123.spec.mjs:103:1 › 未命名 ==================================================================
  1 passed (7m)

@mxschmitt yeah. But I tryDEBUG=pw:api, it only print:

   pw:api => browserType.launch started +0ms

makes me confusion 😭 Now how should I do?

mxschmitt commented 2 years ago

Since it looks like launch is failing, try setting DEBUG=pw:browser,pw:api which adds the browser logs.

ChenShuy1 commented 2 years ago
image

@mxschmitt emmm... same

ChenShuy1 commented 2 years ago

Since it looks like launch is failing, try setting DEBUG=pw:browser,pw:api which adds the browser logs.

Or there is any DEBUG value I can use? There doc only apply pw:api

ChenShuy1 commented 2 years ago

I try DEBUG=*

# DEBUG=* npx playwright test ./index.spec.mjs
  pw:channel:event {
  pw:channel:event   guid: '',
  pw:channel:event   method: '__create__',
  pw:channel:event   params: {
  pw:channel:event     type: 'BrowserType',
  pw:channel:event     initializer: {
  pw:channel:event       executablePath: '/ms-playwright/chromium-965416/chrome-linux/chrome',
  pw:channel:event       name: 'chromium'
  pw:channel:event     },
  pw:channel:event     guid: 'browser-type@96391207298d0f4b431663e955f4aeda'
  pw:channel:event   }
  pw:channel:event } +0ms
  pw:channel:event {
  pw:channel:event   guid: '',
  pw:channel:event   method: '__create__',
  pw:channel:event   params: {
  pw:channel:event     type: 'BrowserType',
  pw:channel:event     initializer: {
  pw:channel:event       executablePath: '/ms-playwright/firefox-1316/firefox/firefox',
  pw:channel:event       name: 'firefox'
  pw:channel:event     },
  pw:channel:event     guid: 'browser-type@a5e4ad8f47a55faae59f91fec667cedb'
  pw:channel:event   }
  pw:channel:event } +6ms
  pw:channel:event {
  pw:channel:event   guid: '',
  pw:channel:event   method: '__create__',
  pw:channel:event   params: {
  pw:channel:event     type: 'BrowserType',
  pw:channel:event     initializer: {
  pw:channel:event       executablePath: '/ms-playwright/webkit-1609/pw_run.sh',
  pw:channel:event       name: 'webkit'
  pw:channel:event     },
  pw:channel:event     guid: 'browser-type@fc68216ee2849e27f3581945036087fd'
  pw:channel:event   }
  pw:channel:event } +1ms
  pw:channel:event {
  pw:channel:event   guid: '',
  pw:channel:event   method: '__create__',
  pw:channel:event   params: {
  pw:channel:event     type: 'Android',
  pw:channel:event     initializer: {},
  pw:channel:event     guid: 'android@6ce605d9c02fc08fe8b7da67f49d3b61'
  pw:channel:event   }
  pw:channel:event } +0ms
  pw:channel:event {
  pw:channel:event   guid: '',
  pw:channel:event   method: '__create__',
  pw:channel:event   params: {
  pw:channel:event     type: 'Electron',
  pw:channel:event     initializer: {},
  pw:channel:event     guid: 'electron@ac8dbf1cbaef46d7026d3037bb943ab6'
  pw:channel:event   }
  pw:channel:event } +1ms
  pw:channel:event {
  pw:channel:event   guid: '',
  pw:channel:event   method: '__create__',
  pw:channel:event   params: {
  pw:channel:event     type: 'LocalUtils',
  pw:channel:event     initializer: {},
  pw:channel:event     guid: 'localUtils@f368fb3af733471aedb80efbf7452d16'
  pw:channel:event   }
  pw:channel:event } +1ms
  pw:channel:event {
  pw:channel:event   guid: '',
  pw:channel:event   method: '__create__',
  pw:channel:event   params: {
  pw:channel:event     type: 'Selectors',
  pw:channel:event     initializer: {},
  pw:channel:event     guid: 'selectors@a4eed0df1a98c34dc54da6b02495960d'
  pw:channel:event   }
  pw:channel:event } +88ms
  pw:channel:event {
  pw:channel:event   guid: '',
  pw:channel:event   method: '__create__',
  pw:channel:event   params: {
  pw:channel:event     type: 'Playwright',
  pw:channel:event     initializer: {
  pw:channel:event       chromium: [Object],
  pw:channel:event       firefox: [Object],
  pw:channel:event       webkit: [Object],
  pw:channel:event       android: [Object],
  pw:channel:event       electron: [Object],
  pw:channel:event       utils: [Object],
  pw:channel:event       deviceDescriptors: [Array],
  pw:channel:event       selectors: [Object],
  pw:channel:event       preLaunchedBrowser: undefined
  pw:channel:event     },
  pw:channel:event     guid: 'Playwright'
  pw:channel:event   }
  pw:channel:event } +2ms

Running 1 test using 1 worker

  pw:channel:event {
  pw:channel:event   guid: '',
  pw:channel:event   method: '__create__',
  pw:channel:event   params: {
  pw:channel:event     type: 'BrowserType',
  pw:channel:event     initializer: {
  pw:channel:event       executablePath: '/ms-playwright/chromium-965416/chrome-linux/chrome',
  pw:channel:event       name: 'chromium'
  pw:channel:event     },
  pw:channel:event     guid: 'browser-type@4df59b963c3659a0d88354e853ef5d49'
  pw:channel:event   }
  pw:channel:event } +0ms
  pw:channel:event {
  pw:channel:event   guid: '',
  pw:channel:event   method: '__create__',
  pw:channel:event   params: {
  pw:channel:event     type: 'BrowserType',
  pw:channel:event     initializer: {
  pw:channel:event       executablePath: '/ms-playwright/firefox-1316/firefox/firefox',
  pw:channel:event       name: 'firefox'
  pw:channel:event     },
  pw:channel:event     guid: 'browser-type@7b337adcd76e0dfed25436ebb4c58325'
  pw:channel:event   }
  pw:channel:event } +6ms
  pw:channel:event {
  pw:channel:event   guid: '',
  pw:channel:event   method: '__create__',
  pw:channel:event   params: {
  pw:channel:event     type: 'BrowserType',
  pw:channel:event     initializer: {
  pw:channel:event       executablePath: '/ms-playwright/webkit-1609/pw_run.sh',
  pw:channel:event       name: 'webkit'
  pw:channel:event     },
  pw:channel:event     guid: 'browser-type@286da1297fbfce0a495a7b36915aa3b0'
  pw:channel:event   }
  pw:channel:event } +81ms
  pw:channel:event {
  pw:channel:event   guid: '',
  pw:channel:event   method: '__create__',
  pw:channel:event   params: {
  pw:channel:event     type: 'Android',
  pw:channel:event     initializer: {},
  pw:channel:event     guid: 'android@a2db3eac3eeb63c97351bc4559243cdb'
  pw:channel:event   }
  pw:channel:event } +1ms
  pw:channel:event {
  pw:channel:event   guid: '',
  pw:channel:event   method: '__create__',
  pw:channel:event   params: {
  pw:channel:event     type: 'Electron',
  pw:channel:event     initializer: {},
  pw:channel:event     guid: 'electron@7d65d74d7bb5dcf3a45e1b3a37197e7f'
  pw:channel:event   }
  pw:channel:event } +1ms
  pw:channel:event {
  pw:channel:event   guid: '',
  pw:channel:event   method: '__create__',
  pw:channel:event   params: {
  pw:channel:event     type: 'LocalUtils',
  pw:channel:event     initializer: {},
  pw:channel:event     guid: 'localUtils@eb79c2d43cf21d1f684a06e87f9ac4e3'
  pw:channel:event   }
  pw:channel:event } +1ms
  pw:channel:event {
  pw:channel:event   guid: '',
  pw:channel:event   method: '__create__',
  pw:channel:event   params: {
  pw:channel:event     type: 'Selectors',
  pw:channel:event     initializer: {},
  pw:channel:event     guid: 'selectors@86c63324c8008418713c83b56500e9e8'
  pw:channel:event   }
  pw:channel:event } +1ms
  pw:channel:event {
  pw:channel:event   guid: '',
  pw:channel:event   method: '__create__',
  pw:channel:event   params: {
  pw:channel:event     type: 'Playwright',
  pw:channel:event     initializer: {
  pw:channel:event       chromium: [Object],
  pw:channel:event       firefox: [Object],
  pw:channel:event       webkit: [Object],
  pw:channel:event       android: [Object],
  pw:channel:event       electron: [Object],
  pw:channel:event       utils: [Object],
  pw:channel:event       deviceDescriptors: [Array],
  pw:channel:event       selectors: [Object],
  pw:channel:event       preLaunchedBrowser: undefined
  pw:channel:event     },
  pw:channel:event     guid: 'Playwright'
  pw:channel:event   }
  pw:channel:event } +2ms
  ✘  index.spec.mjs:7:1 › nike (8m)
  pw:test setup playwright +0ms
  pw:test setup _browserOptions +1ms
  pw:test setup baseURL +1ms
  pw:test setup _combinedContextOptions +1ms
  pw:test setup _artifactsDir +0ms
  pw:test setup _setupContextOptionsAndArtifacts +0ms
  pw:test setup browserName +1ms
  pw:test setup browser +0ms
  pw:api => browserType.launch started +0ms
  pw:channel:command {
  pw:channel:command   id: 1,
  pw:channel:command   guid: 'browser-type@4df59b963c3659a0d88354e853ef5d49',
  pw:channel:command   method: 'launch',
  pw:channel:command   params: { ignoreAllDefaultArgs: false, handleSIGINT: false, timeout: 0 }
  pw:channel:command } +0ms
  pw:test teardown _setupContextOptionsAndArtifacts +8m
  pw:test teardown _combinedContextOptions +0ms
  pw:test teardown baseURL +0ms
  pw:test teardown browserName +91ms
  pw:test teardown _artifactsDir +1ms
  pw:test teardown _browserOptions +0ms
  pw:test teardown playwright +0ms

  1) index.spec.mjs:7:1 › nike =====================================================================

    Timeout of 30000ms exceeded.

  Slow test file: index.spec.mjs (8m)
  Consider splitting slow test files to speed up parallel execution

  1 failed
    index.spec.mjs:7:1 › nike
mxschmitt commented 2 years ago

Whats the reason you set the PLAYWRIGHT_BROWSERS_PATH manually?

Did you try it with pw:browser? Normally there should be logs for the spawned browser process. This is most likely a good place to find the reason for the timeout issue.

ChenShuy1 commented 2 years ago

"Whats the reason you set the PLAYWRIGHT_BROWSERS_PATH manually" I did it for verify the chromium download & exist, it's not relate to this problem, just ignore it.

"Did you try it with pw:browser?" Yes, I tried. Unfortunately, it's show nothing but timeout

# DEBUG=pw:browser npx playwright test ./index.spec.mjs

Running 1 test using 1 worker

  ✘  index.spec.mjs:7:1 › nike (9m)
ls

  1) index.spec.mjs:7:1 › nike =====================================================================

    Timeout of 30000ms exceeded.

  Slow test file: index.spec.mjs (9m)
  Consider splitting slow test files to speed up parallel execution

  1 failed
    index.spec.mjs:7:1 › nike ======================================================================

Or your mean is pw:browser used in PLAYWRIGHT_BROWSERS_PATH ? It's SAME

# DEBUG=pw:browser PLAYWRIGHT_BROWSERS_PATH=./ms-playwright npx playwright test ./index.spec.mjs

Running 1 test using 1 worker

  ✘  index.spec.mjs:7:1 › nike (6m)

  1) index.spec.mjs:7:1 › nike =====================================================================

    Timeout of 30000ms exceeded.

  Slow test file: index.spec.mjs (6m)
  Consider splitting slow test files to speed up parallel execution

  1 failed
    index.spec.mjs:7:1 › nike ======================================================================
ChenShuy1 commented 2 years ago

I got new error when I tried to run playwright test like this: index.js

// eslint-disable-next-line @typescript-eslint/no-var-requires
const pw = require('playwright');

(async () => {
  const browser = await pw.chromium.launch({ headless: true }); // 'webkit', 'chromium', 'firefox'
  const context = await browser.newContext();
  const page = await context.newPage();

  await page.goto('https://www.example.com/');
  await page.screenshot({ path: 'example.png' });

  await browser.close();

and execute by DEBUG=* node ./index.js, It show

# DEBUG=* node ./index.js
  pw:channel:event {
  pw:channel:event   guid: '',
  pw:channel:event   method: '__create__',
  pw:channel:event   params: {
  pw:channel:event     type: 'BrowserType',
  pw:channel:event     initializer: {
  pw:channel:event       executablePath: '/ms-playwright/chromium-965416/chrome-linux/chrome',
  pw:channel:event       name: 'chromium'
  pw:channel:event     },
  pw:channel:event     guid: 'browser-type@eb80834a00582be76015a712e71b18db'
  pw:channel:event   }
  pw:channel:event } +0ms
  pw:channel:event {
  pw:channel:event   guid: '',
  pw:channel:event   method: '__create__',
  pw:channel:event   params: {
  pw:channel:event     type: 'BrowserType',
  pw:channel:event     initializer: {
  pw:channel:event       executablePath: '/ms-playwright/firefox-1316/firefox/firefox',
  pw:channel:event       name: 'firefox'
  pw:channel:event     },
  pw:channel:event     guid: 'browser-type@e871331868cd50ea4fd15b09f61494dd'
  pw:channel:event   }
  pw:channel:event } +4ms
  pw:channel:event {
  pw:channel:event   guid: '',
  pw:channel:event   method: '__create__',
  pw:channel:event   params: {
  pw:channel:event     type: 'BrowserType',
  pw:channel:event     initializer: {
  pw:channel:event       executablePath: '/ms-playwright/webkit-1609/pw_run.sh',
  pw:channel:event       name: 'webkit'
  pw:channel:event     },
  pw:channel:event     guid: 'browser-type@eb67d75ed4a6fae040df95d53e57315e'
  pw:channel:event   }
  pw:channel:event } +1ms
  pw:channel:event {
  pw:channel:event   guid: '',
  pw:channel:event   method: '__create__',
  pw:channel:event   params: {
  pw:channel:event     type: 'Android',
  pw:channel:event     initializer: {},
  pw:channel:event     guid: 'android@cbe4348b90f4be59692205251e7fe937'
  pw:channel:event   }
  pw:channel:event } +0ms
  pw:channel:event {
  pw:channel:event   guid: '',
  pw:channel:event   method: '__create__',
  pw:channel:event   params: {
  pw:channel:event     type: 'Electron',
  pw:channel:event     initializer: {},
  pw:channel:event     guid: 'electron@de257cb063c2f55c4d17c136aa9f8165'
  pw:channel:event   }
  pw:channel:event } +0ms
  pw:channel:event {
  pw:channel:event   guid: '',
  pw:channel:event   method: '__create__',
  pw:channel:event   params: {
  pw:channel:event     type: 'LocalUtils',
  pw:channel:event     initializer: {},
  pw:channel:event     guid: 'localUtils@dbedd34fa80d6c3202dfe0a6ff6711be'
  pw:channel:event   }
  pw:channel:event } +1ms
  pw:channel:event {
  pw:channel:event   guid: '',
  pw:channel:event   method: '__create__',
  pw:channel:event   params: {
  pw:channel:event     type: 'Selectors',
  pw:channel:event     initializer: {},
  pw:channel:event     guid: 'selectors@fcca9a3fa3c4fc42990800c1a71ae551'
  pw:channel:event   }
  pw:channel:event } +0ms
  pw:channel:event {
  pw:channel:event   guid: '',
  pw:channel:event   method: '__create__',
  pw:channel:event   params: {
  pw:channel:event     type: 'Playwright',
  pw:channel:event     initializer: {
  pw:channel:event       chromium: [Object],
  pw:channel:event       firefox: [Object],
  pw:channel:event       webkit: [Object],
  pw:channel:event       android: [Object],
  pw:channel:event       electron: [Object],
  pw:channel:event       utils: [Object],
  pw:channel:event       deviceDescriptors: [Array],
  pw:channel:event       selectors: [Object],
  pw:channel:event       preLaunchedBrowser: undefined
  pw:channel:event     },
  pw:channel:event     guid: 'Playwright'
  pw:channel:event   }
  pw:channel:event } +1ms
  pw:api => browserType.launch started +0ms
  pw:channel:command {
  pw:channel:command   id: 1,
  pw:channel:command   guid: 'browser-type@eb80834a00582be76015a712e71b18db',
  pw:channel:command   method: 'launch',
  pw:channel:command   params: { ignoreAllDefaultArgs: false, headless: true }
  pw:channel:command } +0ms
  pw:channel:response {
  pw:channel:response   id: 1,
  pw:channel:response   error: {
  pw:channel:response     error: {
  pw:channel:response       message: 'Timeout 30000ms exceeded.',
  pw:channel:response       stack: 'TimeoutError: Timeout 30000ms exceeded.\n' +
  pw:channel:response         '    at ProgressController.run (/appops/node_modules/playwright/node_modules/playwright-core/lib/server/progress.js:96:26)\n' +
  pw:channel:response         '    at Chromium.launch (/appops/node_modules/playwright/node_modules/playwright-core/lib/server/browserType.js:79:38)\n' +
  pw:channel:response         '    at BrowserTypeDispatcher.launch (/appops/node_modules/playwright/node_modules/playwright-core/lib/dispatchers/browserTypeDispatcher.js:49:40)\n' +
  pw:channel:response         '    at DispatcherConnection.dispatch (/appops/node_modules/playwright/node_modules/playwright-core/lib/dispatchers/dispatcher.js:352:46)',
  pw:channel:response       name: 'TimeoutError'
  pw:channel:response     }
  pw:channel:response   }
  pw:channel:response } +0ms
  pw:api <= browserType.launch failed +1m
node:internal/process/promises:265
            triggerUncaughtException(err, true /* fromPromise */);
            ^

browserType.launch: Timeout 30000ms exceeded.
    at /appops/index.js:5:39
    at Object.<anonymous> (/appops/index.js:11:3) {
  name: 'TimeoutError'
}

Anything you can tell? It's like chromium launch fail.

aslushnikov commented 2 years ago
[pid=1575][err] [1575:1575:0407/044633.793900:ERROR:ozone_platform_x11.cc(247)] Missing X server or $DISPLAY
[pid=1575][err] [1575:1575:0407/044633.794034:ERROR:env.cc(225)] The platform failed to initialize.  Exiting.

@chenshy39 This error was caused by missing XVFB. You added it, and some of your tests started passing, according to this comment: https://github.com/microsoft/playwright/issues/13381#issuecomment-1091642427

Now from here, it went somewhere, and I'm honestly lost at what you do and what's failing.

Let's start over! Please, re-file with details on what you do and what's failing. Make sure to use xvfb if you run headed browsers inside container :)

maxime1992 commented 2 months ago

Same issue here, I've got a timeout and in headless mode I'd just like to see on which line of my test it's failing. Is there any way to do that?