Playwright - How to run test with multiple Environments in playwright Framework/Automation tool

แชร์
ฝัง
  • เผยแพร่เมื่อ 20 ต.ค. 2024

ความคิดเห็น • 13

  • @brettkadrie7442
    @brettkadrie7442 หลายเดือนก่อน

    Outstanding explanation. I've been reviewing all the different approaches to multi-environment testing that people have come up with for Playwright, and I consider this one of the best ones out there. Thank you for creating this tutorial You get a sub!

    • @EasyQAAutomation
      @EasyQAAutomation  หลายเดือนก่อน +1

      Thank you so much for the wonderful feedback! This approach also very useful when you have to run test based on parameter and combinations through Jenkins. Like, if environment is qa/prod/staging and suit is sanity/regression and again any parameter based on project need.

  • @SantoshKumar-un5ts
    @SantoshKumar-un5ts 5 หลายเดือนก่อน

    Excellent video, really very helpful

  • @गजरभक्तिचा
    @गजरभक्तिचा 3 หลายเดือนก่อน

    Great video.

  • @TestingOnly-q9y
    @TestingOnly-q9y หลายเดือนก่อน

    so can we store the command < $env:ENV="qa"; npx playwright test > to package.json under scripts{} ? Not quite related to the tutorial but, if we run via Jenkins, will it look under what commands are in package.json scripts{} section ?

    • @EasyQAAutomation
      @EasyQAAutomation  หลายเดือนก่อน

      Hi ! Yes, you can store the command $env:ENV="qa"; npx playwright test under the scripts section of your package.json, but you need to ensure it's formatted correctly for your operating system. if Windows(powershell) then write like this "scripts": {
      "qatest": "powershell -Command \"$env:ENV='qa'; npx playwright test\"",
      "prodtest": "powershell -Command \"$env:ENV='prod'; npx playwright test\""
      } if bash(macOS) then write like this "scripts": {
      "test:qa": "ENV=qa npx playwright test"
      }.Then just use npm run qatest or prodtest where you wanted to run.While running through jenkins i will suggest you create parameterized jobs and write script to run the jobs then no need of writing commands in package.json like above. simply set environment based parameter like qa, dev, prod and write jenkins script, then run through jenkins job.

  • @johnsonmathew6498
    @johnsonmathew6498 4 หลายเดือนก่อน

    I'm not sure what I'm doing wrong. I set the value in the environment variable as shown in the video, but when I try to use it, it comes back as undefined. Do I need to install any packages?

    • @EasyQAAutomation
      @EasyQAAutomation  4 หลายเดือนก่อน

      No need to install any packages.it’s only simple typescript syntax.make sure that you have imported all files correctly and whatever name that you have given for environment variables object keys , same you are using in command line.

  • @anuranbhattacharya9938
    @anuranbhattacharya9938 2 หลายเดือนก่อน

    You put .env files in env folder. Don't misguide. This is not very professional way to do it.

    • @EasyQAAutomation
      @EasyQAAutomation  2 หลายเดือนก่อน

      I believe you have not watched the entire video with attention. Since I haven't used.env files, so no question putting inside the env folder. I'm surprised where you have seen .env file. Its .ts file. I have used object concept from typescript to run test in multiple environment. One of the way I shared with viewer's and its very robust and anyone can use in real time project also, specially if anyone wants to run test based on parameter also instead of specific environment. Also useful while running test in remote machine in docker container on aws triggered via Jenkins parameterization .So you please don't misguide to others by commenting like this

    • @anuranbhattacharya9938
      @anuranbhattacharya9938 2 หลายเดือนก่อน

      @@EasyQAAutomation Yeah, so that's the point. You don't put ts files in env folder, only .env files...and the way you showed (using ts files) is not at all professional and should never be used in actual projects. There is a difference between actual project and hobby project.