azure-dev icon indicating copy to clipboard operation
azure-dev copied to clipboard

playwright test fail in todo-nodejs-mongo

Open v-yilinhu opened this issue 2 years ago • 13 comments

Describe the issue: playwright test fail when delete a item.

Repro steps:

  1. Run command azd up
  2. Run command cd tests
  3. Run command npm i && npx playwright install
  4. Run command npx playwright test

image

Environment: OS : Linux(Ubuntu 20.04) Template: https://github.com/Azure-Samples/todo-nodejs-mongo

Expected behavior: playwright test can success.

@jongio for notification.

v-yilinhu avatar Jun 17 '22 10:06 v-yilinhu

Can you please re-run this a few times and verify it fails every time?

jongio avatar Jun 17 '22 21:06 jongio

@jongio I have run about 5 times, results are all failed.

v-yilinhu avatar Jun 20 '22 10:06 v-yilinhu

Is this in WSL or a VM? Would be good to know more about your hardware setup. Thanks

jongio avatar Jun 20 '22 17:06 jongio

@jongio this might be related to the fact that it takes some minutes after deploying to actually get the server up and running (serving). According to the steps in the issue, tests are running right after running azd up. Can we verify if tests would fail if we run them at least ~10 minutes after running azd up ? ( 10 minutes should be more than enough).

If that's the issue/case, we might consider adding some logic to the azp deploy command to wait for backend to be responsive. For example, starting a polling routine to send a ping request to the server every minute and does not exits until server respond with a pong :) . They running azd deploy would finish when the app is actually ready to be used

vhvb1989 avatar Jun 20 '22 17:06 vhvb1989

@v-yilinhu - Please validate @vhvb1989's thoughts, by running azd up, letting it finish, and the manually hitting the site in the same environment.

jongio avatar Jun 20 '22 22:06 jongio

@jongio According to the comments, we run the test at least ~10 minutes after running azd up, but it still failed, the browser we use for testing is Firefox(version-101.0.1) in Linux VM. However, when we installed Chrome(version-102.0.5005.115) in Linux VM to try again, it passed. Besides, it can pass in Windows desktop by using FireFox. image

v-yilinhu avatar Jun 21 '22 06:06 v-yilinhu

we are only running the tests on chrome today, so maybe it was failing because of that not being installed.

jongio avatar Jun 21 '22 19:06 jongio

@jongio Is it enough that our tests only run successfully on Chrome? If so, maybe we can close this issue. Besides, we can add some reminders to the README.md: Currently only Google Chrome is supported.

v-xuto avatar Jun 22 '22 09:06 v-xuto

Can you please investigate why this isn't working in Firefox?

jongio avatar Jun 24 '22 03:06 jongio

@Jongio We have made some progress in investigating this issue. Firefox between the linux and windows desktop,the web page of the project deployment, the interface effect of the delete position is different, see the following figure for details.

1.Firefox in Linux: image 2.Firefox in windows desktop: image

Maybe we can consider that our code can add an else judgment to take this situation(...) about firefox in Linux into account.

v-xuto avatar Jun 24 '22 10:06 v-xuto

Can you please see about updating the playwright test to account for this?

jongio avatar Jun 24 '22 16:06 jongio

@Jongio The PR https://github.com/Azure/azure-dev/pull/1362 to fix this issue is ready, please review.

v-xuto avatar Jun 28 '22 08:06 v-xuto

The following templates has the same issue on DevContainer , Linux(Ubuntu 20.04) and Codespace:

  • https://github.com/azure-samples/todo-csharp-cosmos-sql
  • https://github.com/azure-samples/todo-nodejs-mongo
  • https://github.com/azure-samples/todo-nodejs-mongo-aca
  • https://github.com/azure-samples/todo-python-mongo
  • https://github.com/azure-samples/todo-python-mongo-aca

v-jiaodi avatar Jul 12 '22 03:07 v-jiaodi

@v-yilinhu Could you re-run the test to see if we still have this problem? I'm not able to reproduce this error. All tests passed on Linux(Ubuntu 20.04).

hemarina avatar Sep 07 '22 18:09 hemarina

@hemarina We re-run the test, this issue can't be reproduced on Linux(Ubuntu 20.04),Codespace and DevContainer.

v-jiaodi avatar Sep 08 '22 08:09 v-jiaodi