Skip to content

Commit

Permalink
oidc: move tests to ./test/e2e/oidc (#1088)
Browse files Browse the repository at this point in the history
  • Loading branch information
alxndrsn authored Feb 15, 2024
1 parent b0a99ee commit 88d9936
Show file tree
Hide file tree
Showing 25 changed files with 26 additions and 27 deletions.
21 changes: 10 additions & 11 deletions .dockerignore
Original file line number Diff line number Diff line change
Expand Up @@ -7,15 +7,14 @@
!/Makefile
!/lib/
!/config/
!/test/

!/oidc-dev/certs/*.pem
!/oidc-dev/fake-oidc-server/accounts.json
!/oidc-dev/fake-oidc-server/index.js
!/oidc-dev/fake-oidc-server/package.json
!/oidc-dev/fake-oidc-server/package-lock.json
!/oidc-dev/playwright-tests/package.json
!/oidc-dev/playwright-tests/package-lock.json
!/oidc-dev/playwright-tests/playwright.config.js
!/oidc-dev/playwright-tests/src/**/*.js
!/oidc-dev/scripts/*.sh
!/test/e2e/oidc/certs/*.pem
!/test/e2e/oidc/fake-oidc-server/accounts.json
!/test/e2e/oidc/fake-oidc-server/index.js
!/test/e2e/oidc/fake-oidc-server/package.json
!/test/e2e/oidc/fake-oidc-server/package-lock.json
!/test/e2e/oidc/playwright-tests/package.json
!/test/e2e/oidc/playwright-tests/package-lock.json
!/test/e2e/oidc/playwright-tests/playwright.config.js
!/test/e2e/oidc/playwright-tests/src/**/*.js
!/test/e2e/oidc/scripts/*.sh
2 changes: 1 addition & 1 deletion .github/workflows/oidc-e2e.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,4 +20,4 @@ jobs:
uses: actions/upload-artifact@v4
with:
name: Playwright Screenshots
path: oidc-dev/playwright-results/**/*.png
path: test/e2e/oidc/playwright-results/**/*.png
6 changes: 3 additions & 3 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ test-oidc-integration: node_version

.PHONY: test-oidc-e2e
test-oidc-e2e: node_version
cd oidc-dev && \
cd test/e2e/oidc && \
docker compose down && \
docker compose build && \
docker compose up --exit-code-from odk-central-oidc-tester
Expand All @@ -21,13 +21,13 @@ dev-oidc: base

.PHONY: fake-oidc-server
fake-oidc-server:
cd oidc-dev/fake-oidc-server && \
cd test/e2e/oidc/fake-oidc-server && \
npm clean-install && \
FAKE_OIDC_ROOT_URL=http://localhost:9898 npx nodemon index.js

.PHONY: fake-oidc-server-ci
fake-oidc-server-ci:
cd oidc-dev/fake-oidc-server && \
cd test/e2e/oidc/fake-oidc-server && \
npm clean-install && \
FAKE_OIDC_ROOT_URL=http://localhost:9898 node index.js

Expand Down
12 changes: 6 additions & 6 deletions oidc-tester.dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -17,13 +17,13 @@ WORKDIR /odk-central-backend
COPY Makefile package.json package-lock.json .
RUN npm clean-install --legacy-peer-deps

WORKDIR /odk-central-backend/oidc-dev/fake-oidc-server
COPY oidc-dev/fake-oidc-server/package.json oidc-dev/fake-oidc-server/package-lock.json .
WORKDIR /odk-central-backend/test/e2e/oidc/fake-oidc-server
COPY test/e2e/oidc/fake-oidc-server/package.json test/e2e/oidc/fake-oidc-server/package-lock.json .
RUN npm clean-install

WORKDIR /odk-central-backend/oidc-dev/playwright-tests
COPY oidc-dev/playwright-tests/package.json \
oidc-dev/playwright-tests/package-lock.json \
WORKDIR /odk-central-backend/test/e2e/oidc/playwright-tests
COPY test/e2e/oidc/playwright-tests/package.json \
test/e2e/oidc/playwright-tests/package-lock.json \
.
RUN npm clean-install && echo -n 'Playwright: ' && npx playwright --version && npx playwright install --with-deps

Expand All @@ -35,5 +35,5 @@ WORKDIR /odk-central-backend
COPY / .

ENV NODE_CONFIG_ENV=oidc-tester-docker
WORKDIR /odk-central-backend/oidc-dev
WORKDIR /odk-central-backend/test/e2e/oidc
CMD ./scripts/docker-start.sh
File renamed without changes.
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,10 @@ services:
odk-central-oidc-tester:
build:
dockerfile: oidc-tester.dockerfile
context: ../
context: ../../..
# expose playwright results
environment:
DEBUG: pw:api
ODK_PLAYWRIGHT_BROWSERS: chromium,firefox,webkit
volumes:
- ./playwright-results:/odk-central-backend/oidc-dev/playwright-tests/results
- ./playwright-results:/odk-central-backend/test/e2e/oidc/playwright-tests/results
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
// except according to the terms contained in the LICENSE file.

module.exports = {
extends: '../../.eslintrc.json',
extends: '../../../../.eslintrc.json',
rules: {
// This rule does not work if the node_modules directory has not been
// populated. If this rule is enabled here, `npm clean-install` will need
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
// except according to the terms contained in the LICENSE file.

module.exports = {
extends: '../../.eslintrc.json',
extends: '../../../../.eslintrc.json',
env: {
browser: true, // for page.waitForFunction() code
},
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -16,13 +16,13 @@ wait-for-it odk-central-oidc-tester-postgres:5432 --strict --timeout=60 -- echo

log "Starting services..."
(cd fake-oidc-server && node index.js) &
(cd .. && make base && NODE_TLS_REJECT_UNAUTHORIZED=0 node lib/bin/run-server.js) &
(cd ../../.. && make base && NODE_TLS_REJECT_UNAUTHORIZED=0 node lib/bin/run-server.js) &

log "Waiting for odk-central-backend to start..."
wait-for-it localhost:8383 --strict --timeout=60 -- echo '[oidc-tester] odk-central-backend is UP!'

log "Creating test users..." # _after_ migrations have been run
cd ..
cd ../../..
node lib/bin/cli.js --email [email protected] user-create
cd -
log "Test users created."
Expand Down

0 comments on commit 88d9936

Please sign in to comment.