Does anyone have experience using Jenkins with playwright automation tools

Hello,

I am an automation tester and learning to use Jenkins is CI/CD. I having an issue with getting my playwright automation test to run on the Jenkins. I have created an ubuntu/linux server to specifically run these tests on. When I manually execute them on the server, they work fine with no issue. I applied the same steps in the Jenkinsfile to my branch that I am using the run these tests. I also have the build pointing to the ubuntu server that I have setup for these tests. I have tried a number of variations to get the playwright to install on jenkins before executing the tests. I also have the Dockerfile making sure it checks out my branch before starting the execute the steps for the tests. However I keep coming across this error when it’s time to run the tests. Does anyone have experience with this and can direct me to a proper solution for this issue. I have implemented the changes the Jenkins runner presents. I have done a massive amount of “googling” and I get the same answer that I have already implemented into my Jenkinsfile with no resolve. Thank you in advance for your help.

Here is the constant error I receive:

+ cd /var/lib/jenkins/workspace/TMC_sys10-CICD_QA-main/test/crete/tests
+ /usr/local/bin/npm run QAtest

> sys-10@1.0.0 QAtest
> npx playwright test --config=tests/qatest.config.js

Please install @playwright/test package to use Playwright Test.
  npm install -D @playwright/test
npm ERR! code 1
npm ERR! path /var/lib/jenkins/workspace/TMC_sys10-CICD_QA-main/test/crete
npm ERR! command failed
npm ERR! command sh -c playwright test --config=tests/qatest.config.js

npm ERR! A complete log of this run can be found in:
npm ERR!     /var/lib/jenkins/.npm/_logs/2022-04-21T15_20_25_851Z-debug.log
npm ERR! code 1
npm ERR! path /var/lib/jenkins/workspace/TMC_sys10-CICD_QA-main/test/crete
npm ERR! command failed
npm ERR! command sh -c npx playwright test --config=tests/qatest.config.js

npm ERR! A complete log of this run can be found in:
npm ERR!     /var/lib/jenkins/.npm/_logs/2022-04-21T15_20_25_872Z-debug.log
[Pipeline] }
Failed in branch b

I have no idea what the playwright is and how it works, but it looks like it is simply not installed - or at least not visible to the user running your build agent. Can you show your pipeline? How is your agent installed - as a separate user, maybe?

It would be useful if you could post the /var/lib/jenkins/.npm/_logs/2022-04-21T15_20_25_872Z-debug.log somewhere.

1 Like

Thank you for the comments. I think at this point it is definitely more of an infrastructure issue that I need to find a resolution for. If I find it I will post it for the next person who might come across this same problem.

The error is saying the dependency is missing

I suggest making sure your package.json has a pinned playwright version as npx will run the latest version of its not already installed.

1 Like