Create
cancel
Showing results for 
Search instead for 
Did you mean: 
Sign up Log in

I'm trying to run playwright tests on Bitbuket pipeline but pipeline is getting stuck while test ran

Ameer sohail April 3, 2024

We are trying to configure, playwright browser tests on Bitbucket Pipeline as code is in same repo of Bitbucket.
While running it on local with below commands its working fine and reports are also getting generated. In total 72 tests are running and report is generated.
Below are the commands:

- npm ci
- npx playwright install --with-deps
- npx playwright test
- npx playwright show-report

Whereas if I tried to run the same script using Bitbucket yaml file its getting stuck at - npx playwright test and after 2 to 3 tests it is getting stuck and then logs are also getting stuck, after 2 hours build is showing Exceeded build time limit of 120 minutes error.

bitbucket-pipelines.yml 

image: mcr.microsoft.com/playwright:v1.42.0-jammy

pipelines
:
branches:
main:
- step:
name: Playwright Tests
caches:
- node
script:
- npm ci
- npx playwright install --with-deps
- npx playwright test
- npx playwright show-report


devops/PB-2448-Web_Automation-2:
- step:
name: Playwright Tests
caches:
- node
script:
- npm ci
- npx playwright install --with-deps
- npx playwright test
- npx playwright show-report

Ill be attaching Screenshots of Bitbucket pipeline for reference.

Please help me on this, I got stuck here from a while.
Screenshot 2024-04-03 at 17.47.58.pngScreenshot 2024-04-03 at 17.48.13.png

2 answers

1 vote
Patrik S
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
April 4, 2024

Hello @Ameer sohail ,

thank you for reaching out to the Atlassian Community!

In order to isolate if the issue is with Bitbucket Pipelines environment, or with the image/code/dependencies you are using, I would suggest trying to run your build locally inside a docker container following the instructions of the below article:

The instructions in that article are used to reproduce locally an environment as close as possible to Pipelines, so you can troubleshoot your build locally, and if the same behavior is reproduced locally, you can debug the build check different combinations or images/dependencies, and once you find one that works, you can update your bitbucket pipelines YML  to match.

Thank you, @Ameer sohail !

Patrik S

Ameer sohail April 22, 2024

Hello @Patrik S 


Thanks for the reply tried with the process you shared above.
If I tried with similar docker commands its throwing errors with 7 test cases are failed.
docker build --memory=1g --memory-swap=1g -t account/imageName:tag -f my.dockerfile .
docker run -it --memory=4g --memory-swap=4g --memory-swappiness=0 --cpus=4 --entrypoint=/bin/bash account/imageName:tag


Whereas if used docker commands without --memory=1g --memory-swap=1g in docker build and --memory=4g --memory-swap=4g --memory-swappiness=0 --cpus=4 in docker run its running all test cases successfully.

docker build -t myaccount/qa-automation-image:latest -f my.dockerfile .
docker run -it --entrypoint=/bin/bash myaccount/qa-automation-image

Attaching screenshots for both scenarios test cases failed and test cases passed successfully.

By this please let me know what sort of changes I need to do.

Note: In pipeline its not passing more than 5 to 7 cases and getting stuckScreenshot 2024-04-22 at 11.32.53.pngScreenshot 2024-04-22 at 11.28.14.png

Patrik S
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
April 24, 2024

Hello @Ameer sohail ,

I noticed that after the test is completed, playwright waits for the user to press Ctrl+C to quit the log stream, but since the pipeline environment is non-interactive, I suspect this may be holding the pipeline to complete.

To avoid that, I would recommend setting the environment variable CI=true (see Playwright- CI ) before executing the playwright command, as this should make it ignore the prompts for user input: 

script:
- export CI="true"
npm ci
npx playwright install --with-deps
npx playwright test
npx playwright show-report

Thank you, @Ameer sohail !

Patrik S

 

Ameer sohail May 6, 2024

Hello @Patrik S 

Tried with suggestions you have shared above by adding CI=true, but still its getting stucked, attaching screenshot for your reference.
Screenshot 2024-05-07 at 11.23.00.png

Patrik S
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
May 7, 2024

Hello @Ameer sohail ,

Thanks for executing that test. To rule out a possible memory allocation issue, could you increase that step to size:2x, so it will get double the memory (8GB), and check if the builds also time out? 

- step:
size: 2x
script:
- <your build commands>

 

Ameer sohail May 8, 2024

Hello @Patrik S,

Tried with increasing size:2x, still same issue.
Screenshot 2024-05-08 at 15.39.16.pngScreenshot 2024-05-08 at 15.41.49.png

Patrik S
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
May 9, 2024

Hello @Ameer sohail ,

Thank you for going through those tests.

At this point, I've raised a support ticket for you to investigate this further, as you have access to a workspace with an active Bitbucket subscription. One of our support engineers will be in touch with you soon.

You will receive the ticket link in your email soon, but in case you don't, please let me know so I can share it here (the ticket will only be visible to you and Atlassian staff).

Thank you, @Ameer sohail !

Patrik S

0 votes
Souhaila JBARI
I'm New Here
I'm New Here
Those new to the Atlassian Community have posted less than three times. Give them a warm welcome!
December 9, 2024

Hello @Patrik S 

I have the same issue.

I have also tried all the solutions you proposed, but I still have the same issue.

Could you please tell me if the problem has already been resolved?

thank you 

Patrik S
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
December 9, 2024

Hello @Souhaila JBARI ,

The original issue was identified to now be related to Pipelines, but actually with the script being executed by the user.

Could you confirm if you have tried to reproduce the issue locally in order to isolate any issues with your script/code from an actual issue with Pipelines ? 

If you haven't already, I recommend following the instructions for Troubleshooting failed pipelines locally to replicate an environment similar to Pipelines locally and check if the error also happens.

If the issue is confirmed to also happen locally, it means it's not an issue with Pipelines environment, and you will have to debug why this script is getting stuck locally in order to resolve this issue.

Thank you, @Souhaila JBARI !
Patrik S

Suggest an answer

Log in or Sign up to answer
DEPLOYMENT TYPE
CLOUD
PERMISSIONS LEVEL
Product Admin
TAGS
AUG Leaders

Atlassian Community Events