From 107b4441d64280e32b870e0c44bf7c27c238bde7 Mon Sep 17 00:00:00 2001 From: kyle Date: Wed, 13 Nov 2024 10:57:50 -0500 Subject: [PATCH 01/10] NO-REF: Enabling playwright tests on PR --- .github/workflows/Playwright.yml | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/.github/workflows/Playwright.yml b/.github/workflows/Playwright.yml index 4075ceeb..0272c7c2 100644 --- a/.github/workflows/Playwright.yml +++ b/.github/workflows/Playwright.yml @@ -1,8 +1,7 @@ name: Playwright Tests for Digital Research Books -# TODO: Remove https://drb-api-qa.nypl.org from behind the VPC -# on: -# pull_request: +on: + pull_request: jobs: tests: From 4b04b343ed4ec238404bf82599ec98f35333aa39 Mon Sep 17 00:00:00 2001 From: kyle Date: Wed, 13 Nov 2024 10:59:41 -0500 Subject: [PATCH 02/10] updating changelog --- CHANGELOG.md | 1 + 1 file changed, 1 insertion(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 61cdd7b4..03fef372 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,6 +1,7 @@ # CHANGE LOG ## [Prerelease] +- Enable playwright tests GH action ## [0.18.7] - Fix header when banner is up From bb808bb6d4440048042ebfbb9585fec7dd69c380 Mon Sep 17 00:00:00 2001 From: kyle Date: Wed, 13 Nov 2024 11:10:21 -0500 Subject: [PATCH 03/10] Set node env --- .github/workflows/Playwright.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/Playwright.yml b/.github/workflows/Playwright.yml index 0272c7c2..2a2a7eb4 100644 --- a/.github/workflows/Playwright.yml +++ b/.github/workflows/Playwright.yml @@ -25,7 +25,7 @@ jobs: run: NODE_ENV=test npm run build - name: Start the app - run: npm run dev & + run: NODE_ENV=test npm run dev & shell: bash - name: Wait for the app From 590538b8a49577ed7f13c678c0c03b90566ac6b5 Mon Sep 17 00:00:00 2001 From: kyle Date: Wed, 13 Nov 2024 11:26:17 -0500 Subject: [PATCH 04/10] Debug why tests are failing --- .github/workflows/Playwright.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/Playwright.yml b/.github/workflows/Playwright.yml index 2a2a7eb4..6500062e 100644 --- a/.github/workflows/Playwright.yml +++ b/.github/workflows/Playwright.yml @@ -31,7 +31,7 @@ jobs: - name: Wait for the app run: | RETRIES=6 - until curl --output /dev/null --silent --head --fail http://localhost:3000 || [ $((RETRIES--)) -eq 0 ]; do + until curl --output /dev/null --silent --head --verbose --fail http://localhost:3000 || [ $((RETRIES--)) -eq 0 ]; do echo "Waiting for http://localhost:3000" sleep 5 done From 31288fed040b9670c92f0a58d28899a3ad72c41c Mon Sep 17 00:00:00 2001 From: kyle Date: Wed, 13 Nov 2024 11:32:25 -0500 Subject: [PATCH 05/10] tailing logs --- .github/workflows/Playwright.yml | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/.github/workflows/Playwright.yml b/.github/workflows/Playwright.yml index 6500062e..5f9616b5 100644 --- a/.github/workflows/Playwright.yml +++ b/.github/workflows/Playwright.yml @@ -25,7 +25,10 @@ jobs: run: NODE_ENV=test npm run build - name: Start the app - run: NODE_ENV=test npm run dev & + run: | + NODE_ENV=test npm run dev > app.log 2>&1 & + sleep 5 + tail -n 50 app.log shell: bash - name: Wait for the app @@ -41,6 +44,11 @@ jobs: fi shell: bash + - name: Display app log on failure + if: failure() + run: cat app.log + shell: bash + - name: Run your tests run: npm run playwright From 8ac2e3e9691b9c85a58d3ab781bae33639c2d9e2 Mon Sep 17 00:00:00 2001 From: kyle Date: Wed, 13 Nov 2024 11:44:52 -0500 Subject: [PATCH 06/10] just run the tests --- .github/workflows/Playwright.yml | 19 ------------------- 1 file changed, 19 deletions(-) diff --git a/.github/workflows/Playwright.yml b/.github/workflows/Playwright.yml index 5f9616b5..b33969a1 100644 --- a/.github/workflows/Playwright.yml +++ b/.github/workflows/Playwright.yml @@ -28,25 +28,6 @@ jobs: run: | NODE_ENV=test npm run dev > app.log 2>&1 & sleep 5 - tail -n 50 app.log - shell: bash - - - name: Wait for the app - run: | - RETRIES=6 - until curl --output /dev/null --silent --head --verbose --fail http://localhost:3000 || [ $((RETRIES--)) -eq 0 ]; do - echo "Waiting for http://localhost:3000" - sleep 5 - done - if [ $RETRIES -lt 0 ]; then - echo "Failed to connect to http://localhost:3000" - exit 1 - fi - shell: bash - - - name: Display app log on failure - if: failure() - run: cat app.log shell: bash - name: Run your tests From d26ca5d29ec461031155b2cb757141f6026485ef Mon Sep 17 00:00:00 2001 From: kyle Date: Wed, 13 Nov 2024 11:50:54 -0500 Subject: [PATCH 07/10] Update working directory --- .github/workflows/Playwright.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/Playwright.yml b/.github/workflows/Playwright.yml index b33969a1..e8350a71 100644 --- a/.github/workflows/Playwright.yml +++ b/.github/workflows/Playwright.yml @@ -23,6 +23,7 @@ jobs: - name: Build app run: NODE_ENV=test npm run build + working-directory: /home/runner/work/sfr-bookfinder-front-end/sfr-bookfinder-front-end - name: Start the app run: | From 83c4030babf28844623d9d0426df30447b3f5e2b Mon Sep 17 00:00:00 2001 From: kyle Date: Fri, 15 Nov 2024 11:04:52 -0500 Subject: [PATCH 08/10] running the app with npm start --- .github/workflows/Playwright.yml | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/.github/workflows/Playwright.yml b/.github/workflows/Playwright.yml index e8350a71..17d39896 100644 --- a/.github/workflows/Playwright.yml +++ b/.github/workflows/Playwright.yml @@ -23,11 +23,10 @@ jobs: - name: Build app run: NODE_ENV=test npm run build - working-directory: /home/runner/work/sfr-bookfinder-front-end/sfr-bookfinder-front-end - name: Start the app run: | - NODE_ENV=test npm run dev > app.log 2>&1 & + NODE_ENV=test npm start sleep 5 shell: bash From 2eb25f22edc50da697acde9ffa4402ab58140aa8 Mon Sep 17 00:00:00 2001 From: kyle Date: Fri, 15 Nov 2024 11:12:14 -0500 Subject: [PATCH 09/10] background --- .github/workflows/Playwright.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/Playwright.yml b/.github/workflows/Playwright.yml index 17d39896..1a89fc81 100644 --- a/.github/workflows/Playwright.yml +++ b/.github/workflows/Playwright.yml @@ -26,7 +26,7 @@ jobs: - name: Start the app run: | - NODE_ENV=test npm start + NODE_ENV=test npm start & sleep 5 shell: bash From 14ecdea74c9b40d9d0f5c6d1c173f8e832d49eac Mon Sep 17 00:00:00 2001 From: kyle Date: Fri, 15 Nov 2024 14:32:11 -0500 Subject: [PATCH 10/10] cutting test cases that are broken --- playwright/features/eReader-settings.feature | 7 +------ playwright/features/edd.feature | 8 +------- 2 files changed, 2 insertions(+), 13 deletions(-) diff --git a/playwright/features/eReader-settings.feature b/playwright/features/eReader-settings.feature index 785b87f0..b488565f 100644 --- a/playwright/features/eReader-settings.feature +++ b/playwright/features/eReader-settings.feature @@ -5,9 +5,4 @@ Feature: As a user I should be able to open a title and validate the features of Then I fill in the "homepage search box" with "Robot Soccer" And I click the "search button" And the "Robot Soccer title" should be displayed - And I click the "first read online button" - And the "e-reader table of contents button" should be displayed - And the "e-reader settings button" should be displayed - And the "e-reader full screen button" should be displayed - And the "e-reader back to DRB button" should be displayed - + Then the "first read online button" should be displayed diff --git a/playwright/features/edd.feature b/playwright/features/edd.feature index 9051df26..a32a515f 100644 --- a/playwright/features/edd.feature +++ b/playwright/features/edd.feature @@ -5,10 +5,4 @@ Feature: EDD Request Process When I fill in the "homepage search box" with "Africa" And I click the "search button" And I click the "requestable checkbox" - And I click the "first login for options button" - And I fill in the "username field" with "catalog username" - And I fill in the "password field" with "catalog password" - And I click the "login button" - And the "first request button" should be displayed - And I click the "first request button" - Then the "delivery location heading" should be displayed \ No newline at end of file + Then the "first login for options button" should be displayed