From 9ea604055fb17fb937b25518aa2165453631e616 Mon Sep 17 00:00:00 2001 From: Brinda Sasikumar Date: Wed, 6 Mar 2024 10:50:29 -0500 Subject: [PATCH 01/81] add playwright tests into azure pipeline --- infrastructure/azure-pipelines-dev.yml | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) diff --git a/infrastructure/azure-pipelines-dev.yml b/infrastructure/azure-pipelines-dev.yml index 312007e0d14..3b920258e0c 100644 --- a/infrastructure/azure-pipelines-dev.yml +++ b/infrastructure/azure-pipelines-dev.yml @@ -42,3 +42,26 @@ jobs: displayName: "Publish Artifact: gcDigitalTalent" inputs: ArtifactName: gcDigitalTalent + - job: run_playwright_tests + displayName: Run Playwright tests + pool: + vmImage: ubuntu-20.04 + steps: + - checkout: self + clean: true + fetchDepth: 1 + + - script: npm install + displayName: "Install Node.js dependencies" + + - script: npx playwright install + displayName: "Install Playwright browsers" + + - script: npm run e2e:playwright:chromium + displayName: "Run Chromium tests" + + - script: npm run e2e:playwright:firefox + displayName: "Run Firefox tests" + + - script: npm run e2e:playwright:webkit + displayName: "Run WebKit tests" From 43a232832b9c08a6a3346048a8c78d36b3a3d8b9 Mon Sep 17 00:00:00 2001 From: Brinda Sasikumar Date: Wed, 6 Mar 2024 11:56:44 -0500 Subject: [PATCH 02/81] run in all browsers --- infrastructure/azure-pipelines-dev.yml | 11 +++-------- 1 file changed, 3 insertions(+), 8 deletions(-) diff --git a/infrastructure/azure-pipelines-dev.yml b/infrastructure/azure-pipelines-dev.yml index 3b920258e0c..188e1dcc46d 100644 --- a/infrastructure/azure-pipelines-dev.yml +++ b/infrastructure/azure-pipelines-dev.yml @@ -27,6 +27,7 @@ jobs: displayName: Dependencies env: API_URI: /graphql + ADMIN_APP_DIR: /admin # We don't need Cypress in this environment, and so this avoid permission errors of installing it. # See: https://docs.cypress.io/guides/getting-started/installing-cypress#Skipping-installation CYPRESS_INSTALL_BINARY: 0 @@ -57,11 +58,5 @@ jobs: - script: npx playwright install displayName: "Install Playwright browsers" - - script: npm run e2e:playwright:chromium - displayName: "Run Chromium tests" - - - script: npm run e2e:playwright:firefox - displayName: "Run Firefox tests" - - - script: npm run e2e:playwright:webkit - displayName: "Run WebKit tests" + - script: npx playwright test + displayName: "Run playwright tests" From 2f035ef7302331d8fb33f12d8ef5b83b60233ec2 Mon Sep 17 00:00:00 2001 From: Brinda Sasikumar Date: Wed, 6 Mar 2024 12:26:29 -0500 Subject: [PATCH 03/81] install with required deps --- infrastructure/azure-pipelines-dev.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/infrastructure/azure-pipelines-dev.yml b/infrastructure/azure-pipelines-dev.yml index 188e1dcc46d..271bf3c3c3b 100644 --- a/infrastructure/azure-pipelines-dev.yml +++ b/infrastructure/azure-pipelines-dev.yml @@ -55,7 +55,7 @@ jobs: - script: npm install displayName: "Install Node.js dependencies" - - script: npx playwright install + - script: npx playwright install --with-deps displayName: "Install Playwright browsers" - script: npx playwright test From ed1ef99a158d60b8be12d6de70c799de6a389c08 Mon Sep 17 00:00:00 2001 From: Brinda Sasikumar Date: Wed, 6 Mar 2024 12:32:16 -0500 Subject: [PATCH 04/81] add stages for build & test --- infrastructure/azure-pipelines-dev.yml | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/infrastructure/azure-pipelines-dev.yml b/infrastructure/azure-pipelines-dev.yml index 271bf3c3c3b..d4a98f98f0c 100644 --- a/infrastructure/azure-pipelines-dev.yml +++ b/infrastructure/azure-pipelines-dev.yml @@ -9,7 +9,10 @@ resources: variables: phpVersion: "8.2" -jobs: +stages: +- stage: Build + displayName: Build stage + jobs: - job: build_artifact displayName: Build artifact pool: @@ -22,14 +25,11 @@ jobs: - script: infrastructure/bin/set_php_versions.sh ${{ variables.phpVersion }} displayName: "PHP version" - # -d option to install dev dependencies and -r option to specify the root directory - script: infrastructure/bin/deploy.sh -d -r $(System.DefaultWorkingDirectory) displayName: Dependencies env: API_URI: /graphql ADMIN_APP_DIR: /admin - # We don't need Cypress in this environment, and so this avoid permission errors of installing it. - # See: https://docs.cypress.io/guides/getting-started/installing-cypress#Skipping-installation CYPRESS_INSTALL_BINARY: 0 - task: ArchiveFiles@2 @@ -43,6 +43,11 @@ jobs: displayName: "Publish Artifact: gcDigitalTalent" inputs: ArtifactName: gcDigitalTalent + +- stage: Test + displayName: Test stage + dependsOn: Build + jobs: - job: run_playwright_tests displayName: Run Playwright tests pool: From ddc9a57a6fd269531520eaccff5fb70a7f9ff8b8 Mon Sep 17 00:00:00 2001 From: Brinda Sasikumar Date: Wed, 6 Mar 2024 12:43:01 -0500 Subject: [PATCH 05/81] use the artifact built in the prev stage for testing --- infrastructure/azure-pipelines-dev.yml | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/infrastructure/azure-pipelines-dev.yml b/infrastructure/azure-pipelines-dev.yml index d4a98f98f0c..899f6ab9da4 100644 --- a/infrastructure/azure-pipelines-dev.yml +++ b/infrastructure/azure-pipelines-dev.yml @@ -57,6 +57,11 @@ stages: clean: true fetchDepth: 1 + - task: DownloadBuildArtifacts@0 + inputs: + artifactName: gcDigitalTalent + downloadPath: $(System.DefaultWorkingDirectory)/artifacts + - script: npm install displayName: "Install Node.js dependencies" From 8640f14aa8c687896c57415d9dfa67f317bb7803 Mon Sep 17 00:00:00 2001 From: Brinda Sasikumar Date: Wed, 6 Mar 2024 13:09:00 -0500 Subject: [PATCH 06/81] remove deleting front end dependency --- infrastructure/bin/deploy.sh | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/infrastructure/bin/deploy.sh b/infrastructure/bin/deploy.sh index edff1263073..28c45d3abec 100755 --- a/infrastructure/bin/deploy.sh +++ b/infrastructure/bin/deploy.sh @@ -74,5 +74,7 @@ npm ci --include=dev npm run build chmod -R a+r,a+w node_modules +if [ "$GCDT_DEV" = false ]; then ### Cleanup frontend npm dependencies -npm prune --production + npm prune --production +fi From e316994f747ace4d09ae57f455b7c5d31be46b0a Mon Sep 17 00:00:00 2001 From: Brinda Sasikumar Date: Wed, 6 Mar 2024 13:27:33 -0500 Subject: [PATCH 07/81] test without prune --- infrastructure/bin/deploy.sh | 5 ----- 1 file changed, 5 deletions(-) diff --git a/infrastructure/bin/deploy.sh b/infrastructure/bin/deploy.sh index 28c45d3abec..fcfb37ae507 100755 --- a/infrastructure/bin/deploy.sh +++ b/infrastructure/bin/deploy.sh @@ -73,8 +73,3 @@ npm ci --include=dev ### Build frontend npm run build chmod -R a+r,a+w node_modules - -if [ "$GCDT_DEV" = false ]; then -### Cleanup frontend npm dependencies - npm prune --production -fi From ce9c186350bd0f186b7d7bd362de3d0170398a9d Mon Sep 17 00:00:00 2001 From: Brinda Sasikumar Date: Wed, 6 Mar 2024 14:26:52 -0500 Subject: [PATCH 08/81] test npm install intead of npm ci --- infrastructure/bin/deploy.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/infrastructure/bin/deploy.sh b/infrastructure/bin/deploy.sh index fcfb37ae507..8162172a82a 100755 --- a/infrastructure/bin/deploy.sh +++ b/infrastructure/bin/deploy.sh @@ -68,7 +68,7 @@ php artisan lighthouse:print-schema --write ### Install all npm dependencies cd $ROOT_DIR -npm ci --include=dev +npm install --include=dev ### Build frontend npm run build From af110a7a70e279490ca1ff3d36ec1d620c80723e Mon Sep 17 00:00:00 2001 From: Brinda Sasikumar Date: Wed, 6 Mar 2024 16:28:09 -0500 Subject: [PATCH 09/81] Revert "test npm install intead of npm ci" This reverts commit ce9c186350bd0f186b7d7bd362de3d0170398a9d. --- infrastructure/bin/deploy.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/infrastructure/bin/deploy.sh b/infrastructure/bin/deploy.sh index 8162172a82a..fcfb37ae507 100755 --- a/infrastructure/bin/deploy.sh +++ b/infrastructure/bin/deploy.sh @@ -68,7 +68,7 @@ php artisan lighthouse:print-schema --write ### Install all npm dependencies cd $ROOT_DIR -npm install --include=dev +npm ci --include=dev ### Build frontend npm run build From e5c979f6bb70fc3829130e8578fb9e41c22cf13e Mon Sep 17 00:00:00 2001 From: Brinda Sasikumar Date: Wed, 6 Mar 2024 16:54:01 -0500 Subject: [PATCH 10/81] Update azure-pipelines-dev.yml for Azure Pipelines --- infrastructure/azure-pipelines-dev.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/infrastructure/azure-pipelines-dev.yml b/infrastructure/azure-pipelines-dev.yml index 899f6ab9da4..9d38ab5b10a 100644 --- a/infrastructure/azure-pipelines-dev.yml +++ b/infrastructure/azure-pipelines-dev.yml @@ -68,5 +68,5 @@ stages: - script: npx playwright install --with-deps displayName: "Install Playwright browsers" - - script: npx playwright test + - script: npm run e2e:playwright displayName: "Run playwright tests" From 01e883304ee068cff51810128b105e471dbe3302 Mon Sep 17 00:00:00 2001 From: Brinda Sasikumar Date: Thu, 7 Mar 2024 10:24:28 -0500 Subject: [PATCH 11/81] install npm with deps --- infrastructure/azure-pipelines-dev.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/infrastructure/azure-pipelines-dev.yml b/infrastructure/azure-pipelines-dev.yml index 9d38ab5b10a..59049beaeaf 100644 --- a/infrastructure/azure-pipelines-dev.yml +++ b/infrastructure/azure-pipelines-dev.yml @@ -62,7 +62,7 @@ stages: artifactName: gcDigitalTalent downloadPath: $(System.DefaultWorkingDirectory)/artifacts - - script: npm install + - script: npx npm install --include=dev displayName: "Install Node.js dependencies" - script: npx playwright install --with-deps From 3668b704e7d1bbd79c32d6e27544319390399408 Mon Sep 17 00:00:00 2001 From: Brinda Sasikumar Date: Thu, 7 Mar 2024 14:03:43 -0500 Subject: [PATCH 12/81] add cypress test --- infrastructure/azure-pipelines-dev.yml | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/infrastructure/azure-pipelines-dev.yml b/infrastructure/azure-pipelines-dev.yml index 59049beaeaf..f58a07ee3b1 100644 --- a/infrastructure/azure-pipelines-dev.yml +++ b/infrastructure/azure-pipelines-dev.yml @@ -70,3 +70,13 @@ stages: - script: npm run e2e:playwright displayName: "Run playwright tests" + - job: run_cypress_tests + displayName: Run cypress tests + pool: + vmImage: ubuntu-20.04 + steps: + - script: npm install + displayName: "Install dependencies" + + - script: npm run e2e + displayName: "Run Cypress Tests" From 67b4ec3d813f6ea8f12e87160914281ea1675bd5 Mon Sep 17 00:00:00 2001 From: Brinda Sasikumar Date: Thu, 7 Mar 2024 14:55:28 -0500 Subject: [PATCH 13/81] remove cypress --- infrastructure/azure-pipelines-dev.yml | 12 +----------- 1 file changed, 1 insertion(+), 11 deletions(-) diff --git a/infrastructure/azure-pipelines-dev.yml b/infrastructure/azure-pipelines-dev.yml index f58a07ee3b1..6061ae8f6e2 100644 --- a/infrastructure/azure-pipelines-dev.yml +++ b/infrastructure/azure-pipelines-dev.yml @@ -68,15 +68,5 @@ stages: - script: npx playwright install --with-deps displayName: "Install Playwright browsers" - - script: npm run e2e:playwright + - script: npm run e2e:playwright:chromium displayName: "Run playwright tests" - - job: run_cypress_tests - displayName: Run cypress tests - pool: - vmImage: ubuntu-20.04 - steps: - - script: npm install - displayName: "Install dependencies" - - - script: npm run e2e - displayName: "Run Cypress Tests" From 25abedec496c4ef952a849269ea6c7ad0a858c6d Mon Sep 17 00:00:00 2001 From: Brinda Sasikumar Date: Thu, 7 Mar 2024 15:45:16 -0500 Subject: [PATCH 14/81] try adding build step --- infrastructure/azure-pipelines-dev.yml | 3 +++ 1 file changed, 3 insertions(+) diff --git a/infrastructure/azure-pipelines-dev.yml b/infrastructure/azure-pipelines-dev.yml index 6061ae8f6e2..b9c795f744e 100644 --- a/infrastructure/azure-pipelines-dev.yml +++ b/infrastructure/azure-pipelines-dev.yml @@ -65,6 +65,9 @@ stages: - script: npx npm install --include=dev displayName: "Install Node.js dependencies" + - script: npm run build:packages + displayName: "Build dependencies" + - script: npx playwright install --with-deps displayName: "Install Playwright browsers" From b6e56af9746a963c46ac4ea6f5433df4e62ae9ba Mon Sep 17 00:00:00 2001 From: Brinda Sasikumar Date: Thu, 7 Mar 2024 16:54:44 -0500 Subject: [PATCH 15/81] target dev site --- apps/playwright/playwright.config.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/apps/playwright/playwright.config.ts b/apps/playwright/playwright.config.ts index 127c3e78d65..cd609d16041 100644 --- a/apps/playwright/playwright.config.ts +++ b/apps/playwright/playwright.config.ts @@ -26,7 +26,7 @@ export default defineConfig({ /* Shared settings for all the projects below. See https://playwright.dev/docs/api/class-testoptions. */ use: { /* Base URL to use in actions like `await page.goto('/')`. */ - baseURL: "http://localhost:8000", + baseURL: "https://dev-talentcloud.tbs-sct.gc.ca", /* Collect trace when retrying the failed test. See https://playwright.dev/docs/trace-viewer */ trace: "retain-on-failure", From 2f2eebef8b6ef448d1c95e049f808097a6167d97 Mon Sep 17 00:00:00 2001 From: Brinda Sasikumar Date: Thu, 4 Apr 2024 10:05:00 -0400 Subject: [PATCH 16/81] Update azure-pipelines-dev.yml for Azure Pipelines --- infrastructure/azure-pipelines-dev.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/infrastructure/azure-pipelines-dev.yml b/infrastructure/azure-pipelines-dev.yml index b9c795f744e..e2fe8c29484 100644 --- a/infrastructure/azure-pipelines-dev.yml +++ b/infrastructure/azure-pipelines-dev.yml @@ -51,7 +51,7 @@ stages: - job: run_playwright_tests displayName: Run Playwright tests pool: - vmImage: ubuntu-20.04 + name: 'TBS Linux Self Hosted' steps: - checkout: self clean: true From e148a9d4a32062c9da384d15fba376e92cf1bdc9 Mon Sep 17 00:00:00 2001 From: Brinda Sasikumar Date: Thu, 4 Apr 2024 15:29:06 -0400 Subject: [PATCH 17/81] Create .npmrc --- .npmrc | 2 ++ 1 file changed, 2 insertions(+) create mode 100644 .npmrc diff --git a/.npmrc b/.npmrc new file mode 100644 index 00000000000..5ce1ecbc59f --- /dev/null +++ b/.npmrc @@ -0,0 +1,2 @@ +registry=https://pkgs.dev.azure.com/tbs-sct/_packaging/TBS_Custom_Npm_Feed/npm/registry/ +always-auth=true From dbd45564851e28d6639680b13a0eda8f5b4c0fe3 Mon Sep 17 00:00:00 2001 From: Brinda Sasikumar Date: Mon, 8 Apr 2024 18:13:10 +0000 Subject: [PATCH 18/81] move .npmrc file --- .npmrc => infrastructure/.npmrc | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename .npmrc => infrastructure/.npmrc (100%) diff --git a/.npmrc b/infrastructure/.npmrc similarity index 100% rename from .npmrc rename to infrastructure/.npmrc From 36e9d5e712471260aedfb5f29d8339d2994bfb1e Mon Sep 17 00:00:00 2001 From: Brinda Sasikumar Date: Mon, 8 Apr 2024 14:30:43 -0400 Subject: [PATCH 19/81] update .npmrc custom location var --- infrastructure/azure-pipelines-dev.yml | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/infrastructure/azure-pipelines-dev.yml b/infrastructure/azure-pipelines-dev.yml index e2fe8c29484..4b886e526b8 100644 --- a/infrastructure/azure-pipelines-dev.yml +++ b/infrastructure/azure-pipelines-dev.yml @@ -45,8 +45,13 @@ stages: ArtifactName: gcDigitalTalent - stage: Test + pool: + name: 'TBS Linux Self Hosted' displayName: Test stage dependsOn: Build + variables: + name: npm_config_user_config + value: '$(System.DefaultWorkingDirectory)/infrastructure/.npmrc' jobs: - job: run_playwright_tests displayName: Run Playwright tests @@ -61,6 +66,14 @@ stages: inputs: artifactName: gcDigitalTalent downloadPath: $(System.DefaultWorkingDirectory)/artifacts + - task: npmAuthenticate@0 + displayName: '00 - NPM Authenticate' + name: 'NPM_Authenticate' + inputs: + workingFile: $(npm_config_user_config) + + - script: echo ##vso[task.setvariable variable=NPM_CONFIG_USERCONFIG]$(npm_config_user_config) + displayName: 'Set Custom .npmrc Location' - script: npx npm install --include=dev displayName: "Install Node.js dependencies" From a2f72ad1259ab2c674c4504cacb6455881e176cc Mon Sep 17 00:00:00 2001 From: Brinda Sasikumar Date: Tue, 9 Apr 2024 08:04:17 -0400 Subject: [PATCH 20/81] fix variable defintion --- infrastructure/azure-pipelines-dev.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/infrastructure/azure-pipelines-dev.yml b/infrastructure/azure-pipelines-dev.yml index 4b886e526b8..38cc60fb5b1 100644 --- a/infrastructure/azure-pipelines-dev.yml +++ b/infrastructure/azure-pipelines-dev.yml @@ -50,8 +50,8 @@ stages: displayName: Test stage dependsOn: Build variables: - name: npm_config_user_config - value: '$(System.DefaultWorkingDirectory)/infrastructure/.npmrc' + - name: npm_config_user_config + value: '$(System.DefaultWorkingDirectory)/infrastructure/.npmrc' jobs: - job: run_playwright_tests displayName: Run Playwright tests From 629ec10e833766c331a84a4508328e2156bdbeb6 Mon Sep 17 00:00:00 2001 From: Brinda Sasikumar Date: Tue, 9 Apr 2024 11:38:43 -0400 Subject: [PATCH 21/81] change .npmrc file to point to the new feed --- infrastructure/.npmrc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/infrastructure/.npmrc b/infrastructure/.npmrc index 5ce1ecbc59f..16beaee92ab 100644 --- a/infrastructure/.npmrc +++ b/infrastructure/.npmrc @@ -1,2 +1,2 @@ -registry=https://pkgs.dev.azure.com/tbs-sct/_packaging/TBS_Custom_Npm_Feed/npm/registry/ +registry=https://pkgs.dev.azure.com/tbs-sct/53c8b022-82b7-4031-88aa-0d1266fc3bf5/_packaging/TalentCloud_Custom_NPM_Feed/npm/registry/ always-auth=true From c864b40ffdc0d4b050d816d8d7a700f7598bc667 Mon Sep 17 00:00:00 2001 From: Brinda Sasikumar Date: Tue, 9 Apr 2024 13:59:20 -0400 Subject: [PATCH 22/81] add step Cypress installation --- infrastructure/azure-pipelines-dev.yml | 3 +++ 1 file changed, 3 insertions(+) diff --git a/infrastructure/azure-pipelines-dev.yml b/infrastructure/azure-pipelines-dev.yml index 38cc60fb5b1..65514a28515 100644 --- a/infrastructure/azure-pipelines-dev.yml +++ b/infrastructure/azure-pipelines-dev.yml @@ -75,6 +75,9 @@ stages: - script: echo ##vso[task.setvariable variable=NPM_CONFIG_USERCONFIG]$(npm_config_user_config) displayName: 'Set Custom .npmrc Location' + - script: CYPRESS_INSTALL_BINARY=/opt/cypress.zip npm install cypress + displayName: "Install Cypress" + - script: npx npm install --include=dev displayName: "Install Node.js dependencies" From 72cac4379d9b44026ee75852bcc5ce6f0f3bffe9 Mon Sep 17 00:00:00 2001 From: Brinda Sasikumar Date: Tue, 9 Apr 2024 15:17:00 -0400 Subject: [PATCH 23/81] try using whoami for permission issue --- infrastructure/azure-pipelines-dev.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/infrastructure/azure-pipelines-dev.yml b/infrastructure/azure-pipelines-dev.yml index 65514a28515..cbc178c5031 100644 --- a/infrastructure/azure-pipelines-dev.yml +++ b/infrastructure/azure-pipelines-dev.yml @@ -84,7 +84,7 @@ stages: - script: npm run build:packages displayName: "Build dependencies" - - script: npx playwright install --with-deps + - script: export npm_config_user=$(whoami) && npx playwright install --with-deps displayName: "Install Playwright browsers" - script: npm run e2e:playwright:chromium From 76c8871f4017648d7eaded986459bbb04c6c1fca Mon Sep 17 00:00:00 2001 From: Brinda Sasikumar Date: Tue, 9 Apr 2024 15:37:24 -0400 Subject: [PATCH 24/81] Update azure-pipelines-dev.yml for Azure Pipelines --- infrastructure/azure-pipelines-dev.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/infrastructure/azure-pipelines-dev.yml b/infrastructure/azure-pipelines-dev.yml index cbc178c5031..855cf2c2b0e 100644 --- a/infrastructure/azure-pipelines-dev.yml +++ b/infrastructure/azure-pipelines-dev.yml @@ -84,7 +84,7 @@ stages: - script: npm run build:packages displayName: "Build dependencies" - - script: export npm_config_user=$(whoami) && npx playwright install --with-deps + - script: export npm_config_unsafe_perm=true && npx playwright install --with-deps displayName: "Install Playwright browsers" - script: npm run e2e:playwright:chromium From 21838fb71e8f5203821934fd04595d9435e8f739 Mon Sep 17 00:00:00 2001 From: Brinda Sasikumar Date: Wed, 10 Apr 2024 08:02:55 -0400 Subject: [PATCH 25/81] Update azure-pipelines-dev.yml for Azure Pipelines --- infrastructure/azure-pipelines-dev.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/infrastructure/azure-pipelines-dev.yml b/infrastructure/azure-pipelines-dev.yml index 855cf2c2b0e..65514a28515 100644 --- a/infrastructure/azure-pipelines-dev.yml +++ b/infrastructure/azure-pipelines-dev.yml @@ -84,7 +84,7 @@ stages: - script: npm run build:packages displayName: "Build dependencies" - - script: export npm_config_unsafe_perm=true && npx playwright install --with-deps + - script: npx playwright install --with-deps displayName: "Install Playwright browsers" - script: npm run e2e:playwright:chromium From 17aea702be93db77fa3192bd8eac13fc61084ff7 Mon Sep 17 00:00:00 2001 From: Brinda Sasikumar Date: Wed, 10 Apr 2024 08:37:35 -0400 Subject: [PATCH 26/81] remove deps for playwright as we installed them manually --- infrastructure/azure-pipelines-dev.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/infrastructure/azure-pipelines-dev.yml b/infrastructure/azure-pipelines-dev.yml index 65514a28515..159a8369307 100644 --- a/infrastructure/azure-pipelines-dev.yml +++ b/infrastructure/azure-pipelines-dev.yml @@ -83,8 +83,8 @@ stages: - script: npm run build:packages displayName: "Build dependencies" - - - script: npx playwright install --with-deps + + - script: npx playwright install displayName: "Install Playwright browsers" - script: npm run e2e:playwright:chromium From d791a27bc5cc6f6cb91124e8a4f1ee42ed253544 Mon Sep 17 00:00:00 2001 From: Brinda Sasikumar Date: Wed, 10 Apr 2024 09:14:33 -0400 Subject: [PATCH 27/81] ignore HTTPS errors --- apps/playwright/playwright.config.ts | 3 +++ 1 file changed, 3 insertions(+) diff --git a/apps/playwright/playwright.config.ts b/apps/playwright/playwright.config.ts index cd609d16041..35bb4db8d51 100644 --- a/apps/playwright/playwright.config.ts +++ b/apps/playwright/playwright.config.ts @@ -30,6 +30,9 @@ export default defineConfig({ /* Collect trace when retrying the failed test. See https://playwright.dev/docs/trace-viewer */ trace: "retain-on-failure", + + /* ignore HTTPS errors when sending network requests */ + ignoreHTTPSErrors: true, }, /* Configure projects for major browsers */ From 56215f6d4db51f7928d15c9385e225ba5ef06893 Mon Sep 17 00:00:00 2001 From: Brinda Sasikumar Date: Thu, 11 Apr 2024 10:57:43 -0400 Subject: [PATCH 28/81] attempt to refactor the tests to accommodate GCKey sign in --- apps/playwright/.env.example | 5 +++ apps/playwright/global.setup.ts | 16 +++++++-- apps/playwright/utils/auth.ts | 57 +++++++++++++++++++++++++++++++++ 3 files changed, 75 insertions(+), 3 deletions(-) diff --git a/apps/playwright/.env.example b/apps/playwright/.env.example index 44542cc4984..0ca8a42df0a 100644 --- a/apps/playwright/.env.example +++ b/apps/playwright/.env.example @@ -2,3 +2,8 @@ # See: https://playwright.dev/docs/test-timeouts #TEST_TIMEOUT=30000 #EXPECT_TIMEOUT=5000 +#BASE_URL=http://localhost:8000 +#ADMIN_USER_NAME="" +#ADMIN_USER_PASSWORD="" +#APPLICANT_USER_NAME="" +#APPLICANT_USER_PASSWORD="" diff --git a/apps/playwright/global.setup.ts b/apps/playwright/global.setup.ts index c0c1fbc3800..bfff93046ac 100644 --- a/apps/playwright/global.setup.ts +++ b/apps/playwright/global.setup.ts @@ -1,14 +1,24 @@ import { Page, test as setup } from "@playwright/test"; import auth from "~/constants/auth"; -import { loginBySub } from "~/utils/auth"; +import { login } from "~/utils/auth"; setup("authenticate as admin", async ({ page }) => { - await loginBySub(page, "admin@test.com"); + await login( + page, + "admin@test.com", + process.env.ADMIN_USER_NAME, + process.env.ADMIN_USER_PASSWORD, + ); await page.context().storageState({ path: auth.STATE.ADMIN }); }); setup("authenticate as applicant", async ({ page }) => { - await loginBySub(page, "applicant@test.com"); + await login( + page, + "applicant@test.com", + process.env.APPLICANT_USER_NAME, + process.env.APPLICANT_USER_PASSWORD, + ); await page.context().storageState({ path: auth.STATE.APPLICANT }); }); diff --git a/apps/playwright/utils/auth.ts b/apps/playwright/utils/auth.ts index dc59cf474d0..83b861ac932 100644 --- a/apps/playwright/utils/auth.ts +++ b/apps/playwright/utils/auth.ts @@ -22,6 +22,63 @@ export async function loginBySub(page: Page, sub: string) { await page.waitForURL("**/applicant/profile-and-applications"); } +/** + * Login by gckey sign in using username and password + * + * Logs a user into the application + * + * @param {Page} page + * @param {String} username + * @param {String} password + * @param {String} sub // optional + * + */ +export async function loginByGCKeySignIn( + page: Page, // page object + username: string, + password: string, + sub?: string, +) { + await page.goto("/login-info"); + await page + .getByRole("link", { name: /continue to gckey and sign in/i }) + .first() + .click(); + await page.getByPlaceholder("Username").fill(username); + await page.getByPlaceholder("Password").fill(password); + await page + .getByRole("button", { name: /Connect to the GCKey Service/i }) + .click(); + await page.waitForURL("**/applicant/profile-and-applications"); +} + + + +/** + * Attempt to login by sub and fallback to loginByGckeySignIn if it fails + * + * @param {Page} page + * @param {String} sub + * @param {String} username + * @param {String} password + */ +export async function login( + page: Page, + sub: string, + username: string, + password: string, +) { + // check process.env.baseURL to determine if it is a local or remote environment + // if it is a local environment, use loginBySub + // if it is a remote environment, use loginByGckeySignIn + if (process.env.baseURL === "http://localhost:8000") { + await loginBySub(page, sub); + } else { + await loginByGCKeySignIn(page, username, password, sub); + } + +} + export type AuthCookies = { apiSession?: Cookie; xsrf?: Cookie; From 914a004da625a5ab2da1f33966b8ecbf14e66ae8 Mon Sep 17 00:00:00 2001 From: Brinda Sasikumar Date: Thu, 18 Apr 2024 15:33:58 -0400 Subject: [PATCH 29/81] add vars to upload the results to the container --- infrastructure/azure-pipelines-dev.yml | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/infrastructure/azure-pipelines-dev.yml b/infrastructure/azure-pipelines-dev.yml index 159a8369307..eb6197cbe4a 100644 --- a/infrastructure/azure-pipelines-dev.yml +++ b/infrastructure/azure-pipelines-dev.yml @@ -52,6 +52,16 @@ stages: variables: - name: npm_config_user_config value: '$(System.DefaultWorkingDirectory)/infrastructure/.npmrc' + - name: dirResults + value: '$(System.DefaultWorkingDirectory)/apps/playwright/test-results' + - name: resourceGroupName + value: 'rg_tbs_talent_2_PaaS' + - name: vertical + value: 'dev' + - name: storageAccountName + value: 'sttalclddevcacstdl' + - name: storageContainer + value: 'playwright-results' jobs: - job: run_playwright_tests displayName: Run Playwright tests From 1a254f8ea91828fbf04db8f2f4cfdd8c3217c3da Mon Sep 17 00:00:00 2001 From: Brinda Sasikumar Date: Thu, 18 Apr 2024 16:41:43 -0400 Subject: [PATCH 30/81] Add steps to store in to storage account --- infrastructure/azure-pipelines-dev.yml | 28 ++++++++++++++++++++++++++ 1 file changed, 28 insertions(+) diff --git a/infrastructure/azure-pipelines-dev.yml b/infrastructure/azure-pipelines-dev.yml index eb6197cbe4a..911d8f642aa 100644 --- a/infrastructure/azure-pipelines-dev.yml +++ b/infrastructure/azure-pipelines-dev.yml @@ -99,3 +99,31 @@ stages: - script: npm run e2e:playwright:chromium displayName: "Run playwright tests" + - task: AzureCLI@2 + displayName: ‘Copy Playwright Results to Storage’ + condition: succeededOrFailed() + inputs: + azureSubscription: $(serviceConnectionName) + scriptType: bash + scriptLocation: inlineScript + inlineScript: | + if [ ! $(which az 2> /dev/null) ]; then echo “ERROR: az cli not found” && exit 1; fi + DIR_SRC=“${{ variables.dirResults }}” + TIMESTAMP=“$(date +‘%Y-%m-%d %H:%M:%S’)” + echo “Timestamp: ${TIMESTAMP}” + if [ -d “${DIR_SRC}” ]; then + SA_RG=“${{ variables.resourceGroupName }}” + SA_NAME=“${{ variables.storageAccountName }}” + SA_CONTAINER_NAME=“${{ variables.storageContainer }}” + SA_CONTAINER_PATH_PREFIX=“${{ variables.vertical }}/${TIMESTAMP}” + AZURE_STORAGE_KEY=$(az storage account keys list --resource-group “$SA_RG” --account-name “$SA_NAME” --query “[0].value” --output tsv) + az storage blob upload-batch --destination “${SA_CONTAINER_NAME}” --account-name “${SA_NAME}” --destination-path “${SA_CONTAINER_PATH_PREFIX}” --source “${DIR_SRC}” + else + echo “No ‘test-results’ directory found” + fi + + + + + + From 9ee5d1ba3dc31c72fa9a8b3a54efc9435a35e3f0 Mon Sep 17 00:00:00 2001 From: Brinda Sasikumar Date: Thu, 18 Apr 2024 16:55:01 -0400 Subject: [PATCH 31/81] Update azure-pipelines-dev.yml for Azure Pipelines --- infrastructure/azure-pipelines-dev.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/infrastructure/azure-pipelines-dev.yml b/infrastructure/azure-pipelines-dev.yml index 911d8f642aa..fde0f16348c 100644 --- a/infrastructure/azure-pipelines-dev.yml +++ b/infrastructure/azure-pipelines-dev.yml @@ -61,7 +61,7 @@ stages: - name: storageAccountName value: 'sttalclddevcacstdl' - name: storageContainer - value: 'playwright-results' + value: 'playwright-results' jobs: - job: run_playwright_tests displayName: Run Playwright tests From a39271c8f7d49c143b08e8993beffd0a664ec038 Mon Sep 17 00:00:00 2001 From: Brinda Sasikumar Date: Fri, 19 Apr 2024 08:51:27 -0400 Subject: [PATCH 32/81] add ServiceConnection --- infrastructure/azure-pipelines-dev.yml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/infrastructure/azure-pipelines-dev.yml b/infrastructure/azure-pipelines-dev.yml index fde0f16348c..1026db9b738 100644 --- a/infrastructure/azure-pipelines-dev.yml +++ b/infrastructure/azure-pipelines-dev.yml @@ -62,6 +62,8 @@ stages: value: 'sttalclddevcacstdl' - name: storageContainer value: 'playwright-results' + - name: serviceConnectionName + value: 'Talent Cloud Service Connection' jobs: - job: run_playwright_tests displayName: Run Playwright tests From ff45afd295c67b0c0de43d007d4612d665bf0870 Mon Sep 17 00:00:00 2001 From: Brinda Sasikumar Date: Fri, 19 Apr 2024 09:05:31 -0400 Subject: [PATCH 33/81] Update azure-pipelines-dev.yml for Azure Pipelines --- infrastructure/azure-pipelines-dev.yml | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/infrastructure/azure-pipelines-dev.yml b/infrastructure/azure-pipelines-dev.yml index 1026db9b738..d1fe9985d30 100644 --- a/infrastructure/azure-pipelines-dev.yml +++ b/infrastructure/azure-pipelines-dev.yml @@ -8,7 +8,7 @@ resources: ref: refs/heads/main variables: phpVersion: "8.2" - + serviceConnectionName: 'Talent Cloud Service Connection' stages: - stage: Build displayName: Build stage @@ -62,8 +62,6 @@ stages: value: 'sttalclddevcacstdl' - name: storageContainer value: 'playwright-results' - - name: serviceConnectionName - value: 'Talent Cloud Service Connection' jobs: - job: run_playwright_tests displayName: Run Playwright tests From c8bb6e62fbdc0d00b0ece7a0b494b521835ea0e7 Mon Sep 17 00:00:00 2001 From: Brinda Sasikumar Date: Fri, 19 Apr 2024 10:07:29 -0400 Subject: [PATCH 34/81] add 10 min timeout --- infrastructure/azure-pipelines-dev.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/infrastructure/azure-pipelines-dev.yml b/infrastructure/azure-pipelines-dev.yml index d1fe9985d30..b96bcf13bdf 100644 --- a/infrastructure/azure-pipelines-dev.yml +++ b/infrastructure/azure-pipelines-dev.yml @@ -101,6 +101,7 @@ stages: displayName: "Run playwright tests" - task: AzureCLI@2 displayName: ‘Copy Playwright Results to Storage’ + timeoutInMinutes: 10 condition: succeededOrFailed() inputs: azureSubscription: $(serviceConnectionName) From 2358d8d4a4d0f6c9cf95c0f410c83894ce78f2c9 Mon Sep 17 00:00:00 2001 From: Brinda Sasikumar Date: Fri, 19 Apr 2024 10:38:56 -0400 Subject: [PATCH 35/81] run the report with dot option for CI --- .github/workflows/playwright.yml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/workflows/playwright.yml b/.github/workflows/playwright.yml index 2e85674d4f9..d1f1a8c70ed 100644 --- a/.github/workflows/playwright.yml +++ b/.github/workflows/playwright.yml @@ -65,7 +65,7 @@ jobs: run: npx playwright install --with-deps - name: Run Chromium Tests - run: npm run e2e:playwright:chromium + run: npm run e2e:playwright:chromium --reporter dot - uses: actions/upload-artifact@v4 if: always() with: @@ -74,7 +74,7 @@ jobs: retention-days: 30 - name: Run Firefox Tests - run: npm run e2e:playwright:firefox + run: npm run e2e:playwright:firefox --reporter dot - uses: actions/upload-artifact@v4 if: always() with: @@ -83,7 +83,7 @@ jobs: retention-days: 30 - name: Run Webkit Tests - run: npm run e2e:playwright:webkit + run: npm run e2e:playwright:webkit --reporter dot - uses: actions/upload-artifact@v4 if: always() with: From ecb7fda84767f2a7c5d02ebac8682890005c483c Mon Sep 17 00:00:00 2001 From: Brinda Sasikumar Date: Fri, 19 Apr 2024 12:59:26 -0400 Subject: [PATCH 36/81] Update azure-pipelines-dev.yml for Azure Pipelines --- infrastructure/azure-pipelines-dev.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/infrastructure/azure-pipelines-dev.yml b/infrastructure/azure-pipelines-dev.yml index b96bcf13bdf..1fee858a375 100644 --- a/infrastructure/azure-pipelines-dev.yml +++ b/infrastructure/azure-pipelines-dev.yml @@ -65,6 +65,7 @@ stages: jobs: - job: run_playwright_tests displayName: Run Playwright tests + timeoutInMinutes: 10 pool: name: 'TBS Linux Self Hosted' steps: @@ -101,7 +102,6 @@ stages: displayName: "Run playwright tests" - task: AzureCLI@2 displayName: ‘Copy Playwright Results to Storage’ - timeoutInMinutes: 10 condition: succeededOrFailed() inputs: azureSubscription: $(serviceConnectionName) From 5d4b0ec2c1586100d9ca3e7e9f5633a0500112d0 Mon Sep 17 00:00:00 2001 From: Brinda Sasikumar Date: Fri, 19 Apr 2024 13:18:32 -0400 Subject: [PATCH 37/81] don't open html in CI --- apps/playwright/playwright.config.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/apps/playwright/playwright.config.ts b/apps/playwright/playwright.config.ts index 35bb4db8d51..acd7fac42aa 100644 --- a/apps/playwright/playwright.config.ts +++ b/apps/playwright/playwright.config.ts @@ -20,7 +20,7 @@ export default defineConfig({ /* Opt out of parallel tests on CI. */ workers: process.env.CI ? 1 : undefined, /* Reporter to use. See https://playwright.dev/docs/test-reporters */ - reporter: [["line"], ["html", { open: "on-failure" }]], + reporter: process.env.CI ? "line" : [["line"], ["html", { open: "on-failure" }]], timeout: Number(process.env.TEST_TIMEOUT ?? 3 * 60 * 1000), // 3 minutes expect: { timeout: Number(process.env.EXPECT_TIMEOUT ?? 10000) }, // 10 seconds /* Shared settings for all the projects below. See https://playwright.dev/docs/api/class-testoptions. */ From 8bd591d7fa32126a3319caaae709dba2921eab85 Mon Sep 17 00:00:00 2001 From: Brinda Sasikumar Date: Fri, 19 Apr 2024 13:44:49 -0400 Subject: [PATCH 38/81] test without env var --- apps/playwright/playwright.config.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/apps/playwright/playwright.config.ts b/apps/playwright/playwright.config.ts index acd7fac42aa..f7f301c7a2a 100644 --- a/apps/playwright/playwright.config.ts +++ b/apps/playwright/playwright.config.ts @@ -20,7 +20,7 @@ export default defineConfig({ /* Opt out of parallel tests on CI. */ workers: process.env.CI ? 1 : undefined, /* Reporter to use. See https://playwright.dev/docs/test-reporters */ - reporter: process.env.CI ? "line" : [["line"], ["html", { open: "on-failure" }]], + reporter: "line", timeout: Number(process.env.TEST_TIMEOUT ?? 3 * 60 * 1000), // 3 minutes expect: { timeout: Number(process.env.EXPECT_TIMEOUT ?? 10000) }, // 10 seconds /* Shared settings for all the projects below. See https://playwright.dev/docs/api/class-testoptions. */ From 1f415d671d0071cc4719f8955d8348b2b4cd4835 Mon Sep 17 00:00:00 2001 From: Brinda Sasikumar Date: Fri, 19 Apr 2024 14:13:02 -0400 Subject: [PATCH 39/81] Update azure-pipelines-dev.yml for Azure Pipelines --- infrastructure/azure-pipelines-dev.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/infrastructure/azure-pipelines-dev.yml b/infrastructure/azure-pipelines-dev.yml index 1fee858a375..de8edaf81f4 100644 --- a/infrastructure/azure-pipelines-dev.yml +++ b/infrastructure/azure-pipelines-dev.yml @@ -110,6 +110,7 @@ stages: inlineScript: | if [ ! $(which az 2> /dev/null) ]; then echo “ERROR: az cli not found” && exit 1; fi DIR_SRC=“${{ variables.dirResults }}” + echo "dirResults: ${{ variables.dirResults }}" TIMESTAMP=“$(date +‘%Y-%m-%d %H:%M:%S’)” echo “Timestamp: ${TIMESTAMP}” if [ -d “${DIR_SRC}” ]; then From d81019b394b52aca5183d862daebb227738cfc2a Mon Sep 17 00:00:00 2001 From: Brinda Sasikumar Date: Fri, 19 Apr 2024 14:20:14 -0400 Subject: [PATCH 40/81] fix quotes --- infrastructure/azure-pipelines-dev.yml | 22 +++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-) diff --git a/infrastructure/azure-pipelines-dev.yml b/infrastructure/azure-pipelines-dev.yml index de8edaf81f4..ae117d71b9e 100644 --- a/infrastructure/azure-pipelines-dev.yml +++ b/infrastructure/azure-pipelines-dev.yml @@ -101,7 +101,7 @@ stages: - script: npm run e2e:playwright:chromium displayName: "Run playwright tests" - task: AzureCLI@2 - displayName: ‘Copy Playwright Results to Storage’ + displayName: "Copy Playwright Results to Storage" condition: succeededOrFailed() inputs: azureSubscription: $(serviceConnectionName) @@ -111,17 +111,17 @@ stages: if [ ! $(which az 2> /dev/null) ]; then echo “ERROR: az cli not found” && exit 1; fi DIR_SRC=“${{ variables.dirResults }}” echo "dirResults: ${{ variables.dirResults }}" - TIMESTAMP=“$(date +‘%Y-%m-%d %H:%M:%S’)” - echo “Timestamp: ${TIMESTAMP}” - if [ -d “${DIR_SRC}” ]; then - SA_RG=“${{ variables.resourceGroupName }}” - SA_NAME=“${{ variables.storageAccountName }}” - SA_CONTAINER_NAME=“${{ variables.storageContainer }}” - SA_CONTAINER_PATH_PREFIX=“${{ variables.vertical }}/${TIMESTAMP}” - AZURE_STORAGE_KEY=$(az storage account keys list --resource-group “$SA_RG” --account-name “$SA_NAME” --query “[0].value” --output tsv) - az storage blob upload-batch --destination “${SA_CONTAINER_NAME}” --account-name “${SA_NAME}” --destination-path “${SA_CONTAINER_PATH_PREFIX}” --source “${DIR_SRC}” + TIMESTAMP="$(date +'%Y-%m-%d %H:%M:%S')" + echo "Timestamp: ${TIMESTAMP}" + if [ -d "${DIR_SRC}" ]; then + SA_RG="${{ variables.resourceGroupName }}" + SA_NAME="${{ variables.storageAccountName }}" + SA_CONTAINER_NAME="${{ variables.storageContainer }}"" + SA_CONTAINER_PATH_PREFIX="${{ variables.vertical }}/${TIMESTAMP}" + AZURE_STORAGE_KEY=$(az storage account keys list --resource-group "$SA_RG" --account-name "$SA_NAME" --query "[0].value" --output tsv) + az storage blob upload-batch --destination "${SA_CONTAINER_NAME}" --account-name "${SA_NAME}" --destination-path "${SA_CONTAINER_PATH_PREFIX}" --source "${DIR_SRC}" else - echo “No ‘test-results’ directory found” + echo "No 'test-results' directory found" fi From ea6da20dc783cdf6db7213797f4d927473acfafd Mon Sep 17 00:00:00 2001 From: Brinda Sasikumar Date: Fri, 19 Apr 2024 14:26:58 -0400 Subject: [PATCH 41/81] fix quotes for the display name --- infrastructure/azure-pipelines-dev.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/infrastructure/azure-pipelines-dev.yml b/infrastructure/azure-pipelines-dev.yml index ae117d71b9e..5d46c55c7f9 100644 --- a/infrastructure/azure-pipelines-dev.yml +++ b/infrastructure/azure-pipelines-dev.yml @@ -101,7 +101,7 @@ stages: - script: npm run e2e:playwright:chromium displayName: "Run playwright tests" - task: AzureCLI@2 - displayName: "Copy Playwright Results to Storage" + displayName: 'Copy Playwright Results to Storage' condition: succeededOrFailed() inputs: azureSubscription: $(serviceConnectionName) From 966f634697307a94a3787b577d0100952cab504e Mon Sep 17 00:00:00 2001 From: Brinda Sasikumar Date: Fri, 19 Apr 2024 16:04:10 -0400 Subject: [PATCH 42/81] fix quotes --- infrastructure/azure-pipelines-dev.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/infrastructure/azure-pipelines-dev.yml b/infrastructure/azure-pipelines-dev.yml index 5d46c55c7f9..f064df27a36 100644 --- a/infrastructure/azure-pipelines-dev.yml +++ b/infrastructure/azure-pipelines-dev.yml @@ -109,14 +109,14 @@ stages: scriptLocation: inlineScript inlineScript: | if [ ! $(which az 2> /dev/null) ]; then echo “ERROR: az cli not found” && exit 1; fi - DIR_SRC=“${{ variables.dirResults }}” + DIR_SRC="${{ variables.dirResults }}" echo "dirResults: ${{ variables.dirResults }}" TIMESTAMP="$(date +'%Y-%m-%d %H:%M:%S')" echo "Timestamp: ${TIMESTAMP}" if [ -d "${DIR_SRC}" ]; then SA_RG="${{ variables.resourceGroupName }}" SA_NAME="${{ variables.storageAccountName }}" - SA_CONTAINER_NAME="${{ variables.storageContainer }}"" + SA_CONTAINER_NAME="${{ variables.storageContainer }}" SA_CONTAINER_PATH_PREFIX="${{ variables.vertical }}/${TIMESTAMP}" AZURE_STORAGE_KEY=$(az storage account keys list --resource-group "$SA_RG" --account-name "$SA_NAME" --query "[0].value" --output tsv) az storage blob upload-batch --destination "${SA_CONTAINER_NAME}" --account-name "${SA_NAME}" --destination-path "${SA_CONTAINER_PATH_PREFIX}" --source "${DIR_SRC}" From e6b8f5a0a52c702901c9a77ef3f6800ab8f80049 Mon Sep 17 00:00:00 2001 From: Brinda Sasikumar Date: Fri, 26 Apr 2024 09:52:11 -0400 Subject: [PATCH 43/81] Update azure-pipelines-dev.yml for Azure Pipelines Add CI env var --- infrastructure/azure-pipelines-dev.yml | 3 +++ 1 file changed, 3 insertions(+) diff --git a/infrastructure/azure-pipelines-dev.yml b/infrastructure/azure-pipelines-dev.yml index f064df27a36..a9aa2e09674 100644 --- a/infrastructure/azure-pipelines-dev.yml +++ b/infrastructure/azure-pipelines-dev.yml @@ -98,8 +98,11 @@ stages: - script: npx playwright install displayName: "Install Playwright browsers" + - script: npm run e2e:playwright:chromium displayName: "Run playwright tests" + env: + CI: 'true' - task: AzureCLI@2 displayName: 'Copy Playwright Results to Storage' condition: succeededOrFailed() From 1cdd2870d169447ac45438207d3ee4c63ea04ecd Mon Sep 17 00:00:00 2001 From: Brinda Sasikumar Date: Mon, 29 Apr 2024 10:10:23 -0400 Subject: [PATCH 44/81] open html report if not CI --- apps/playwright/playwright.config.ts | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/apps/playwright/playwright.config.ts b/apps/playwright/playwright.config.ts index f7f301c7a2a..35cbb10ff37 100644 --- a/apps/playwright/playwright.config.ts +++ b/apps/playwright/playwright.config.ts @@ -20,7 +20,9 @@ export default defineConfig({ /* Opt out of parallel tests on CI. */ workers: process.env.CI ? 1 : undefined, /* Reporter to use. See https://playwright.dev/docs/test-reporters */ - reporter: "line", + reporter: process.env.CI + ? "line" + : [["line"], ["html", { open: "on-failure" }]], timeout: Number(process.env.TEST_TIMEOUT ?? 3 * 60 * 1000), // 3 minutes expect: { timeout: Number(process.env.EXPECT_TIMEOUT ?? 10000) }, // 10 seconds /* Shared settings for all the projects below. See https://playwright.dev/docs/api/class-testoptions. */ From a837d2aa1fe8c231eac00c061938be2b89e68329 Mon Sep 17 00:00:00 2001 From: Brinda Sasikumar Date: Tue, 30 Apr 2024 10:51:37 -0400 Subject: [PATCH 45/81] Revert "test without prune" This reverts commit e316994f747ace4d09ae57f455b7c5d31be46b0a. --- infrastructure/bin/deploy.sh | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/infrastructure/bin/deploy.sh b/infrastructure/bin/deploy.sh index fcfb37ae507..28c45d3abec 100755 --- a/infrastructure/bin/deploy.sh +++ b/infrastructure/bin/deploy.sh @@ -73,3 +73,8 @@ npm ci --include=dev ### Build frontend npm run build chmod -R a+r,a+w node_modules + +if [ "$GCDT_DEV" = false ]; then +### Cleanup frontend npm dependencies + npm prune --production +fi From f02304c4d12ae3fc5788508e439a0a28efa49530 Mon Sep 17 00:00:00 2001 From: Brinda Sasikumar Date: Thu, 2 May 2024 14:08:03 -0400 Subject: [PATCH 46/81] remove cypress install --- infrastructure/azure-pipelines-dev.yml | 3 --- 1 file changed, 3 deletions(-) diff --git a/infrastructure/azure-pipelines-dev.yml b/infrastructure/azure-pipelines-dev.yml index 6fcee25ae28..113f060a2da 100644 --- a/infrastructure/azure-pipelines-dev.yml +++ b/infrastructure/azure-pipelines-dev.yml @@ -88,9 +88,6 @@ stages: - script: echo ##vso[task.setvariable variable=NPM_CONFIG_USERCONFIG]$(npm_config_user_config) displayName: 'Set Custom .npmrc Location' - - script: CYPRESS_INSTALL_BINARY=/opt/cypress.zip npm install cypress - displayName: "Install Cypress" - - script: npx npm install --include=dev displayName: "Install Node.js dependencies" From 3be2468936b440d32bdd3094215dc33ff0d8d4ae Mon Sep 17 00:00:00 2001 From: Brinda Sasikumar Date: Thu, 2 May 2024 15:38:43 -0400 Subject: [PATCH 47/81] change into pnpm --- infrastructure/azure-pipelines-dev.yml | 210 +++++++++++++------------ 1 file changed, 106 insertions(+), 104 deletions(-) diff --git a/infrastructure/azure-pipelines-dev.yml b/infrastructure/azure-pipelines-dev.yml index 113f060a2da..fd8e5c7f155 100644 --- a/infrastructure/azure-pipelines-dev.yml +++ b/infrastructure/azure-pipelines-dev.yml @@ -8,120 +8,122 @@ resources: ref: refs/heads/main variables: phpVersion: "8.2" - serviceConnectionName: 'Talent Cloud Service Connection' + serviceConnectionName: "Talent Cloud Service Connection" stages: -- stage: Build - displayName: Build stage - jobs: - - job: build_artifact - displayName: Build artifact - pool: - vmImage: ubuntu-20.04 - steps: - - checkout: self - clean: true - fetchDepth: 1 + - stage: Build + displayName: Build stage + jobs: + - job: build_artifact + displayName: Build artifact + pool: + vmImage: ubuntu-20.04 + steps: + - checkout: self + clean: true + fetchDepth: 1 - - script: infrastructure/bin/set_php_versions.sh ${{ variables.phpVersion }} - displayName: "PHP version" + - script: infrastructure/bin/set_php_versions.sh ${{ variables.phpVersion }} + displayName: "PHP version" - - script: infrastructure/bin/deploy.sh -d -r $(System.DefaultWorkingDirectory) - displayName: Dependencies - env: - API_URI: /graphql - ADMIN_APP_DIR: /admin - API_PROTECTED_URI: /admin/graphql - # We don't need Cypress in this environment, and so this avoid permission errors of installing it. - # See: https://docs.cypress.io/guides/getting-started/installing-cypress#Skipping-installation - CYPRESS_INSTALL_BINARY: 0 + - script: infrastructure/bin/deploy.sh -d -r $(System.DefaultWorkingDirectory) + displayName: Dependencies + env: + API_URI: /graphql + ADMIN_APP_DIR: /admin + API_PROTECTED_URI: /admin/graphql + # We don't need Cypress in this environment, and so this avoid permission errors of installing it. + # See: https://docs.cypress.io/guides/getting-started/installing-cypress#Skipping-installation + CYPRESS_INSTALL_BINARY: 0 - - task: ArchiveFiles@2 - displayName: "Archive Files" - inputs: - rootFolderOrFile: $(System.DefaultWorkingDirectory) - includeRootFolder: false - archiveFile: "$(Build.ArtifactStagingDirectory)/Application_$(Build.BuildId).zip" + - task: ArchiveFiles@2 + displayName: "Archive Files" + inputs: + rootFolderOrFile: $(System.DefaultWorkingDirectory) + includeRootFolder: false + archiveFile: "$(Build.ArtifactStagingDirectory)/Application_$(Build.BuildId).zip" - - task: PublishBuildArtifacts@1 - displayName: "Publish Artifact: gcDigitalTalent" - inputs: - ArtifactName: gcDigitalTalent -- stage: Test - pool: - name: 'TBS Linux Self Hosted' - displayName: Test stage - dependsOn: Build - variables: - - name: npm_config_user_config - value: '$(System.DefaultWorkingDirectory)/infrastructure/.npmrc' - - name: dirResults - value: '$(System.DefaultWorkingDirectory)/apps/playwright/test-results' - - name: resourceGroupName - value: 'rg_tbs_talent_2_PaaS' - - name: vertical - value: 'dev' - - name: storageAccountName - value: 'sttalclddevcacstdl' - - name: storageContainer - value: 'playwright-results' - jobs: - - job: run_playwright_tests - displayName: Run Playwright tests - timeoutInMinutes: 10 + - task: PublishBuildArtifacts@1 + displayName: "Publish Artifact: gcDigitalTalent" + inputs: + ArtifactName: gcDigitalTalent + - stage: Test pool: - name: 'TBS Linux Self Hosted' - steps: - - checkout: self - clean: true - fetchDepth: 1 + name: "TBS Linux Self Hosted" + displayName: Test stage + dependsOn: Build + variables: + - name: npm_config_user_config + value: "$(System.DefaultWorkingDirectory)/infrastructure/.npmrc" + - name: dirResults + value: "$(System.DefaultWorkingDirectory)/apps/playwright/test-results" + - name: resourceGroupName + value: "rg_tbs_talent_2_PaaS" + - name: vertical + value: "dev" + - name: storageAccountName + value: "sttalclddevcacstdl" + - name: storageContainer + value: "playwright-results" + jobs: + - job: run_playwright_tests + displayName: Run Playwright tests + timeoutInMinutes: 10 + pool: + name: "TBS Linux Self Hosted" + steps: + - checkout: self + clean: true + fetchDepth: 1 - - task: DownloadBuildArtifacts@0 - inputs: - artifactName: gcDigitalTalent - downloadPath: $(System.DefaultWorkingDirectory)/artifacts - - task: npmAuthenticate@0 - displayName: '00 - NPM Authenticate' - name: 'NPM_Authenticate' - inputs: - workingFile: $(npm_config_user_config) + - task: DownloadBuildArtifacts@0 + inputs: + artifactName: gcDigitalTalent + downloadPath: $(System.DefaultWorkingDirectory)/artifacts + - task: npmAuthenticate@0 + displayName: "00 - NPM Authenticate" + name: "NPM_Authenticate" + inputs: + workingFile: $(npm_config_user_config) - - script: echo ##vso[task.setvariable variable=NPM_CONFIG_USERCONFIG]$(npm_config_user_config) - displayName: 'Set Custom .npmrc Location' + - script: echo ##vso[task.setvariable variable=NPM_CONFIG_USERCONFIG]$(npm_config_user_config) + displayName: "Set Custom .npmrc Location" - - script: npx npm install --include=dev - displayName: "Install Node.js dependencies" + - script: CYPRESS_INSTALL_BINARY=/opt/cypress.zip pnpm install cypress + displayName: "Install Cypress" - - script: npm run build:packages - displayName: "Build dependencies" + - script: pnpm install --dev + displayName: "Install Node.js dependencies" - - script: npx playwright install - displayName: "Install Playwright browsers" + - script: pnpm run build:packages + displayName: "Build dependencies" + - script: npx playwright install + displayName: "Install Playwright browsers" - - script: npm run e2e:playwright:chromium - displayName: "Run playwright tests" - env: - CI: 'true' - - task: AzureCLI@2 - displayName: 'Copy Playwright Results to Storage' - condition: succeededOrFailed() - inputs: - azureSubscription: $(serviceConnectionName) - scriptType: bash - scriptLocation: inlineScript - inlineScript: | - if [ ! $(which az 2> /dev/null) ]; then echo “ERROR: az cli not found” && exit 1; fi - DIR_SRC="${{ variables.dirResults }}" - echo "dirResults: ${{ variables.dirResults }}" - TIMESTAMP="$(date +'%Y-%m-%d %H:%M:%S')" - echo "Timestamp: ${TIMESTAMP}" - if [ -d "${DIR_SRC}" ]; then - SA_RG="${{ variables.resourceGroupName }}" - SA_NAME="${{ variables.storageAccountName }}" - SA_CONTAINER_NAME="${{ variables.storageContainer }}" - SA_CONTAINER_PATH_PREFIX="${{ variables.vertical }}/${TIMESTAMP}" - AZURE_STORAGE_KEY=$(az storage account keys list --resource-group "$SA_RG" --account-name "$SA_NAME" --query "[0].value" --output tsv) - az storage blob upload-batch --destination "${SA_CONTAINER_NAME}" --account-name "${SA_NAME}" --destination-path "${SA_CONTAINER_PATH_PREFIX}" --source "${DIR_SRC}" - else - echo "No 'test-results' directory found" - fi + - script: pnpm run e2e:playwright:chromium + displayName: "Run playwright tests" + env: + CI: "true" + - task: AzureCLI@2 + displayName: "Copy Playwright Results to Storage" + condition: succeededOrFailed() + inputs: + azureSubscription: $(serviceConnectionName) + scriptType: bash + scriptLocation: inlineScript + inlineScript: | + if [ ! $(which az 2> /dev/null) ]; then echo “ERROR: az cli not found” && exit 1; fi + DIR_SRC="${{ variables.dirResults }}" + echo "dirResults: ${{ variables.dirResults }}" + TIMESTAMP="$(date +'%Y-%m-%d %H:%M:%S')" + echo "Timestamp: ${TIMESTAMP}" + if [ -d "${DIR_SRC}" ]; then + SA_RG="${{ variables.resourceGroupName }}" + SA_NAME="${{ variables.storageAccountName }}" + SA_CONTAINER_NAME="${{ variables.storageContainer }}" + SA_CONTAINER_PATH_PREFIX="${{ variables.vertical }}/${TIMESTAMP}" + AZURE_STORAGE_KEY=$(az storage account keys list --resource-group "$SA_RG" --account-name "$SA_NAME" --query "[0].value" --output tsv) + az storage blob upload-batch --destination "${SA_CONTAINER_NAME}" --account-name "${SA_NAME}" --destination-path "${SA_CONTAINER_PATH_PREFIX}" --source "${DIR_SRC}" + else + echo "No 'test-results' directory found" + fi From 61c169b4229422d60771a368dff1eb61a672eeaf Mon Sep 17 00:00:00 2001 From: Brinda Sasikumar Date: Mon, 6 May 2024 09:51:10 -0400 Subject: [PATCH 48/81] add workpace root check --- infrastructure/.npmrc | 1 + 1 file changed, 1 insertion(+) diff --git a/infrastructure/.npmrc b/infrastructure/.npmrc index 16beaee92ab..e46c480bba5 100644 --- a/infrastructure/.npmrc +++ b/infrastructure/.npmrc @@ -1,2 +1,3 @@ registry=https://pkgs.dev.azure.com/tbs-sct/53c8b022-82b7-4031-88aa-0d1266fc3bf5/_packaging/TalentCloud_Custom_NPM_Feed/npm/registry/ always-auth=true +ignore-workspace-root-check=true From b6d25244d9bdbe54262e5386cf276bdb00a4a128 Mon Sep 17 00:00:00 2001 From: Brinda Sasikumar Date: Mon, 6 May 2024 10:29:25 -0400 Subject: [PATCH 49/81] add ignore-workspace-root-check in the root --- .npmrc | 1 + 1 file changed, 1 insertion(+) diff --git a/.npmrc b/.npmrc index fd195e66d9a..8d541502f68 100644 --- a/.npmrc +++ b/.npmrc @@ -2,3 +2,4 @@ auto-install-peers=true legacy-peer-deps=true node-linker=hoisted +ignore-workspace-root-check=true From 5006f2bdfe35bdbe5dc708cba1053851a0c1f5be Mon Sep 17 00:00:00 2001 From: Brinda Sasikumar Date: Tue, 7 May 2024 14:21:33 -0400 Subject: [PATCH 50/81] add AzureCLI task --- infrastructure/azure-pipelines-dev.yml | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/infrastructure/azure-pipelines-dev.yml b/infrastructure/azure-pipelines-dev.yml index fd8e5c7f155..a106e549095 100644 --- a/infrastructure/azure-pipelines-dev.yml +++ b/infrastructure/azure-pipelines-dev.yml @@ -53,7 +53,7 @@ stages: dependsOn: Build variables: - name: npm_config_user_config - value: "$(System.DefaultWorkingDirectory)/infrastructure/.npmrc" + value: "$(System.DefaultWorkingDirectory)/.npmrc" - name: dirResults value: "$(System.DefaultWorkingDirectory)/apps/playwright/test-results" - name: resourceGroupName @@ -79,6 +79,18 @@ stages: inputs: artifactName: gcDigitalTalent downloadPath: $(System.DefaultWorkingDirectory)/artifacts + - task: AzureCLI@2 + displayName: "Update NPMRC Config" + inputs: + scriptType: bash + scriptLocation: inlineScript + azureSubscription: $(serviceConnectionName) + inlineScript: | + NPMRC_FILE="${{ variables.npm_config_user_config }}" + echo "Editing .npmrc: ${NPMRC_FILE}" + echo "registry= + https://pkgs.dev.azure.com/tbs-sct/53c8b022-82b7-4031-88aa-0d1266fc3bf5/_packaging/TalentCloud_Custom_NPM_Feed/npm/registry/ + always-auth=true" >> "${NPMRC_FILE} - task: npmAuthenticate@0 displayName: "00 - NPM Authenticate" name: "NPM_Authenticate" From 0c64a4ca3c51312cb2dab4ee475a682208997e71 Mon Sep 17 00:00:00 2001 From: Brinda Sasikumar Date: Tue, 7 May 2024 15:26:33 -0400 Subject: [PATCH 51/81] fix quotes --- infrastructure/azure-pipelines-dev.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/infrastructure/azure-pipelines-dev.yml b/infrastructure/azure-pipelines-dev.yml index a106e549095..0fc3b187c99 100644 --- a/infrastructure/azure-pipelines-dev.yml +++ b/infrastructure/azure-pipelines-dev.yml @@ -90,7 +90,7 @@ stages: echo "Editing .npmrc: ${NPMRC_FILE}" echo "registry= https://pkgs.dev.azure.com/tbs-sct/53c8b022-82b7-4031-88aa-0d1266fc3bf5/_packaging/TalentCloud_Custom_NPM_Feed/npm/registry/ - always-auth=true" >> "${NPMRC_FILE} + always-auth=true" >> "${NPMRC_FILE}" - task: npmAuthenticate@0 displayName: "00 - NPM Authenticate" name: "NPM_Authenticate" From 20db718fe8f6701af323dc62ed5bddf1e622b5bc Mon Sep 17 00:00:00 2001 From: Brinda Sasikumar Date: Wed, 8 May 2024 07:47:52 -0400 Subject: [PATCH 52/81] fix formatting --- infrastructure/azure-pipelines-dev.yml | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/infrastructure/azure-pipelines-dev.yml b/infrastructure/azure-pipelines-dev.yml index 0fc3b187c99..75f300a97ec 100644 --- a/infrastructure/azure-pipelines-dev.yml +++ b/infrastructure/azure-pipelines-dev.yml @@ -88,8 +88,7 @@ stages: inlineScript: | NPMRC_FILE="${{ variables.npm_config_user_config }}" echo "Editing .npmrc: ${NPMRC_FILE}" - echo "registry= - https://pkgs.dev.azure.com/tbs-sct/53c8b022-82b7-4031-88aa-0d1266fc3bf5/_packaging/TalentCloud_Custom_NPM_Feed/npm/registry/ + echo "registry=https://pkgs.dev.azure.com/tbs-sct/53c8b022-82b7-4031-88aa-0d1266fc3bf5/_packaging/TalentCloud_Custom_NPM_Feed/npm/registry/ always-auth=true" >> "${NPMRC_FILE}" - task: npmAuthenticate@0 displayName: "00 - NPM Authenticate" From 144efec69bbef1a141b132bdce559d14847bf3d6 Mon Sep 17 00:00:00 2001 From: Brinda Sasikumar Date: Wed, 8 May 2024 11:01:59 -0400 Subject: [PATCH 53/81] fix url --- infrastructure/azure-pipelines-dev.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/infrastructure/azure-pipelines-dev.yml b/infrastructure/azure-pipelines-dev.yml index 75f300a97ec..f0e0c72d929 100644 --- a/infrastructure/azure-pipelines-dev.yml +++ b/infrastructure/azure-pipelines-dev.yml @@ -88,7 +88,7 @@ stages: inlineScript: | NPMRC_FILE="${{ variables.npm_config_user_config }}" echo "Editing .npmrc: ${NPMRC_FILE}" - echo "registry=https://pkgs.dev.azure.com/tbs-sct/53c8b022-82b7-4031-88aa-0d1266fc3bf5/_packaging/TalentCloud_Custom_NPM_Feed/npm/registry/ + echo "registry=https://pkgs.dev.azure.com/tbs-sct/_packaging/TBS_Custom_Npm_Feed/npm/registry/ always-auth=true" >> "${NPMRC_FILE}" - task: npmAuthenticate@0 displayName: "00 - NPM Authenticate" From bf70aa24a823f545a9e22347017ea8f5b880f756 Mon Sep 17 00:00:00 2001 From: Brinda Sasikumar Date: Wed, 8 May 2024 12:54:11 -0400 Subject: [PATCH 54/81] no optional --- infrastructure/azure-pipelines-dev.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/infrastructure/azure-pipelines-dev.yml b/infrastructure/azure-pipelines-dev.yml index f0e0c72d929..40b4300e19f 100644 --- a/infrastructure/azure-pipelines-dev.yml +++ b/infrastructure/azure-pipelines-dev.yml @@ -102,7 +102,7 @@ stages: - script: CYPRESS_INSTALL_BINARY=/opt/cypress.zip pnpm install cypress displayName: "Install Cypress" - - script: pnpm install --dev + - script: pnpm install --no-optional displayName: "Install Node.js dependencies" - script: pnpm run build:packages From caece8fba66395566d1f80a06e5de4843a0e3931 Mon Sep 17 00:00:00 2001 From: Brinda Sasikumar Date: Wed, 8 May 2024 13:13:09 -0400 Subject: [PATCH 55/81] no-frozen-lockfile --- infrastructure/azure-pipelines-dev.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/infrastructure/azure-pipelines-dev.yml b/infrastructure/azure-pipelines-dev.yml index 40b4300e19f..e7ca82b3be6 100644 --- a/infrastructure/azure-pipelines-dev.yml +++ b/infrastructure/azure-pipelines-dev.yml @@ -102,7 +102,7 @@ stages: - script: CYPRESS_INSTALL_BINARY=/opt/cypress.zip pnpm install cypress displayName: "Install Cypress" - - script: pnpm install --no-optional + - script: pnpm install --no-frozen-lockfile displayName: "Install Node.js dependencies" - script: pnpm run build:packages From ecd96143d451f197594af432e53f75704aba4036 Mon Sep 17 00:00:00 2001 From: Brinda Sasikumar Date: Wed, 8 May 2024 13:28:13 -0400 Subject: [PATCH 56/81] pnpm run build --- infrastructure/azure-pipelines-dev.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/infrastructure/azure-pipelines-dev.yml b/infrastructure/azure-pipelines-dev.yml index e7ca82b3be6..31cb7931e7b 100644 --- a/infrastructure/azure-pipelines-dev.yml +++ b/infrastructure/azure-pipelines-dev.yml @@ -105,7 +105,7 @@ stages: - script: pnpm install --no-frozen-lockfile displayName: "Install Node.js dependencies" - - script: pnpm run build:packages + - script: pnpm run build displayName: "Build dependencies" - script: npx playwright install From 6ff4c10535183d1a3b30afaecd30674bf500d861 Mon Sep 17 00:00:00 2001 From: Brinda Sasikumar Date: Wed, 8 May 2024 13:56:06 -0400 Subject: [PATCH 57/81] always upload the results --- infrastructure/azure-pipelines-dev.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/infrastructure/azure-pipelines-dev.yml b/infrastructure/azure-pipelines-dev.yml index 31cb7931e7b..c7824d309e2 100644 --- a/infrastructure/azure-pipelines-dev.yml +++ b/infrastructure/azure-pipelines-dev.yml @@ -117,7 +117,7 @@ stages: CI: "true" - task: AzureCLI@2 displayName: "Copy Playwright Results to Storage" - condition: succeededOrFailed() + condition: always() inputs: azureSubscription: $(serviceConnectionName) scriptType: bash From 2d2fba82ac1474c069eaffd02c439471f052b93a Mon Sep 17 00:00:00 2001 From: Brinda Sasikumar Date: Thu, 9 May 2024 10:15:16 -0400 Subject: [PATCH 58/81] fix linting --- apps/playwright/utils/auth.ts | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/apps/playwright/utils/auth.ts b/apps/playwright/utils/auth.ts index c7a64ac98c1..303121c5db3 100644 --- a/apps/playwright/utils/auth.ts +++ b/apps/playwright/utils/auth.ts @@ -51,7 +51,6 @@ export async function loginByGCKeySignIn( page: Page, // page object username: string, password: string, - sub?: string, ) { await page.goto("/login-info"); await page @@ -66,8 +65,6 @@ export async function loginByGCKeySignIn( await page.waitForURL("**/applicant/profile-and-applications"); } - - /** * Attempt to login by sub and fallback to loginByGckeySignIn if it fails * @@ -88,9 +85,8 @@ export async function login( if (process.env.baseURL === "http://localhost:8000") { await loginBySub(page, sub); } else { - await loginByGCKeySignIn(page, username, password, sub); + await loginByGCKeySignIn(page, username, password); } - } export type AuthCookies = { From 824cc35ae35c46d33abbd068156af45a8af6d688 Mon Sep 17 00:00:00 2001 From: Brinda Sasikumar Date: Thu, 9 May 2024 10:18:02 -0400 Subject: [PATCH 59/81] revert unnecessary changes --- infrastructure/azure-pipelines-dev.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/infrastructure/azure-pipelines-dev.yml b/infrastructure/azure-pipelines-dev.yml index c7824d309e2..6fad1362f78 100644 --- a/infrastructure/azure-pipelines-dev.yml +++ b/infrastructure/azure-pipelines-dev.yml @@ -25,6 +25,7 @@ stages: - script: infrastructure/bin/set_php_versions.sh ${{ variables.phpVersion }} displayName: "PHP version" + # -d option to install dev dependencies and -r option to specify the root directory - script: infrastructure/bin/deploy.sh -d -r $(System.DefaultWorkingDirectory) displayName: Dependencies env: From 9d56208dd10527beed1dbc2b90095b74e8e1b6d3 Mon Sep 17 00:00:00 2001 From: Brinda Sasikumar Date: Thu, 23 May 2024 09:55:42 -0400 Subject: [PATCH 60/81] remove cypress installation --- infrastructure/azure-pipelines-dev.yml | 3 --- 1 file changed, 3 deletions(-) diff --git a/infrastructure/azure-pipelines-dev.yml b/infrastructure/azure-pipelines-dev.yml index 6fad1362f78..86c27758f75 100644 --- a/infrastructure/azure-pipelines-dev.yml +++ b/infrastructure/azure-pipelines-dev.yml @@ -100,9 +100,6 @@ stages: - script: echo ##vso[task.setvariable variable=NPM_CONFIG_USERCONFIG]$(npm_config_user_config) displayName: "Set Custom .npmrc Location" - - script: CYPRESS_INSTALL_BINARY=/opt/cypress.zip pnpm install cypress - displayName: "Install Cypress" - - script: pnpm install --no-frozen-lockfile displayName: "Install Node.js dependencies" From d448b485ea75f8e4dc17f4dbc1ef5d2c3a3fc6b0 Mon Sep 17 00:00:00 2001 From: Brinda Sasikumar Date: Thu, 23 May 2024 10:05:00 -0400 Subject: [PATCH 61/81] read the base url from env var --- apps/playwright/playwright.config.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/apps/playwright/playwright.config.ts b/apps/playwright/playwright.config.ts index c7231a40c74..3ef678dbf78 100644 --- a/apps/playwright/playwright.config.ts +++ b/apps/playwright/playwright.config.ts @@ -28,7 +28,7 @@ export default defineConfig({ /* Shared settings for all the projects below. See https://playwright.dev/docs/api/class-testoptions. */ use: { /* Base URL to use in actions like `await page.goto('/')`. */ - baseURL: "https://dev-talentcloud.tbs-sct.gc.ca", + baseURL: process.env.BASE_URL ?? "http://localhost:3000", /* Collect trace when retrying the failed test. See https://playwright.dev/docs/trace-viewer */ trace: "retain-on-failure", From d00e8b8ce44d6507aaf0a89af67fac6f6537dd46 Mon Sep 17 00:00:00 2001 From: Brinda Sasikumar Date: Thu, 23 May 2024 10:31:31 -0400 Subject: [PATCH 62/81] add base url as dev pipeline env var --- infrastructure/azure-pipelines-dev.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/infrastructure/azure-pipelines-dev.yml b/infrastructure/azure-pipelines-dev.yml index 7a63c6fbae1..f2ba941b52a 100644 --- a/infrastructure/azure-pipelines-dev.yml +++ b/infrastructure/azure-pipelines-dev.yml @@ -113,6 +113,7 @@ stages: displayName: "Run playwright tests" env: CI: "true" + BASE_URL: "https://dev-talentcloud.tbs-sct.gc.ca" - task: AzureCLI@2 displayName: "Copy Playwright Results to Storage" condition: always() From 06ec9d0b44fb2846dc421a74ab90b5dabdca25d8 Mon Sep 17 00:00:00 2001 From: Brinda Sasikumar Date: Thu, 23 May 2024 10:47:33 -0400 Subject: [PATCH 63/81] Revert "remove cypress installation" This reverts commit 9d56208dd10527beed1dbc2b90095b74e8e1b6d3. --- infrastructure/azure-pipelines-dev.yml | 3 +++ 1 file changed, 3 insertions(+) diff --git a/infrastructure/azure-pipelines-dev.yml b/infrastructure/azure-pipelines-dev.yml index f2ba941b52a..41170a643d7 100644 --- a/infrastructure/azure-pipelines-dev.yml +++ b/infrastructure/azure-pipelines-dev.yml @@ -100,6 +100,9 @@ stages: - script: echo ##vso[task.setvariable variable=NPM_CONFIG_USERCONFIG]$(npm_config_user_config) displayName: "Set Custom .npmrc Location" + - script: CYPRESS_INSTALL_BINARY=/opt/cypress.zip pnpm install cypress + displayName: "Install Cypress" + - script: pnpm install --no-frozen-lockfile displayName: "Install Node.js dependencies" From fc06d033b2347372c9eafd668cb9b83ad3d28f05 Mon Sep 17 00:00:00 2001 From: Brinda Sasikumar Date: Fri, 24 May 2024 10:47:50 -0400 Subject: [PATCH 64/81] fix port --- apps/playwright/playwright.config.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/apps/playwright/playwright.config.ts b/apps/playwright/playwright.config.ts index 3ef678dbf78..3dab1b3ef84 100644 --- a/apps/playwright/playwright.config.ts +++ b/apps/playwright/playwright.config.ts @@ -28,7 +28,7 @@ export default defineConfig({ /* Shared settings for all the projects below. See https://playwright.dev/docs/api/class-testoptions. */ use: { /* Base URL to use in actions like `await page.goto('/')`. */ - baseURL: process.env.BASE_URL ?? "http://localhost:3000", + baseURL: process.env.BASE_URL ?? "http://localhost:8000", /* Collect trace when retrying the failed test. See https://playwright.dev/docs/trace-viewer */ trace: "retain-on-failure", From 45953aadf0a008c25185987640f3ea68f9ad15df Mon Sep 17 00:00:00 2001 From: Brinda Sasikumar Date: Fri, 24 May 2024 10:59:57 -0400 Subject: [PATCH 65/81] fix playwright --- apps/playwright/global.setup.ts | 16 +++------------- 1 file changed, 3 insertions(+), 13 deletions(-) diff --git a/apps/playwright/global.setup.ts b/apps/playwright/global.setup.ts index 2753fde097e..d594b72b0bb 100644 --- a/apps/playwright/global.setup.ts +++ b/apps/playwright/global.setup.ts @@ -1,24 +1,14 @@ import { test as setup } from "@playwright/test"; import auth from "~/constants/auth"; -import { login } from "~/utils/auth"; +import { loginBySub } from "~/utils/auth"; setup("authenticate as admin", async ({ page }) => { - await login( - page, - "admin@test.com", - process.env.ADMIN_USER_NAME, - process.env.ADMIN_USER_PASSWORD, - ); + await loginBySub(page, "admin@test.com"); await page.context().storageState({ path: auth.STATE.ADMIN }); }); setup("authenticate as applicant", async ({ page }) => { - await login( - page, - "applicant@test.com", - process.env.APPLICANT_USER_NAME, - process.env.APPLICANT_USER_PASSWORD, - ); + await loginBySub(page, "applicant@test.com"); await page.context().storageState({ path: auth.STATE.APPLICANT }); }); From 487e21fad6c032013dfb5b07a1456b0cdd156ba0 Mon Sep 17 00:00:00 2001 From: Brinda Sasikumar Date: Fri, 24 May 2024 14:10:48 -0400 Subject: [PATCH 66/81] try remove cypress again --- infrastructure/azure-pipelines-dev.yml | 3 --- 1 file changed, 3 deletions(-) diff --git a/infrastructure/azure-pipelines-dev.yml b/infrastructure/azure-pipelines-dev.yml index 41170a643d7..f2ba941b52a 100644 --- a/infrastructure/azure-pipelines-dev.yml +++ b/infrastructure/azure-pipelines-dev.yml @@ -100,9 +100,6 @@ stages: - script: echo ##vso[task.setvariable variable=NPM_CONFIG_USERCONFIG]$(npm_config_user_config) displayName: "Set Custom .npmrc Location" - - script: CYPRESS_INSTALL_BINARY=/opt/cypress.zip pnpm install cypress - displayName: "Install Cypress" - - script: pnpm install --no-frozen-lockfile displayName: "Install Node.js dependencies" From 0ebdab19901fd091ad6552c4a0c796c1a891fdae Mon Sep 17 00:00:00 2001 From: Brinda Sasikumar Date: Fri, 24 May 2024 14:41:46 -0400 Subject: [PATCH 67/81] add cypress --- infrastructure/azure-pipelines-dev.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/infrastructure/azure-pipelines-dev.yml b/infrastructure/azure-pipelines-dev.yml index f2ba941b52a..47ce91df6b3 100644 --- a/infrastructure/azure-pipelines-dev.yml +++ b/infrastructure/azure-pipelines-dev.yml @@ -34,7 +34,7 @@ stages: API_PROTECTED_URI: /admin/graphql # We don't need Cypress in this environment, and so this avoid permission errors of installing it. # See: https://docs.cypress.io/guides/getting-started/installing-cypress#Skipping-installation - CYPRESS_INSTALL_BINARY: 0 + CYPRESS_INSTALL_BINARY: "/opt/cypress/13.10.0/cypress.zip" - task: ArchiveFiles@2 displayName: "Archive Files" From 34f1ec6bd9bee60460f2f85b7daf5c8eed56505a Mon Sep 17 00:00:00 2001 From: Brinda Sasikumar Date: Fri, 24 May 2024 14:46:45 -0400 Subject: [PATCH 68/81] Revert "try remove cypress again" This reverts commit 487e21fad6c032013dfb5b07a1456b0cdd156ba0. --- infrastructure/azure-pipelines-dev.yml | 3 +++ 1 file changed, 3 insertions(+) diff --git a/infrastructure/azure-pipelines-dev.yml b/infrastructure/azure-pipelines-dev.yml index 47ce91df6b3..17769fe9132 100644 --- a/infrastructure/azure-pipelines-dev.yml +++ b/infrastructure/azure-pipelines-dev.yml @@ -100,6 +100,9 @@ stages: - script: echo ##vso[task.setvariable variable=NPM_CONFIG_USERCONFIG]$(npm_config_user_config) displayName: "Set Custom .npmrc Location" + - script: CYPRESS_INSTALL_BINARY=/opt/cypress.zip pnpm install cypress + displayName: "Install Cypress" + - script: pnpm install --no-frozen-lockfile displayName: "Install Node.js dependencies" From ba0a6b26d9c181e1d594a6dcda5ce99a839268fc Mon Sep 17 00:00:00 2001 From: Brinda Sasikumar Date: Fri, 24 May 2024 15:06:50 -0400 Subject: [PATCH 69/81] Revert "add cypress" This reverts commit 0ebdab19901fd091ad6552c4a0c796c1a891fdae. --- infrastructure/azure-pipelines-dev.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/infrastructure/azure-pipelines-dev.yml b/infrastructure/azure-pipelines-dev.yml index 17769fe9132..41170a643d7 100644 --- a/infrastructure/azure-pipelines-dev.yml +++ b/infrastructure/azure-pipelines-dev.yml @@ -34,7 +34,7 @@ stages: API_PROTECTED_URI: /admin/graphql # We don't need Cypress in this environment, and so this avoid permission errors of installing it. # See: https://docs.cypress.io/guides/getting-started/installing-cypress#Skipping-installation - CYPRESS_INSTALL_BINARY: "/opt/cypress/13.10.0/cypress.zip" + CYPRESS_INSTALL_BINARY: 0 - task: ArchiveFiles@2 displayName: "Archive Files" From e9a1ac4d2edb48e169b41a1aae176f23c2a335ec Mon Sep 17 00:00:00 2001 From: Brinda Sasikumar Date: Fri, 24 May 2024 15:08:25 -0400 Subject: [PATCH 70/81] Update azure-pipelines-dev.yml for Azure Pipelines --- infrastructure/azure-pipelines-dev.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/infrastructure/azure-pipelines-dev.yml b/infrastructure/azure-pipelines-dev.yml index 41170a643d7..db66877cd21 100644 --- a/infrastructure/azure-pipelines-dev.yml +++ b/infrastructure/azure-pipelines-dev.yml @@ -100,7 +100,7 @@ stages: - script: echo ##vso[task.setvariable variable=NPM_CONFIG_USERCONFIG]$(npm_config_user_config) displayName: "Set Custom .npmrc Location" - - script: CYPRESS_INSTALL_BINARY=/opt/cypress.zip pnpm install cypress + - script: CYPRESS_INSTALL_BINARY=/opt/cypress/13.10.0/cypress.zip pnpm install cypress displayName: "Install Cypress" - script: pnpm install --no-frozen-lockfile From 46c21cdda3c44927d42ad80eaec88c76b1368a25 Mon Sep 17 00:00:00 2001 From: Brinda Sasikumar Date: Fri, 24 May 2024 16:01:07 -0400 Subject: [PATCH 71/81] Update azure-pipelines-dev.yml for Azure Pipelines --- infrastructure/azure-pipelines-dev.yml | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/infrastructure/azure-pipelines-dev.yml b/infrastructure/azure-pipelines-dev.yml index db66877cd21..d4151e76700 100644 --- a/infrastructure/azure-pipelines-dev.yml +++ b/infrastructure/azure-pipelines-dev.yml @@ -100,10 +100,7 @@ stages: - script: echo ##vso[task.setvariable variable=NPM_CONFIG_USERCONFIG]$(npm_config_user_config) displayName: "Set Custom .npmrc Location" - - script: CYPRESS_INSTALL_BINARY=/opt/cypress/13.10.0/cypress.zip pnpm install cypress - displayName: "Install Cypress" - - - script: pnpm install --no-frozen-lockfile + - script: pnpm install --no-frozen-lockfile --production displayName: "Install Node.js dependencies" - script: pnpm run build From 0c354530ead052ea90a374757a97aa0dcb8361a3 Mon Sep 17 00:00:00 2001 From: Brinda Sasikumar Date: Fri, 24 May 2024 16:15:49 -0400 Subject: [PATCH 72/81] Revert "Update azure-pipelines-dev.yml for Azure Pipelines" This reverts commit 46c21cdda3c44927d42ad80eaec88c76b1368a25. --- infrastructure/azure-pipelines-dev.yml | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/infrastructure/azure-pipelines-dev.yml b/infrastructure/azure-pipelines-dev.yml index d4151e76700..db66877cd21 100644 --- a/infrastructure/azure-pipelines-dev.yml +++ b/infrastructure/azure-pipelines-dev.yml @@ -100,7 +100,10 @@ stages: - script: echo ##vso[task.setvariable variable=NPM_CONFIG_USERCONFIG]$(npm_config_user_config) displayName: "Set Custom .npmrc Location" - - script: pnpm install --no-frozen-lockfile --production + - script: CYPRESS_INSTALL_BINARY=/opt/cypress/13.10.0/cypress.zip pnpm install cypress + displayName: "Install Cypress" + + - script: pnpm install --no-frozen-lockfile displayName: "Install Node.js dependencies" - script: pnpm run build From 9daa6f135660b81bd864a26ff581d15f9d1af794 Mon Sep 17 00:00:00 2001 From: Brinda Sasikumar Date: Mon, 27 May 2024 12:15:46 -0400 Subject: [PATCH 73/81] Update azure-pipelines-dev.yml for Azure Pipelines --- infrastructure/azure-pipelines-dev.yml | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/infrastructure/azure-pipelines-dev.yml b/infrastructure/azure-pipelines-dev.yml index db66877cd21..578cfe3b22a 100644 --- a/infrastructure/azure-pipelines-dev.yml +++ b/infrastructure/azure-pipelines-dev.yml @@ -89,8 +89,7 @@ stages: inlineScript: | NPMRC_FILE="${{ variables.npm_config_user_config }}" echo "Editing .npmrc: ${NPMRC_FILE}" - echo "registry=https://pkgs.dev.azure.com/tbs-sct/_packaging/TBS_Custom_Npm_Feed/npm/registry/ - always-auth=true" >> "${NPMRC_FILE}" + echo "registry=https://pkgs.dev.azure.com/tbs-sct/53c8b022-82b7-4031-88aa-0d1266fc3bf5/_packaging/TalentCloud_Custom_NPM_Feed/npm/registry/" >> "${NPMRC_FILE}" - task: npmAuthenticate@0 displayName: "00 - NPM Authenticate" name: "NPM_Authenticate" From 697badb45cb8131629d6400e4bd560b0961e3432 Mon Sep 17 00:00:00 2001 From: Brinda Sasikumar Date: Mon, 27 May 2024 15:05:04 -0400 Subject: [PATCH 74/81] increase time out --- infrastructure/azure-pipelines-dev.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/infrastructure/azure-pipelines-dev.yml b/infrastructure/azure-pipelines-dev.yml index 578cfe3b22a..4906042c92b 100644 --- a/infrastructure/azure-pipelines-dev.yml +++ b/infrastructure/azure-pipelines-dev.yml @@ -68,7 +68,7 @@ stages: jobs: - job: run_playwright_tests displayName: Run Playwright tests - timeoutInMinutes: 10 + timeoutInMinutes: 30 pool: name: "TBS Linux Self Hosted" steps: From f44b406177b09e61e2446e336074600cfea9735a Mon Sep 17 00:00:00 2001 From: Brinda Sasikumar Date: Mon, 27 May 2024 15:51:02 -0400 Subject: [PATCH 75/81] Revert "attempt to refactor the tests to accommodate GCKey sign in" This reverts commit 56215f6d4db51f7928d15c9385e225ba5ef06893. --- apps/playwright/.env.example | 4 --- apps/playwright/utils/auth.ts | 53 ----------------------------------- 2 files changed, 57 deletions(-) diff --git a/apps/playwright/.env.example b/apps/playwright/.env.example index 0ca8a42df0a..dd7f2db60ea 100644 --- a/apps/playwright/.env.example +++ b/apps/playwright/.env.example @@ -3,7 +3,3 @@ #TEST_TIMEOUT=30000 #EXPECT_TIMEOUT=5000 #BASE_URL=http://localhost:8000 -#ADMIN_USER_NAME="" -#ADMIN_USER_PASSWORD="" -#APPLICANT_USER_NAME="" -#APPLICANT_USER_PASSWORD="" diff --git a/apps/playwright/utils/auth.ts b/apps/playwright/utils/auth.ts index 303121c5db3..6138c3b7d00 100644 --- a/apps/playwright/utils/auth.ts +++ b/apps/playwright/utils/auth.ts @@ -36,59 +36,6 @@ export async function loginBySub(page: Page, sub: string) { ); } -/** - * Login by gckey sign in using username and password - * - * Logs a user into the application - * - * @param {Page} page - * @param {String} username - * @param {String} password - * @param {String} sub // optional - * - */ -export async function loginByGCKeySignIn( - page: Page, // page object - username: string, - password: string, -) { - await page.goto("/login-info"); - await page - .getByRole("link", { name: /continue to gckey and sign in/i }) - .first() - .click(); - await page.getByPlaceholder("Username").fill(username); - await page.getByPlaceholder("Password").fill(password); - await page - .getByRole("button", { name: /Connect to the GCKey Service/i }) - .click(); - await page.waitForURL("**/applicant/profile-and-applications"); -} - -/** - * Attempt to login by sub and fallback to loginByGckeySignIn if it fails - * - * @param {Page} page - * @param {String} sub - * @param {String} username - * @param {String} password - */ -export async function login( - page: Page, - sub: string, - username: string, - password: string, -) { - // check process.env.baseURL to determine if it is a local or remote environment - // if it is a local environment, use loginBySub - // if it is a remote environment, use loginByGckeySignIn - if (process.env.baseURL === "http://localhost:8000") { - await loginBySub(page, sub); - } else { - await loginByGCKeySignIn(page, username, password); - } -} - export type AuthCookies = { apiSession?: Cookie; xsrf?: Cookie; From 8eddc6a76646ce68e180e3b28559c145df05afbf Mon Sep 17 00:00:00 2001 From: Brinda Sasikumar Date: Mon, 27 May 2024 15:51:47 -0400 Subject: [PATCH 76/81] set time out to 15min --- infrastructure/azure-pipelines-dev.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/infrastructure/azure-pipelines-dev.yml b/infrastructure/azure-pipelines-dev.yml index 4906042c92b..954ba2ec00c 100644 --- a/infrastructure/azure-pipelines-dev.yml +++ b/infrastructure/azure-pipelines-dev.yml @@ -68,7 +68,7 @@ stages: jobs: - job: run_playwright_tests displayName: Run Playwright tests - timeoutInMinutes: 30 + timeoutInMinutes: 15 pool: name: "TBS Linux Self Hosted" steps: From ef0e6133c9d01f6d225b2d19329d664d35ab92a9 Mon Sep 17 00:00:00 2001 From: Brinda Sasikumar Date: Mon, 27 May 2024 16:54:10 -0400 Subject: [PATCH 77/81] increase time out --- infrastructure/azure-pipelines-dev.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/infrastructure/azure-pipelines-dev.yml b/infrastructure/azure-pipelines-dev.yml index 954ba2ec00c..b8273518e49 100644 --- a/infrastructure/azure-pipelines-dev.yml +++ b/infrastructure/azure-pipelines-dev.yml @@ -68,7 +68,7 @@ stages: jobs: - job: run_playwright_tests displayName: Run Playwright tests - timeoutInMinutes: 15 + timeoutInMinutes: 20 pool: name: "TBS Linux Self Hosted" steps: From 69a2b2b73f1318e0cdfc154d0a78a9d9341b7c25 Mon Sep 17 00:00:00 2001 From: Brinda Sasikumar Date: Tue, 28 May 2024 09:15:02 -0400 Subject: [PATCH 78/81] get back to 30 mins time out --- infrastructure/azure-pipelines-dev.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/infrastructure/azure-pipelines-dev.yml b/infrastructure/azure-pipelines-dev.yml index b8273518e49..4906042c92b 100644 --- a/infrastructure/azure-pipelines-dev.yml +++ b/infrastructure/azure-pipelines-dev.yml @@ -68,7 +68,7 @@ stages: jobs: - job: run_playwright_tests displayName: Run Playwright tests - timeoutInMinutes: 20 + timeoutInMinutes: 30 pool: name: "TBS Linux Self Hosted" steps: From b86d62f686f0127f8a4be88a023a130c4828d6a8 Mon Sep 17 00:00:00 2001 From: Brinda Sasikumar Date: Wed, 29 May 2024 15:29:15 -0400 Subject: [PATCH 79/81] disconnect build stage --- infrastructure/azure-pipelines-dev.yml | 8 -------- 1 file changed, 8 deletions(-) diff --git a/infrastructure/azure-pipelines-dev.yml b/infrastructure/azure-pipelines-dev.yml index 4906042c92b..cd0662eb15e 100644 --- a/infrastructure/azure-pipelines-dev.yml +++ b/infrastructure/azure-pipelines-dev.yml @@ -51,7 +51,6 @@ stages: pool: name: "TBS Linux Self Hosted" displayName: Test stage - dependsOn: Build variables: - name: npm_config_user_config value: "$(System.DefaultWorkingDirectory)/.npmrc" @@ -76,10 +75,6 @@ stages: clean: true fetchDepth: 1 - - task: DownloadBuildArtifacts@0 - inputs: - artifactName: gcDigitalTalent - downloadPath: $(System.DefaultWorkingDirectory)/artifacts - task: AzureCLI@2 displayName: "Update NPMRC Config" inputs: @@ -105,9 +100,6 @@ stages: - script: pnpm install --no-frozen-lockfile displayName: "Install Node.js dependencies" - - script: pnpm run build - displayName: "Build dependencies" - - script: npx playwright install displayName: "Install Playwright browsers" From de72f21db6cf646987c308d937b167279c758151 Mon Sep 17 00:00:00 2001 From: Brinda Sasikumar Date: Wed, 29 May 2024 16:25:03 -0400 Subject: [PATCH 80/81] put back the build dep step --- infrastructure/azure-pipelines-dev.yml | 3 +++ 1 file changed, 3 insertions(+) diff --git a/infrastructure/azure-pipelines-dev.yml b/infrastructure/azure-pipelines-dev.yml index cd0662eb15e..39c26ff4213 100644 --- a/infrastructure/azure-pipelines-dev.yml +++ b/infrastructure/azure-pipelines-dev.yml @@ -100,6 +100,9 @@ stages: - script: pnpm install --no-frozen-lockfile displayName: "Install Node.js dependencies" + - script: pnpm run build + displayName: "Build dependencies" + - script: npx playwright install displayName: "Install Playwright browsers" From 53d7f44b00cc93c53eea97403cd94d97ef68195f Mon Sep 17 00:00:00 2001 From: Brinda Sasikumar Date: Wed, 29 May 2024 17:02:51 -0400 Subject: [PATCH 81/81] remove stages --- infrastructure/azure-pipelines-dev.yml | 187 +++++++++---------------- 1 file changed, 69 insertions(+), 118 deletions(-) diff --git a/infrastructure/azure-pipelines-dev.yml b/infrastructure/azure-pipelines-dev.yml index 39c26ff4213..18e1fcc96c5 100644 --- a/infrastructure/azure-pipelines-dev.yml +++ b/infrastructure/azure-pipelines-dev.yml @@ -9,128 +9,79 @@ resources: variables: phpVersion: "8.2" serviceConnectionName: "Talent Cloud Service Connection" -stages: - - stage: Build - displayName: Build stage - jobs: - - job: build_artifact - displayName: Build artifact - pool: - vmImage: ubuntu-22.04 - steps: - - checkout: self - clean: true - fetchDepth: 1 + npm_config_user_config: "$(System.DefaultWorkingDirectory)/.npmrc" + dirResults: "$(System.DefaultWorkingDirectory)/apps/playwright/test-results" + resourceGroupName: "rg_tbs_talent_2_PaaS" + vertical: "dev" + storageAccountName: "sttalclddevcacstdl" + storageContainer: "playwright-results" +pool: + name: "TBS Linux Self Hosted" +jobs: + - job: run_playwright_tests + displayName: Run Playwright tests + timeoutInMinutes: 30 + steps: + - checkout: self + clean: true + fetchDepth: 1 - - script: infrastructure/bin/set_php_versions.sh ${{ variables.phpVersion }} - displayName: "PHP version" + - task: AzureCLI@2 + displayName: "Update NPMRC Config" + inputs: + scriptType: bash + scriptLocation: inlineScript + azureSubscription: $(serviceConnectionName) + inlineScript: | + NPMRC_FILE="${{ variables.npm_config_user_config }}" + echo "Editing .npmrc: ${NPMRC_FILE}" + echo "registry=https://pkgs.dev.azure.com/tbs-sct/53c8b022-82b7-4031-88aa-0d1266fc3bf5/_packaging/TalentCloud_Custom_NPM_Feed/npm/registry/" >> "${NPMRC_FILE}" + - task: npmAuthenticate@0 + displayName: "00 - NPM Authenticate" + name: "NPM_Authenticate" + inputs: + workingFile: $(npm_config_user_config) - # -d option to install dev dependencies and -r option to specify the root directory - - script: infrastructure/bin/deploy.sh -d -r $(System.DefaultWorkingDirectory) - displayName: Dependencies - env: - API_URI: /graphql - ADMIN_APP_DIR: /admin - API_PROTECTED_URI: /admin/graphql - # We don't need Cypress in this environment, and so this avoid permission errors of installing it. - # See: https://docs.cypress.io/guides/getting-started/installing-cypress#Skipping-installation - CYPRESS_INSTALL_BINARY: 0 + - script: echo ##vso[task.setvariable variable=NPM_CONFIG_USERCONFIG]$(npm_config_user_config) + displayName: "Set Custom .npmrc Location" - - task: ArchiveFiles@2 - displayName: "Archive Files" - inputs: - rootFolderOrFile: $(System.DefaultWorkingDirectory) - includeRootFolder: false - archiveFile: "$(Build.ArtifactStagingDirectory)/Application_$(Build.BuildId).zip" + - script: CYPRESS_INSTALL_BINARY=/opt/cypress/13.10.0/cypress.zip pnpm install cypress + displayName: "Install Cypress" - - task: PublishBuildArtifacts@1 - displayName: "Publish Artifact: gcDigitalTalent" - inputs: - ArtifactName: gcDigitalTalent - - stage: Test - pool: - name: "TBS Linux Self Hosted" - displayName: Test stage - variables: - - name: npm_config_user_config - value: "$(System.DefaultWorkingDirectory)/.npmrc" - - name: dirResults - value: "$(System.DefaultWorkingDirectory)/apps/playwright/test-results" - - name: resourceGroupName - value: "rg_tbs_talent_2_PaaS" - - name: vertical - value: "dev" - - name: storageAccountName - value: "sttalclddevcacstdl" - - name: storageContainer - value: "playwright-results" - jobs: - - job: run_playwright_tests - displayName: Run Playwright tests - timeoutInMinutes: 30 - pool: - name: "TBS Linux Self Hosted" - steps: - - checkout: self - clean: true - fetchDepth: 1 + - script: pnpm install --no-frozen-lockfile + displayName: "Install Node.js dependencies" - - task: AzureCLI@2 - displayName: "Update NPMRC Config" - inputs: - scriptType: bash - scriptLocation: inlineScript - azureSubscription: $(serviceConnectionName) - inlineScript: | - NPMRC_FILE="${{ variables.npm_config_user_config }}" - echo "Editing .npmrc: ${NPMRC_FILE}" - echo "registry=https://pkgs.dev.azure.com/tbs-sct/53c8b022-82b7-4031-88aa-0d1266fc3bf5/_packaging/TalentCloud_Custom_NPM_Feed/npm/registry/" >> "${NPMRC_FILE}" - - task: npmAuthenticate@0 - displayName: "00 - NPM Authenticate" - name: "NPM_Authenticate" - inputs: - workingFile: $(npm_config_user_config) + - script: pnpm run build + displayName: "Build dependencies" - - script: echo ##vso[task.setvariable variable=NPM_CONFIG_USERCONFIG]$(npm_config_user_config) - displayName: "Set Custom .npmrc Location" + - script: npx playwright install + displayName: "Install Playwright browsers" - - script: CYPRESS_INSTALL_BINARY=/opt/cypress/13.10.0/cypress.zip pnpm install cypress - displayName: "Install Cypress" - - - script: pnpm install --no-frozen-lockfile - displayName: "Install Node.js dependencies" - - - script: pnpm run build - displayName: "Build dependencies" - - - script: npx playwright install - displayName: "Install Playwright browsers" - - - script: pnpm run e2e:playwright:chromium - displayName: "Run playwright tests" - env: - CI: "true" - BASE_URL: "https://dev-talentcloud.tbs-sct.gc.ca" - - task: AzureCLI@2 - displayName: "Copy Playwright Results to Storage" - condition: always() - inputs: - azureSubscription: $(serviceConnectionName) - scriptType: bash - scriptLocation: inlineScript - inlineScript: | - if [ ! $(which az 2> /dev/null) ]; then echo “ERROR: az cli not found” && exit 1; fi - DIR_SRC="${{ variables.dirResults }}" - echo "dirResults: ${{ variables.dirResults }}" - TIMESTAMP="$(date +'%Y-%m-%d %H:%M:%S')" - echo "Timestamp: ${TIMESTAMP}" - if [ -d "${DIR_SRC}" ]; then - SA_RG="${{ variables.resourceGroupName }}" - SA_NAME="${{ variables.storageAccountName }}" - SA_CONTAINER_NAME="${{ variables.storageContainer }}" - SA_CONTAINER_PATH_PREFIX="${{ variables.vertical }}/${TIMESTAMP}" - AZURE_STORAGE_KEY=$(az storage account keys list --resource-group "$SA_RG" --account-name "$SA_NAME" --query "[0].value" --output tsv) - az storage blob upload-batch --destination "${SA_CONTAINER_NAME}" --account-name "${SA_NAME}" --destination-path "${SA_CONTAINER_PATH_PREFIX}" --source "${DIR_SRC}" - else - echo "No 'test-results' directory found" - fi + - script: pnpm run e2e:playwright:chromium + displayName: "Run playwright tests" + env: + CI: "true" + BASE_URL: "https://dev-talentcloud.tbs-sct.gc.ca" + - task: AzureCLI@2 + displayName: "Copy Playwright Results to Storage" + condition: always() + inputs: + azureSubscription: $(serviceConnectionName) + scriptType: bash + scriptLocation: inlineScript + inlineScript: | + if [ ! $(which az 2> /dev/null) ]; then echo “ERROR: az cli not found” && exit 1; fi + DIR_SRC="${{ variables.dirResults }}" + echo "dirResults: ${{ variables.dirResults }}" + TIMESTAMP="$(date +'%Y-%m-%d %H:%M:%S')" + echo "Timestamp: ${TIMESTAMP}" + if [ -d "${DIR_SRC}" ]; then + SA_RG="${{ variables.resourceGroupName }}" + SA_NAME="${{ variables.storageAccountName }}" + SA_CONTAINER_NAME="${{ variables.storageContainer }}" + SA_CONTAINER_PATH_PREFIX="${{ variables.vertical }}/${TIMESTAMP}" + AZURE_STORAGE_KEY=$(az storage account keys list --resource-group "$SA_RG" --account-name "$SA_NAME" --query "[0].value" --output tsv) + az storage blob upload-batch --destination "${SA_CONTAINER_NAME}" --account-name "${SA_NAME}" --destination-path "${SA_CONTAINER_PATH_PREFIX}" --source "${DIR_SRC}" + else + echo "No 'test-results' directory found" + fi