From abd7196b57fdd18c9a7d1c2232041f6ead612dac Mon Sep 17 00:00:00 2001 From: Tomas Kral Date: Sun, 10 Mar 2024 08:35:15 +0100 Subject: [PATCH 01/11] chore(ci): try timeout increase --- e2e-tests/playwright.config.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/e2e-tests/playwright.config.ts b/e2e-tests/playwright.config.ts index 8fd904430e..0f2bfe631b 100644 --- a/e2e-tests/playwright.config.ts +++ b/e2e-tests/playwright.config.ts @@ -9,7 +9,7 @@ import { defineConfig, devices } from '@playwright/test'; * See https://playwright.dev/docs/test-configuration. */ export default defineConfig({ - timeout: 60000, + timeout: 120000, testDir: './playwright', /* Run tests in files in parallel */ fullyParallel: true, From 474f285e4717fd5f65191a14e776401cb21ed27a Mon Sep 17 00:00:00 2001 From: Tomas Kral Date: Sun, 10 Mar 2024 15:01:11 +0100 Subject: [PATCH 02/11] chore(ci): upload playwright report --- .ibm/pipelines/functions.sh | 18 ++++++++++++++++-- 1 file changed, 16 insertions(+), 2 deletions(-) diff --git a/.ibm/pipelines/functions.sh b/.ibm/pipelines/functions.sh index 244e1fcacf..272a445be1 100644 --- a/.ibm/pipelines/functions.sh +++ b/.ibm/pipelines/functions.sh @@ -11,11 +11,23 @@ save_logs() { RESULT="$3" ansi2html <"/tmp/${LOGFILE}" >"/tmp/${LOGFILE}.html" - + + tar -czvf /tmp/${LOGFILE}-report.tar.gz e2e-tests/playwright-report/ + CRN=$(ibmcloud resource service-instance ${IBM_COS} --output json | jq -r .[0].guid) ibmcloud cos config crn --crn "${CRN}" ibmcloud cos upload --bucket "${IBM_BUCKET}" --key "${LOGFILE}.html" --file "/tmp/${LOGFILE}.html" --content-type "text/html; charset=UTF-8" - + ibmcloud cos upload --bucket "${IBM_BUCKET}" --key "${LOGFILE}-report.tar.gz" --file "/tmp/${LOGFILE}-report.tar.gz" --content-type "application/gzip" + + # Loop through each file in the e2e-tests/playwright-report directory + find e2e-tests/playwright-report -type f | while read FILE; do + # Extract the file path relative to the directory to maintain the structure in COS + RELATIVE_PATH=${FILE#$DIRECTORY_TO_UPLOAD} + # Upload the file + echo ibmcloud cos upload --bucket "${IBM_BUCKET}" --key "${LOGFILE}-report}/${RELATIVE_PATH}" --file "${FILE}" + done + + BASE_URL="https://s3.${IBM_REGION}.cloud-object-storage.appdomain.cloud/${IBM_BUCKET}" if [[ $RESULT == "0" ]]; then STATUS="successfully" @@ -26,6 +38,8 @@ save_logs() { cat < Date: Sun, 10 Mar 2024 15:22:56 +0100 Subject: [PATCH 03/11] chore(ci): upload playwright report --- .ibm/pipelines/functions.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.ibm/pipelines/functions.sh b/.ibm/pipelines/functions.sh index 272a445be1..e3de4e74cc 100644 --- a/.ibm/pipelines/functions.sh +++ b/.ibm/pipelines/functions.sh @@ -12,7 +12,7 @@ save_logs() { ansi2html <"/tmp/${LOGFILE}" >"/tmp/${LOGFILE}.html" - tar -czvf /tmp/${LOGFILE}-report.tar.gz e2e-tests/playwright-report/ + tar -czvf /tmp/${LOGFILE}-report.tar.gz playwright-report/ CRN=$(ibmcloud resource service-instance ${IBM_COS} --output json | jq -r .[0].guid) ibmcloud cos config crn --crn "${CRN}" @@ -20,7 +20,7 @@ save_logs() { ibmcloud cos upload --bucket "${IBM_BUCKET}" --key "${LOGFILE}-report.tar.gz" --file "/tmp/${LOGFILE}-report.tar.gz" --content-type "application/gzip" # Loop through each file in the e2e-tests/playwright-report directory - find e2e-tests/playwright-report -type f | while read FILE; do + find playwright-report -type f | while read FILE; do # Extract the file path relative to the directory to maintain the structure in COS RELATIVE_PATH=${FILE#$DIRECTORY_TO_UPLOAD} # Upload the file From 6a93279d30805da183e3be64ebc6d8f47730d484 Mon Sep 17 00:00:00 2001 From: Tomas Kral Date: Sun, 10 Mar 2024 15:39:42 +0100 Subject: [PATCH 04/11] chore(ci): revert playwright timeout --- e2e-tests/playwright.config.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/e2e-tests/playwright.config.ts b/e2e-tests/playwright.config.ts index 0f2bfe631b..8fd904430e 100644 --- a/e2e-tests/playwright.config.ts +++ b/e2e-tests/playwright.config.ts @@ -9,7 +9,7 @@ import { defineConfig, devices } from '@playwright/test'; * See https://playwright.dev/docs/test-configuration. */ export default defineConfig({ - timeout: 120000, + timeout: 60000, testDir: './playwright', /* Run tests in files in parallel */ fullyParallel: true, From eb2a99b315f1df9677543c2082f6c5068bad4fe3 Mon Sep 17 00:00:00 2001 From: Tomas Kral Date: Sun, 10 Mar 2024 15:40:03 +0100 Subject: [PATCH 05/11] chore(ci): fix report html upload --- .ibm/pipelines/functions.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.ibm/pipelines/functions.sh b/.ibm/pipelines/functions.sh index e3de4e74cc..a58bf180d8 100644 --- a/.ibm/pipelines/functions.sh +++ b/.ibm/pipelines/functions.sh @@ -24,7 +24,7 @@ save_logs() { # Extract the file path relative to the directory to maintain the structure in COS RELATIVE_PATH=${FILE#$DIRECTORY_TO_UPLOAD} # Upload the file - echo ibmcloud cos upload --bucket "${IBM_BUCKET}" --key "${LOGFILE}-report}/${RELATIVE_PATH}" --file "${FILE}" + ibmcloud cos upload --bucket "${IBM_BUCKET}" --key "${LOGFILE}-report}/${RELATIVE_PATH}" --file "${FILE}" done From 0ef88d9b7c11d729aacf1393a80f9b244bc42f9f Mon Sep 17 00:00:00 2001 From: Tomas Kral Date: Sun, 10 Mar 2024 15:59:52 +0100 Subject: [PATCH 06/11] chore(ci): fix report upload path --- .ibm/pipelines/functions.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.ibm/pipelines/functions.sh b/.ibm/pipelines/functions.sh index a58bf180d8..e49c73a15d 100644 --- a/.ibm/pipelines/functions.sh +++ b/.ibm/pipelines/functions.sh @@ -24,7 +24,7 @@ save_logs() { # Extract the file path relative to the directory to maintain the structure in COS RELATIVE_PATH=${FILE#$DIRECTORY_TO_UPLOAD} # Upload the file - ibmcloud cos upload --bucket "${IBM_BUCKET}" --key "${LOGFILE}-report}/${RELATIVE_PATH}" --file "${FILE}" + ibmcloud cos upload --bucket "${IBM_BUCKET}" --key "${LOGFILE}-report/${RELATIVE_PATH}" --file "${FILE}" done @@ -38,8 +38,8 @@ save_logs() { cat < Date: Sun, 10 Mar 2024 16:02:20 +0100 Subject: [PATCH 07/11] chore(ci): e2e: try reloading after login --- e2e-tests/playwright/utils/Common.ts | 2 ++ 1 file changed, 2 insertions(+) diff --git a/e2e-tests/playwright/utils/Common.ts b/e2e-tests/playwright/utils/Common.ts index d0b2da9c95..85eb1d4ab5 100644 --- a/e2e-tests/playwright/utils/Common.ts +++ b/e2e-tests/playwright/utils/Common.ts @@ -50,6 +50,8 @@ export class Common { await this.page.goto('/'); await this.uiHelper.clickButton('Sign In'); await this.checkAndReauthorizeGithubApp(); + // TODO: Remove this once the issue is fixed + await this.page.reload(); await this.uiHelper.waitForSideBarVisible(); } From d2b225189dcb21d66ed42b5687db6059e5dfb006 Mon Sep 17 00:00:00 2001 From: Tomas Kral Date: Sun, 10 Mar 2024 16:05:30 +0100 Subject: [PATCH 08/11] chore(ci): .bim add commnet --- .ibm/pipelines/functions.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.ibm/pipelines/functions.sh b/.ibm/pipelines/functions.sh index e49c73a15d..1de49f082b 100644 --- a/.ibm/pipelines/functions.sh +++ b/.ibm/pipelines/functions.sh @@ -11,7 +11,7 @@ save_logs() { RESULT="$3" ansi2html <"/tmp/${LOGFILE}" >"/tmp/${LOGFILE}.html" - + # Create a tarball of the playwright-report directory tar -czvf /tmp/${LOGFILE}-report.tar.gz playwright-report/ CRN=$(ibmcloud resource service-instance ${IBM_COS} --output json | jq -r .[0].guid) From 4dd860dcf85984909dd5d14b077eb4e6fee47377 Mon Sep 17 00:00:00 2001 From: Tomas Kral Date: Sun, 10 Mar 2024 16:45:11 +0100 Subject: [PATCH 09/11] chore(ci): upload Playwright report and add view report link to PR --- .ibm/pipelines/functions.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.ibm/pipelines/functions.sh b/.ibm/pipelines/functions.sh index 1de49f082b..1ee9789f83 100644 --- a/.ibm/pipelines/functions.sh +++ b/.ibm/pipelines/functions.sh @@ -38,7 +38,7 @@ save_logs() { cat < Date: Sun, 10 Mar 2024 16:47:38 +0100 Subject: [PATCH 10/11] chore(ci): verifyRowsInTable with pagination support --- e2e-tests/playwright/utils/UIhelper.ts | 30 +++++++++++++++++++------- 1 file changed, 22 insertions(+), 8 deletions(-) diff --git a/e2e-tests/playwright/utils/UIhelper.ts b/e2e-tests/playwright/utils/UIhelper.ts index 82dbb23413..385a0eeb90 100644 --- a/e2e-tests/playwright/utils/UIhelper.ts +++ b/e2e-tests/playwright/utils/UIhelper.ts @@ -98,14 +98,28 @@ export class UIhelper { rowTexts: string[] | RegExp[], exact: boolean = true, ) { - for (const rowText of rowTexts) { - const rowLocator = this.page - .locator(`tr>td`) - .getByText(rowText, { exact: exact }) - .first(); - await rowLocator.waitFor({ state: 'visible' }); - await rowLocator.scrollIntoViewIfNeeded(); - await expect(rowLocator).toBeVisible(); + let hasNextPage = true; + + while (hasNextPage) { + for (const rowText of rowTexts) { + const rowLocator = this.page + .locator(`tr>td`) + .getByText(rowText, { exact: exact }) + .first(); + await rowLocator.waitFor({ state: 'visible' }); + await rowLocator.scrollIntoViewIfNeeded(); + await expect(rowLocator).toBeVisible(); + } + + // Pagination Logic + const nextPageButton = this.page.getByLabel('Next Page').nth(1); + if (await nextPageButton.isDisabled()) { + hasNextPage = false; + } else { + await nextPageButton.click(); + // Wait for the new page to load (adjust as needed) + await this.page.waitForNavigation(); + } } } From 642521defe62f7d48c0fa8cc4582aa731b1adbf3 Mon Sep 17 00:00:00 2001 From: Tomas Kral Date: Sun, 10 Mar 2024 20:30:03 +0100 Subject: [PATCH 11/11] chore(ci): update verifyRowsInTable to support pagination --- e2e-tests/playwright/utils/UIhelper.ts | 28 +++++++++++++++++++++----- 1 file changed, 23 insertions(+), 5 deletions(-) diff --git a/e2e-tests/playwright/utils/UIhelper.ts b/e2e-tests/playwright/utils/UIhelper.ts index 385a0eeb90..e35433339c 100644 --- a/e2e-tests/playwright/utils/UIhelper.ts +++ b/e2e-tests/playwright/utils/UIhelper.ts @@ -84,7 +84,9 @@ export class UIhelper { async openSidebar(navBarText: string) { const navLink = this.page.locator(`nav a:has-text("${navBarText}")`); await navLink.waitFor({ state: 'visible' }); + const href = navLink.getAttribute('href'); await navLink.click(); + await this.page.waitForURL(`**/${href}`); } async selectMuiBox(label: string, value: string) { @@ -98,8 +100,11 @@ export class UIhelper { rowTexts: string[] | RegExp[], exact: boolean = true, ) { + const foundTexts = new Set(); + let hasNextPage = true; + // Loop through pages as long as a "Next" link is present while (hasNextPage) { for (const rowText of rowTexts) { const rowLocator = this.page @@ -108,19 +113,32 @@ export class UIhelper { .first(); await rowLocator.waitFor({ state: 'visible' }); await rowLocator.scrollIntoViewIfNeeded(); - await expect(rowLocator).toBeVisible(); + if (rowLocator.isVisible()) { + foundTexts.add(rowText); + } } - // Pagination Logic - const nextPageButton = this.page.getByLabel('Next Page').nth(1); + const nextPageButton = this.page.getByLabel('Next Page').nth(0); + if (await nextPageButton.isDisabled()) { hasNextPage = false; } else { await nextPageButton.click(); - // Wait for the new page to load (adjust as needed) - await this.page.waitForNavigation(); } } + + rowTexts.forEach(item => { + expect(foundTexts.has(item)).toBeTruthy(); + }); + + // Go to the first page + let previousPageButton = this.page.getByLabel('Previous Page').nth(0); + while ( + (previousPageButton = this.page.getByLabel('Previous Page').nth(0)) && + (await previousPageButton.isVisible()) + ) { + await previousPageButton.click(); + } } async verifyColumnHeading(