diff --git a/.dockerignore b/.dockerignore index ff30a645b..3ada40681 100644 --- a/.dockerignore +++ b/.dockerignore @@ -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 diff --git a/.github/workflows/oidc-e2e.yml b/.github/workflows/oidc-e2e.yml index e46ae5351..db2bd2475 100644 --- a/.github/workflows/oidc-e2e.yml +++ b/.github/workflows/oidc-e2e.yml @@ -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 diff --git a/Makefile b/Makefile index af9969b40..9a68d4e73 100644 --- a/Makefile +++ b/Makefile @@ -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 @@ -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 diff --git a/oidc-tester.dockerfile b/oidc-tester.dockerfile index 50729de1d..2b1a3da69 100644 --- a/oidc-tester.dockerfile +++ b/oidc-tester.dockerfile @@ -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 @@ -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 diff --git a/oidc-dev/.gitignore b/test/e2e/oidc/.gitignore similarity index 100% rename from oidc-dev/.gitignore rename to test/e2e/oidc/.gitignore diff --git a/oidc-dev/README.md b/test/e2e/oidc/README.md similarity index 100% rename from oidc-dev/README.md rename to test/e2e/oidc/README.md diff --git a/oidc-dev/certs/fake-oidc-server.example.net-key.pem b/test/e2e/oidc/certs/fake-oidc-server.example.net-key.pem similarity index 100% rename from oidc-dev/certs/fake-oidc-server.example.net-key.pem rename to test/e2e/oidc/certs/fake-oidc-server.example.net-key.pem diff --git a/oidc-dev/certs/fake-oidc-server.example.net.pem b/test/e2e/oidc/certs/fake-oidc-server.example.net.pem similarity index 100% rename from oidc-dev/certs/fake-oidc-server.example.net.pem rename to test/e2e/oidc/certs/fake-oidc-server.example.net.pem diff --git a/oidc-dev/certs/odk-central.example.org-key.pem b/test/e2e/oidc/certs/odk-central.example.org-key.pem similarity index 100% rename from oidc-dev/certs/odk-central.example.org-key.pem rename to test/e2e/oidc/certs/odk-central.example.org-key.pem diff --git a/oidc-dev/certs/odk-central.example.org.pem b/test/e2e/oidc/certs/odk-central.example.org.pem similarity index 100% rename from oidc-dev/certs/odk-central.example.org.pem rename to test/e2e/oidc/certs/odk-central.example.org.pem diff --git a/oidc-dev/docker-compose.yml b/test/e2e/oidc/docker-compose.yml similarity index 79% rename from oidc-dev/docker-compose.yml rename to test/e2e/oidc/docker-compose.yml index 21718b0fe..909fcbbc4 100644 --- a/oidc-dev/docker-compose.yml +++ b/test/e2e/oidc/docker-compose.yml @@ -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 diff --git a/oidc-dev/fake-oidc-server/.eslintrc.cjs b/test/e2e/oidc/fake-oidc-server/.eslintrc.cjs similarity index 95% rename from oidc-dev/fake-oidc-server/.eslintrc.cjs rename to test/e2e/oidc/fake-oidc-server/.eslintrc.cjs index 2c119004d..451fa3c9d 100644 --- a/oidc-dev/fake-oidc-server/.eslintrc.cjs +++ b/test/e2e/oidc/fake-oidc-server/.eslintrc.cjs @@ -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 diff --git a/oidc-dev/fake-oidc-server/accounts.json b/test/e2e/oidc/fake-oidc-server/accounts.json similarity index 100% rename from oidc-dev/fake-oidc-server/accounts.json rename to test/e2e/oidc/fake-oidc-server/accounts.json diff --git a/oidc-dev/fake-oidc-server/index.js b/test/e2e/oidc/fake-oidc-server/index.js similarity index 100% rename from oidc-dev/fake-oidc-server/index.js rename to test/e2e/oidc/fake-oidc-server/index.js diff --git a/oidc-dev/fake-oidc-server/package-lock.json b/test/e2e/oidc/fake-oidc-server/package-lock.json similarity index 100% rename from oidc-dev/fake-oidc-server/package-lock.json rename to test/e2e/oidc/fake-oidc-server/package-lock.json diff --git a/oidc-dev/fake-oidc-server/package.json b/test/e2e/oidc/fake-oidc-server/package.json similarity index 100% rename from oidc-dev/fake-oidc-server/package.json rename to test/e2e/oidc/fake-oidc-server/package.json diff --git a/oidc-dev/playwright-tests/.eslintrc.js b/test/e2e/oidc/playwright-tests/.eslintrc.js similarity index 95% rename from oidc-dev/playwright-tests/.eslintrc.js rename to test/e2e/oidc/playwright-tests/.eslintrc.js index 3d2f1b329..0431ce08d 100644 --- a/oidc-dev/playwright-tests/.eslintrc.js +++ b/test/e2e/oidc/playwright-tests/.eslintrc.js @@ -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 }, diff --git a/oidc-dev/playwright-tests/package-lock.json b/test/e2e/oidc/playwright-tests/package-lock.json similarity index 100% rename from oidc-dev/playwright-tests/package-lock.json rename to test/e2e/oidc/playwright-tests/package-lock.json diff --git a/oidc-dev/playwright-tests/package.json b/test/e2e/oidc/playwright-tests/package.json similarity index 100% rename from oidc-dev/playwright-tests/package.json rename to test/e2e/oidc/playwright-tests/package.json diff --git a/oidc-dev/playwright-tests/playwright.config.js b/test/e2e/oidc/playwright-tests/playwright.config.js similarity index 100% rename from oidc-dev/playwright-tests/playwright.config.js rename to test/e2e/oidc/playwright-tests/playwright.config.js diff --git a/oidc-dev/playwright-tests/src/config.js b/test/e2e/oidc/playwright-tests/src/config.js similarity index 100% rename from oidc-dev/playwright-tests/src/config.js rename to test/e2e/oidc/playwright-tests/src/config.js diff --git a/oidc-dev/playwright-tests/src/global-setup-teardown.js b/test/e2e/oidc/playwright-tests/src/global-setup-teardown.js similarity index 100% rename from oidc-dev/playwright-tests/src/global-setup-teardown.js rename to test/e2e/oidc/playwright-tests/src/global-setup-teardown.js diff --git a/oidc-dev/playwright-tests/src/oidc-login.spec.js b/test/e2e/oidc/playwright-tests/src/oidc-login.spec.js similarity index 100% rename from oidc-dev/playwright-tests/src/oidc-login.spec.js rename to test/e2e/oidc/playwright-tests/src/oidc-login.spec.js diff --git a/oidc-dev/playwright-tests/src/utils.js b/test/e2e/oidc/playwright-tests/src/utils.js similarity index 100% rename from oidc-dev/playwright-tests/src/utils.js rename to test/e2e/oidc/playwright-tests/src/utils.js diff --git a/oidc-dev/scripts/docker-start.sh b/test/e2e/oidc/scripts/docker-start.sh similarity index 90% rename from oidc-dev/scripts/docker-start.sh rename to test/e2e/oidc/scripts/docker-start.sh index b65006dc7..51bb71dc6 100755 --- a/oidc-dev/scripts/docker-start.sh +++ b/test/e2e/oidc/scripts/docker-start.sh @@ -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 alice@example.com user-create cd - log "Test users created."