You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
bug: E2E beforeAll() error: The page was already closed #3720
I have searched for existing issues that already report this problem, without success.
Stencil Version
2.18.1
Current Behavior
The Jest function beforeAll() cannot be used to set up a page (and possibly even other suite-wide objects) . It seems to end after the first it() and won't work for the second it(), instead it throws the error "The page was already closed".
Example:
describe("suite", () => {
let page
beforeAll(async () => {
page = await newE2EPage()
})
it("1", () => {
const someEl = await page.find('my-component >>> div') // works so far
})
it("2", () => {
const someEl = await page.find('my-component >>> div') // error "The page was already closed"
})
})
It works fine when using beforeEach() instead of beforeAll(), however beforeEach() slows down tests a lot because newE2EPage() takes a lot of time and isn't required in many cases.
Thanks for the bug report! I can confirm that this behavior does occur in Stencil and agree it's not what I would expect with using beforeAll. This appears to have been done in 66ad23d in order to reduce memory usage. I don't have much more context as to why that behavior is/was configured ATM. I'm going to label this for the team to take a closer look.
Activity
rwaskiewicz commentedon Oct 17, 2022
Hey @kraftwer1 👋
Thanks for the bug report! I can confirm that this behavior does occur in Stencil and agree it's not what I would expect with using
beforeAll. This appears to have been done in 66ad23d in order to reduce memory usage. I don't have much more context as to why that behavior is/was configured ATM. I'm going to label this for the team to take a closer look.Thanks!
tanner-reits commentedon Jun 26, 2024
A fix for this was included in today's v4.19.0 release!
chore(deps): update dependency @stencil/core to v4.19.0 (#29666)