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

  Рет қаралды 415

EasyQA Automation

EasyQA Automation

Күн бұрын

‪@EasyQAAutomation‬ In the dynamic landscape of software development, managing multiple environments is crucial for seamless testing and deployment. From development to regression phases, each environment serves a distinct purpose. But adapting automation scripts to different environments can be cumbersome. What if there was a smarter solution?
Enter environment variable management. By defining environments once and loading variables at runtime, we unlock flexibility. No more manual URL changes! Whether it's development, staging, or regression, our scripts effortlessly adapt. Say goodbye to repetitive adjustments and hello to streamlined testing. With this approach, we ensure consistency across environments, making testing a breeze even in the most complex phases of development.

Пікірлер: 13
@brettkadrie7442
@brettkadrie7442 10 күн бұрын
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 5 күн бұрын
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 3 ай бұрын
Excellent video, really very helpful
@EasyQAAutomation
@EasyQAAutomation 3 ай бұрын
Thanks. Share with others
@user-ix5po8ge1i
@user-ix5po8ge1i 2 ай бұрын
Great video.
@EasyQAAutomation
@EasyQAAutomation 15 күн бұрын
Thanks!
@user-dy3pt9ej3m
@user-dy3pt9ej3m 15 күн бұрын
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 15 күн бұрын
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 3 ай бұрын
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 3 ай бұрын
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 21 күн бұрын
You put .env files in env folder. Don't misguide. This is not very professional way to do it.
@EasyQAAutomation
@EasyQAAutomation 16 күн бұрын
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 16 күн бұрын
@@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.
Debugging Playwright Tests: Techniques for Using UI and Trace Viewer
12:49
How to test and monitor your APIs with Playwright
9:51
Checkly
Рет қаралды 4,7 М.
Or is Harriet Quinn good? #cosplay#joker #Harriet Quinn
00:20
佐助与鸣人
Рет қаралды 47 МЛН
Apple peeling hack
00:37
_vector_
Рет қаралды 37 МЛН
The Joker kisses Harley Quinn underwater!#Harley Quinn #joker
00:49
Harley Quinn with the Joker
Рет қаралды 41 МЛН
Magic or …? 😱 reveal video on profile 🫢
00:14
Andrey Grechka
Рет қаралды 57 МЛН
SLOs with Prometheus done wrong, wrong, wrong, wrong, then right
1:03:34
Last9 — High Cardinality Monitoring
Рет қаралды 432
How to design a modern CI/CD Pipeline
9:59
DevOps Journey
Рет қаралды 124 М.
Playwright #46 Env Configurations in Playwright
11:23
Testers Talk
Рет қаралды 691
Or is Harriet Quinn good? #cosplay#joker #Harriet Quinn
00:20
佐助与鸣人
Рет қаралды 47 МЛН