Rayrun
← Back to Discord Forum

Test fails when running npx playwright test, but passes when running through VSCode using plugin

tcarreon_91666posted in #help-playwright
Open in Discord
tcarreon_91666

Weird issue happening. I created a test and it passes when running via VS Code using the playwright plugin, but fails when I try to run it via the command line using npx playwright test. how can I check to make sure I am using the same test runner for both ways of execution? Or does anyone have any ideas?

This thread is trying to answer question "Why does a test pass when run via VS Code using the playwright plugin, but fail when run via the command line using npx playwright test, and how can the same test runner be ensured for both methods of execution?"

4 replies

could you be more specific on the failure, trace or log would be great for debugging your issue

debbieobrien
debbieobrien

running npx playwright test will run your tests across all projects setup in your config file. by default this is all 3 browsers. running in VS Code by default will only run on chromium. other than that everything is the same

tcarreon_91666

Error: page.waitForResponse: Page closed at ..\pages\blockEnergyPredictions.ts:58

56 |       //});
  57 |

58 | const response = await page.waitForResponse(response => { | ^ 59 | return ( 60 | response.url().startsWith('http://website.com/web/v1.0/agency_blocks/') && 61 | response.status() === 200

Retry #1 ─────────────────────────────────────────
Test timeout of 30000ms exceeded.
Error: locator.waitFor: Page closed

This is the code it was trying to execute: const response = await page.waitForResponse(response => { return ( response.url().startsWith('http://xxx.xx.xx.x/web/v1.0/agency_blocks/') && response.status() === 200 ); }, { timeout: 60000 });

tcarreon_91666

here are the trace files.

Related Discord Threads

TwitterGitHubLinkedIn
AboutQuestionsDiscord ForumBrowser ExtensionTagsQA Jobs

Rayrun is a community for QA engineers. I am constantly looking for new ways to add value to people learning Playwright and other browser automation frameworks. If you have feedback, email luc@ray.run.