Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Tooling] add playwright tests into azure pipeline #9652

Merged
merged 86 commits into from
May 30, 2024

Conversation

brindasasi
Copy link
Contributor

@brindasasi brindasasi commented Mar 6, 2024

πŸ€– Resolves #7999

πŸ‘‹ Introduction

This PR integrates playwright tests into Azure pipeline so that the tests can be triggered against the dev verticals.
Currently it runs against dev environment.

πŸ•΅οΈ Details

Below is the Dev Pipeline that got set up to run playwright tests
image

Basically the pipeline got split into 2 stages as Build and Test stage.
Build stage
Builds the latest main and creates the artifact
Test Stage
This stage downloads the artifact that created on the prev stage and feeds off to a self hosted VM.
Self Hosted VM
This VM is set up to run playwright tests with all the required dependencies and white listed from the VPN sites like the dev environment.
The tests results are stored in VM but now got uploaded in Azure Storage container for easy access

Storage Container Path
https://portal.azure.com/#@056gc.onmicrosoft.com/resource/subscriptions/e45226c5-f9e9-4979-9016-96ba27b156cb/resourceGroups/rg_tbs_talent_2_PaaS/providers/Microsoft.Storage/storageAccounts/sttalclddevcacstdl/containersList

This PR just set up infrastructure for E2E tests running against dev verticals.

Tests needs to be modified to run against GCKey logins in a diff issue.

πŸ§ͺ Testing

**Need Azure access to test this

  1. Log into dev.azure.com/tbs-sct with your PC account
  2. Run the dev pipeline
  3. Verify the results in the command line
  4. Verify the screenshots in the storage container with steps below

πŸ“Έ Screenshot

image

image (2)

image (3)

@brindasasi brindasasi linked an issue Apr 11, 2024 that may be closed by this pull request
1 task
Copy link
Contributor

@petertgiles petertgiles left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Very neat. I just read through and the code and launched the pipeline again. I had a few more questions.

@@ -2,3 +2,4 @@
# See: https://playwright.dev/docs/test-timeouts
#TEST_TIMEOUT=30000
#EXPECT_TIMEOUT=5000
#BASE_URL=http://localhost:8000
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't think the app services have this environment variable. There is already an APP_URL variable though.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm giving it in here

BASE_URL: "https://dev-talentcloud.tbs-sct.gc.ca"

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't think App services would need this.
Also this pipeline can be used to run against any env like UAT and is different from APP_URL

- script: CYPRESS_INSTALL_BINARY=/opt/cypress/13.10.0/cypress.zip pnpm install cypress
displayName: "Install Cypress"

- script: pnpm install --no-frozen-lockfile
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why does it install dependencies and rebuild the app a second time in this stage? Isn't that the purpose of the first stage?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reason is that we had to install the deps on the agent that is running the tests. There was some security issue with the Talentcloud project that forced the deps downloaded from the agent instead of from the feed.
Same steps with another test pipeline works without having to install the deps but not with our TalentCloud project

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I will try get the convo from Daniel related to that.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can we drop the first stage entirely then? Is there any point to it if we're just going to rebuild it again?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

image (2)

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

image (3)

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can we drop the first stage entirely then? Is there any point to it if we're just going to rebuild it again?

would check with Daniel on that.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yeah Daniel also feels that its redundant at this point to have that stage. Will try disconnect it first if it passes then it should be completely good to go. Thanks for catching that!

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

removed build stage in 53d7f44 !

@petertgiles petertgiles requested a review from esizer May 29, 2024 15:04
Copy link
Member

@esizer esizer left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can confirm playwright stuff looks great πŸ‘ I'd just wait on @petertgiles approval though, I just looked at the local playwright config πŸ˜…

Copy link
Contributor

@petertgiles petertgiles left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm not sure how this is going to work out. πŸ˜… If you want to merge this pipeline as a work-in-progress it's not going to affect anything else, though.

resourceGroupName: "rg_tbs_talent_2_PaaS"
vertical: "dev"
storageAccountName: "sttalclddevcacstdl"
storageContainer: "playwright-results"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Does this container automatically clean up old results?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

we have set a lifecycle rule on the container level to delete older results. Currently it is more than 30 days old.

vmImage: ubuntu-22.04
- job: run_playwright_tests
displayName: Run Playwright tests
timeoutInMinutes: 30
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It seems like this is not long enough. It's timing out for me, though it completes in around 25 minutes in GH.

@brindasasi
Copy link
Contributor Author

I'm not sure how this is going to work out. πŸ˜… If you want to merge this pipeline as a work-in-progress it's not going to affect anything else, though.

I know its a new horizon but I'm confident on it. 😺

@brindasasi brindasasi added this pull request to the merge queue May 30, 2024
Merged via the queue into main with commit b4ffe14 May 30, 2024
9 of 10 checks passed
@brindasasi brindasasi deleted the 7999-integrate-playwright-azure branch May 30, 2024 20:28
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

πŸ› οΈ Run an automated test in Azure
4 participants