Closed moshikd closed 1 year ago
You are recording 5 seconds of video, and it might be encoding it, could you remove video: "retain-on-failure",
? You don't need the video if you are recording the trace.
@pavelfeldman thanks for your reply. i have tested it video: 'off' & trace 'retain on failure' - still i get the timeouts. once i set trace to 'off' the test is executed fast and context teardown is without any issues.
another question: why i get 2 tabs while using the code snippet? i get one tab with blank page and the other tab where the test is running. thanks in advance
@pavelfeldman thanks for your reply. i have tested it video: 'off' & trace 'retain on failure' - still i get the timeouts. once i set trace to 'off' the test is executed fast and context teardown is without any issues.
We cannot act on this without a repro, is there any chance you can share a minimal example that doesn't include any privacy sensitive code?
another question: why i get 2 tabs while using the code snippet? i get one tab with blank page and the other tab where the test is running. thanks in advance
Launching Chromium with persistent context always opens a tab by default, this is the blank page that you see.
i commented out the lines related to the extension that i load because i cannot share it, BUT the issue is not related to the extension load.
Sorry, can you clarify if the issue reproduces without the extension ?
@yury-s , i have shared the code snippet above but i will add it here again ( without the extension part - it is not related to the loading chrome extension)
const { test: base, chromium } = require('@playwright/test')
const path = require('path')
const test = base.extend({
context: async ({ browserName }, use) => {
const browserTypes = { chromium }
const launchOptions = {
headless: false,
viewport: {
width: 1920,
height: 1080
}
}
const context = await browserTypes[browserName].launchPersistentContext(
'',
launchOptions
)
await use(context)
await context.close()
}
})
test(`RBU test `, async ({ page }) => {
await page.goto("https://www.teamtalk.com/", { waitUntil: "domcontentloaded" })
await page.waitForTimeout(5000);
})
I have changed in my playwright.config.ts file to use a specific project with the config as pavel mentioned ( video:'off' & trace:'retain-on-failure' ) see screenshot attached
i also executed the test with the the fo;;owing command: npx playwright test tests/TestrbuExtension.test.ts --project=chromium
i still get the issues:
let me know if additional info is needed.
regarding the blank page tab- how can i avoid loading the blank tab page? i get an empty tab and another tab where the test is running. i need to load my chrome extension but i would not like to get the blank page tab
let me know if additional info is needed.
I created a project with the same test file and config as you described and it works just fine. There must be something else in your project that causes the error. Can you share entire project so that we can repeat this locally?
regarding the blank page tab- how can i avoid loading the blank tab page?
This is a known limitation of the persistent context. You can use ephemeral context (launch instead of launchPersistentContext) where no pages are created by default.
i also created new project and still i get this issue. this is the project: playwrightTEST.zip
i used this command to run the test: npx playwright test tests/rbutest.test.ts --project=chromium
according to the documentation (on loading chrome extension) :
there is no other way to load extension without getting additional the blank page ? when i use ephemeral context (launch instead of launchPersistentContext) i cannot seem to load the extension.
i also created new project and still i get this issue. this is the project: playwrightTEST.zip
The test passes for me locally in 9s, perhaps you just need to increase the timeout?
$ npx playwright test tests/rbutest.test.ts --project=chromium
Running 1 test using 1 worker
1 passed (9s)
To open last HTML report run:
The difference may be that you have some extension loaded unconditionally due to Chrome policy. Can you go to chrome://extensions and see if there are any extensions in the browser launched by playwright? Can you also try running the test in headless mode and see if it still fails?
there is no other way to load extension without getting additional the blank page ? when i use ephemeral context (launch instead of launchPersistentContext) i cannot seem to load the extension.
Someone recently reported that they were able to load extension in ephemeral context, the steps are described in this post, you can give it a try. There is an open issue about integrating this into our docs: https://github.com/microsoft/playwright/issues/16798.
As I mentioned blank page is a side effect of using persistent context, we have no plans fixing that due to its low priority.
@yury-s I looked into it again and i increased the timeout but still same issue.
the issue is not related to the extension - i removed the extension code and the issue still occur. in addition, i looked into other extension , just in case , but they are not loaded on playwright.
the issue occur also on headless mode.
the issue does not occur when trace is set to off. i addition , i noticed that when video is On , there is no video file recorded.. :(
what else can be the issue or how can we further investigate it?
Could this be the same as #18126? If you could run under debugger and pause after the test while the trace file is being saved, perhaps we'll see what Playwright is doing?
@dgozman i'm not sure i did it correctly. i run it on debugger and it was stuck on the following line -
i will be glad to assist if needed
@moshikd You did the right thing, but this particular place does not help much. Out of curiosity, could you hover the apiName
? Otherwise, try stopping a few more times, in the hopes we'll find a place that could be the culprit.
@dgozman maybe you meant this?
@moshikd Thank you for your efforts. Unfortunately, I still don't have an idea what could this be, except for #18126. Could you please try with npm i --save-dev @playwright/test@next
version and see whether that helps? If not, we would need a repro we can run locally to be able to debug the issue.
@dgozman sorry for the delay (holiday season) i used the command (npm i --save-dev @playwright/test@next)
and i executed the test and still the same issue occur.
i already shared the project with the test. i will be glad to assist in any other way. can we debug the issue over zoom/ Teams session? i'm available any time and will appreciate your assistance on this.
i will be glad to assist in any other way. can we debug the issue over zoom/ Teams session?
Unfortunately we don't practice this.
i also created new project and still i get this issue. this is the project: playwrightTEST.zip
I tried this locally and it completes for me in 8 seconds too. It does look like something's going on with your particular setup. Could you try running your tests on MacOS Github Actions runners?
I'll close this for now since noone was able to reproduce in our team so we can't proceed.
Adding my 2 cents for anyone looking - I had forgotten to add an await in the test.beforeEach() before calling waitForSelectorToBeVisible, which led to this error
Test timeout of 0ms exceeded while tearing down "context".
Context:
Describe the bug
I encountered an issue while trying to test loading chrome extension with playwright BUT it seems not related to the chrome extension that i try to load.
i have the following code snippet that basically, navigate to site and wait for 5 sec. when the trace is set to 'on' or 'retain on failure' - timeout issue will occur ( although the test succeed very quickly) IF the trace is set to 'off' - no timeout issue
Code Snippet
NOTE: i commented out the lines related to the extension that i load because i cannot share it, BUT the issue is not related to the extension load.
playwright.config.ts - this is the config that i use
it seems like a bug to me. ( maybe it related to https://github.com/microsoft/playwright/issues/16143 ) if additional info is needed please let me know.