question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

[Question] - Hooks and teardown

See original GitHub issue

Hi guys, quick question, is it always recommended to use test.afterAll or afterEach when using the page fixtures in a spec file ? I have a couple of specs and noticed some issues when running them on azure with the error:

“Test timeout of 30000ms exceeded while tearing down “context”.”

It is intermittent , but seems to have stopped when adding page.close() in the afterEach hook. However, I could see there is no afterEach hook in the example class created automatically when installing playwright (So I was not sure if it is 100% needed or not)

I have one spec with different test cases using the page fixture and another one that loops through a list of values to execute the tests, and it happened in both of them. I.e:

Example1:

text.describe({
   test('test1' , async ({page})=> {
      //do something
   })
   
   test('test2' , async ({page})=> {
      //do something else
   })
})

Example2:

test.describe({
        for(const value of values){
          test(`test ${value}`, async ({ page }) => {
          await page.goto(`/value`);
        });
    }
})

Issue Analytics

  • State:closed
  • Created a year ago
  • Comments:10 (3 by maintainers)

github_iconTop GitHub Comments

1reaction
aslushnikovcommented, Sep 29, 2022

That would be awesome. We didn’t find anything that might affect this kind of behavior change from 1.25 to 1.26, so a repro would drastically help us debug this issue.

Let me close this for now, but please file another issue as you have a repro. (this way we won’t accidentally forget about it).

Thanks!

0reactions
imartinflorescommented, Sep 30, 2022

Seeing the issue on 1.25 intermittently as well, so I definitely assume it has something to do with the app itself. However the Traces and what can be seen on the video confused me a little bit. In the last Trace I got, I can see a page.close() timing out

Read more comments on GitHub >

github_iconTop Results From Across the Web

Pytest setup/teardown hooks for session - Stack Overflow
I want to create my custom test environment in setup (before start of test session) and cleanup after all tests will be finished....
Read more >
What are Cucumber Hooks And How to Use ... - Tools QA
Cucumber supports hooks, which are blocks of code that run before or after each scenario. You can define them anywhere in your project...
Read more >
How to Write a Hook | Writing Studio
A question hook is when you ask the reader something that they can visualize and try to think of in their own minds....
Read more >
Understanding Vue.js Lifecycle Hooks - DigitalOcean
Understanding Destruction Hooks (Teardown) ... Destruction hooks allow you to perform actions when your component is destroyed, such as cleanup or ...
Read more >
Hooking into the Test Process - Behat
Scenario Hooks¶ · @BeforeScenario hook executes not only before each scenario in each feature, but before each example row in the scenario outline....
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found