DevExpress / testcafe

A Node.js tool to automate end-to-end web testing.
https://testcafe.io
MIT License
9.82k stars 672 forks source link

TestCafé hangs when PayPal button is pressed #5962

Closed thomas-qa closed 3 years ago

thomas-qa commented 3 years ago

What is your Test Scenario?

On our web app, we want to select the PayPal payment method and click the PayPal button. Performing the test manually, what happens is that when the PayPal button is pressed a new tab opens where to enter the PayPal data and proceed to payment.

What is the Current behavior?

What is the Expected behavior?

What is your web application and your TestCafe test code?

You can find our public repo here: https://github.com/musement/qa-test-cafe/tree/issue_paypal_payment The issue is available in the issue_paypal_paymentbranch!

The test that generates this error is https://github.com/musement/qa-test-cafe/blob/issue_paypal_payment/tests/paypal_issue/fixtures/pay_with_paypal.js

Your Environment details:

To run the test outside the Docker container

Clone the repo and with a bash shell execute the following:

npm install
TEST_CAFE_BROWSERS_LIST=chrome,firefox
export TEST_CAFE_BROWSERS_LIST
TEST_CAFE_SPEED=1
export TEST_CAFE_SPEED
TEST_CAFE_REPORTER=list
export TEST_CAFE_REPORTER
TEST_CAFE_SKIPJSERRORS=true
export TEST_CAFE_SKIPJSERRORS
node index.js --domain=paypal_issue --is-browser-stack=false --headless=false
felis2803 commented 3 years ago

We reproduced the issue. Unfortunately, at the moment we cannot offer a complete solution. However, you can run the project by changing the --headless value from false to true. We will let you know if we find a better solution.

thomas-qa commented 3 years ago

@felis2803 I need to complete the payment, do you have any suggestions on how to write the rest of the test? Also i wanted to know if you have any idea how long it may take to fix this bug. Thanks!

felis2803 commented 3 years ago

The problem is caused because Chrome cannot open new windows since it's restricted by default. TestCafe runs local browsers with a custom profile. It allows you to avoid the restriction with opening new windows. The 'Pay Pal' website requires the multi-window mode that is not allowed for the 'remote' browser. The recommended solution is to run your tests in local browsers.

I run your tests with the testcafe chrome tests\paypal_issue\fixtures\pay_with_paypal.js command, and everything works correctly.

Also, since we cannot fix this behavior due to the features of the 'remote' browser, I will close this issue.