-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
NO-REF: Fixing docker file and playwright tests (#547)
- Loading branch information
1 parent
51ecb3c
commit 5556a42
Showing
16 changed files
with
73 additions
and
104 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
APP_ENV=testing | ||
APP_ENV=development | ||
|
||
# API ENDPOINT | ||
API_URL=https://backend.msw | ||
API_URL=https://drb-api-qa.nypl.org/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,8 @@ | ||
name: Playwright Tests for Digital Research Books | ||
|
||
on: | ||
pull_request: | ||
# TODO: Remove https://drb-api-qa.nypl.org from behind the VPC | ||
# on: | ||
# pull_request: | ||
|
||
jobs: | ||
tests: | ||
|
@@ -15,18 +16,35 @@ jobs: | |
with: | ||
node-version-file: ".nvmrc" | ||
|
||
- name: Install Deps | ||
- name: Install Test Dependencies | ||
run: npm i @cucumber/[email protected] @playwright/[email protected] | ||
|
||
- name: Install Playwright | ||
run: npx playwright install --with-deps | ||
|
||
- name: Build app | ||
run: NODE_ENV=test npm run build | ||
|
||
- name: Start the app | ||
run: npm run dev & | ||
shell: bash | ||
|
||
- name: Wait for the app | ||
run: | | ||
RETRIES=6 | ||
until curl --output /dev/null --silent --head --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: Run your tests | ||
run: npm run playwright | ||
|
||
- name: Install Playwright Browser Utils | ||
run: npx playwright install --with-deps | ||
|
||
- name: Set the world parameters as an env var | ||
# WORLD_PARAMETERS set here will override anything set in cucumber.json | ||
run: | | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -27,3 +27,4 @@ newrelic_agent.log | |
|
||
# playwright | ||
playwright-report | ||
test-results |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,3 @@ | ||
version: "3" | ||
|
||
services: | ||
web: | ||
container_name: sfr-bookfinder-front-end | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,11 +1,9 @@ | ||
export const NYPL_LOGIN_URL = "https://login.nypl.org/auth/login?redirect_uri="; | ||
export const API_URL = "https://backend.msw"; | ||
export const FULFILL_PATH = "/fulfill/12345"; | ||
export const LIMITED_ACCESS_WORK_PATH = | ||
"/work/12345678-1234-1234-1234-1234567890ab"; | ||
export const FULFILL_PATH = "/fulfill/9351827"; | ||
export const LIMITED_ACCESS_EDITION_PATH = "/edition/6977884"; | ||
export const WORK_PATH = "/work/5950e6df-9d99-42fe-8924-1116166a2acb"; | ||
export const DOWNLOAD_PATH = "/test-download-pdf"; | ||
export const HOME_PATH = "/"; | ||
export const COLLECTION_LIST_PATH = "/collection/list"; | ||
export const COLLECTION_PATH = | ||
"/collection/978ea0e0-8ecc-4de2-bfe8-032fea641d8e?page=1"; | ||
export const INVALID_COLLECTION_PATH = "/collection/invalid-collection"; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,33 +1,24 @@ | ||
import { test, expect } from "../support/test-utils"; | ||
import { | ||
INVALID_COLLECTION_PATH, | ||
HOME_PATH, | ||
COLLECTION_PATH, | ||
} from "~/mocks/mockEnv"; | ||
import { INVALID_COLLECTION_PATH, HOME_PATH } from "~/mocks/mockEnv"; | ||
import { server } from "~/mocks/server"; | ||
import { | ||
SEARCH_BAR_TEST_ID, | ||
ERROR_LAYOUT_TEST_ID, | ||
} from "~/src/constants/testIds"; | ||
|
||
test.afterEach(() => server.resetHandlers()); | ||
test.afterAll(() => server.close()); | ||
|
||
test("View landing page with collection", async ({ page, port }) => { | ||
await page.goto(`http://localhost:${port}${HOME_PATH}`); | ||
const collectionHeading = page.getByRole("heading", { | ||
name: "Recently Added Collections", | ||
level: 2, | ||
}); | ||
expect(collectionHeading).toBeVisible(); | ||
const collectionLink = await page | ||
.getByRole("link", { | ||
name: /Baseball: A Collection by Mike Benowitz/, | ||
}) | ||
.getAttribute("href"); | ||
expect(collectionLink).toContain(COLLECTION_PATH); | ||
test("View landing page with search", async ({ page }) => { | ||
await page.goto(`${HOME_PATH}`); | ||
|
||
const searchBar = page.getByTestId(SEARCH_BAR_TEST_ID); | ||
await expect(searchBar).toBeVisible(); | ||
}); | ||
|
||
test("Shows error boundary for invalid collection", async ({ page, port }) => { | ||
await page.goto(`http://localhost:${port}${INVALID_COLLECTION_PATH}`); | ||
test("Shows error page for invalid collection", async ({ page }) => { | ||
await page.goto(`${INVALID_COLLECTION_PATH}`); | ||
|
||
const alert = page.getByRole("alert"); | ||
const errorText = alert.getByText("Something went wrong on our end"); | ||
await expect(errorText).toBeVisible(); | ||
const errorLayout = page.getByTestId(ERROR_LAYOUT_TEST_ID); | ||
await expect(errorLayout).toBeVisible(); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
export const SEARCH_BAR_TEST_ID = "search-bar"; | ||
export const ERROR_LAYOUT_TEST_ID = "error-layout"; | ||
export const LOGIN_TO_READ_TEST_ID = "login-to-read"; | ||
export const LOGIN_TO_DOWNLOAD_TEST_ID = "login-to-download"; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters