How to run your Playwright test in parallel or in serial mode

Поділитися
Вставка
  • Опубліковано 3 лис 2024

КОМЕНТАРІ • 32

  • @conorh999
    @conorh999 Рік тому +1

    This is great, I've been an hour trying to do this in the test case code and a config change is all I needed.

    • @stefanjudis
      @stefanjudis Рік тому +1

      Yay! Happy it's been useful! 🎉

  • @gambit3904
    @gambit3904 Рік тому

    Thanks for the video! How could I run many copies of a single test in parallel?

  • @fonziVazquez
    @fonziVazquez Рік тому +1

    Great tips! Thank you!

  • @Leader977
    @Leader977 9 місяців тому +1

    That was helpful. Thank you :)

    • @ChecklyHQ
      @ChecklyHQ  9 місяців тому

      Yay! Happy to hear that!

  • @ChiragMatkar
    @ChiragMatkar Рік тому +1

    we have defined config parallel as true and each spec is defined as serial. we observed that all other tests are skipped if one fails . any way to change this behaviour ?

  • @The4m3r
    @The4m3r Рік тому

    Great as always !!!

  • @satishpolisetty4217
    @satishpolisetty4217 7 місяців тому

    Your videos really helped me in better understanding of playwright.I have one challenge in my current setup.I want the spec file execution in a particular order.Let's say I have atest.spec.ts and mtest.spec.ts.In this case I want mtest.spec.ts cases to be executed first(in parallel to save time) and after that atest.spec.ts should be picked up.And on top of all, another test say admincreation.spec.ts should be executed before all if I have ever configure to true from env file.
    Can you help me adressing this issue?
    Thanks in advcance.

    • @ChecklyHQ
      @ChecklyHQ  7 місяців тому

      Would project dependencies to the trick for you? You can define the order of "test groups" with them. 👉 playwright.dev/docs/test-projects#dependencies

  • @Sowjanyanakkina
    @Sowjanyanakkina 5 місяців тому

    Hi Mate, have a question on the combo of serial mode + retry failed test method.
    Scenario Description :
    A home policy /quote creation involves multiple pages, each page depends on the successful completion of the previous page. Data is filled on each page and the process continues until the last page. After reaching the last page the policy gets created.
    The automation approach that I need:
    1. Treat each page as an individual test
    2. Test execution depends on the pass Status of the previous test.
    3. If any test fails subsequently should be skipped.
    4. Playwright should retry only the failed test for the retry count I provide, shouldn't attempt retrying any previously passed test(s).
    5. If the previously failed test passes during retrial executes subsequent tests.
    Please help, I have tried several combinations & approaches but no success yet! Thanks in advance.

    • @ChecklyHQ
      @ChecklyHQ  4 місяці тому

      Doing this with different tests seems a bit complicated and hard to realize with the test runner. I'd restructure things and use `test.step` for all your... well... steps (it sounds like it's different steps of one test). Then you have full control over what should be retried, failed and when. Hope this helps. 🦝

  • @yanjingtui
    @yanjingtui Рік тому

    Nice video, but i want to know how can i define 2 workers run parallel, which 1 worker for tests in folder "a", and 1 worker for folder "b". a and b folder is like folder sequence in your video.

  • @saurabhsrivastav902
    @saurabhsrivastav902 Рік тому

    Hi, I am using Jave with playwright and testng file to run with below command which runs test cases suite in sequence. Should I make changes in command too? >mvn test -Dbase.env=uat -Dbrowser.name=chrome -Dcountry.name=IN -Dtestng.name=testng_RegressionSuite.xml

    • @ChecklyHQ
      @ChecklyHQ  11 місяців тому

      Hey, unfortunately we're not familiar with this setup and can't help with this question. :/

  • @sushantparab5449
    @sushantparab5449 Місяць тому

    I have 6 tests in my folder. When I run npx playwright test --headed command I want playwright to open 1 Chrome, 1 Safari & 1 MSEdge browser parallelly and run all the 6 tests sequentially in those browsers. Is that possible @Checkly??

    • @ChecklyHQ
      @ChecklyHQ  Місяць тому

      Great question. 💯 Did you try setting `fullyParallel` to `false` on the project level where you define the browser config? gist.github.com/stefanjudis/d204ae0fe69bd96bb154ae8547fdddb7

  • @meg6pat
    @meg6pat Рік тому

    Great video, but I still got problem running tests. So I got 2 files:
    login.setup.ts which work in Chromium - login and creates storageState. And
    logout.spec.ts which is running on all browsers and it fails,
    as I see it, they didn't using storageState, but in config file they have “use {storageState: ./state.json}”.
    Any suggestions?

    • @ChecklyHQ
      @ChecklyHQ  Рік тому

      That's hard to tell without looking at the actual code. But if you want, you can always join the Checkly community and ask there. checklyhq.com/slack

  • @ankittesting
    @ankittesting 10 місяців тому

    Hi,
    The website's custom web workers are failing when fully parallel is enabled in the playwright project as we are making the API calls using the web workers.
    Any solution to this scenario?

    • @ChecklyHQ
      @ChecklyHQ  10 місяців тому

      Heyooo. :) It's very hard to give advice without looking at implementation details. Did you solve the problem already?

  • @SofiaGoyal
    @SofiaGoyal Рік тому

    I have a question, how can we run playwright tests for the a/b testing senario?

    • @ChecklyHQ
      @ChecklyHQ  Рік тому +1

      If you could give more info on the A/B test and what you want to test with PWT, we're happy to share some thoughts. :)

  • @shanthi3152
    @shanthi3152 Рік тому

    How many workers max we can assign to execute tests ?

    • @stefanjudis
      @stefanjudis Рік тому

      That's a great question: I don't think there's a limit from Playwright itself but usually you should set it depending on the number of CPUs that are available on the machine. When spinning up more workers than CPUs things aren't going in parallel anymore because one CPU has to handle multiple workers.

  • @salikhanan
    @salikhanan Рік тому +1

    Quick Question
    in you example you have Two folder Parallel and Sequence
    How to Run one test from Parallel and one Test from sequence so that You can use a random value generated in parallel test can use in Sequence test

    • @ChecklyHQ
      @ChecklyHQ  Рік тому

      For this I'd rather recommend using a fixture or a setup step. :) ua-cam.com/video/2O7dyz6XO2s/v-deo.html

  • @AfsarBaig-wn6ml
    @AfsarBaig-wn6ml 5 місяців тому

    There is barely any example where I want to run tests in serial which are not dependent on each other but when one test fails other subsequent tests to pass.

    • @ChecklyHQ
      @ChecklyHQ  5 місяців тому

      I wouldn't say barely. One example coming to mind immediately is an ecom app where tests rely on an existing account to buy with different payment methods. These have to run in sequence bc otherwise one test is messing with the others. :)