-
Notifications
You must be signed in to change notification settings - Fork 457
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
7473f09
commit 0bdcadf
Showing
2 changed files
with
76 additions
and
42 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 |
---|---|---|
@@ -0,0 +1,56 @@ | ||
name: E2E test | ||
description: Run E2E tests against the example application | ||
|
||
inputs: | ||
working-directory: | ||
description: The current working directory | ||
required: true | ||
|
||
env: | ||
SAMPLE_PATH: ${{ inputs.working-directory }} | ||
IMAGE_NAME: ${{ github.event.pull_request.head.sha || github.sha }} | ||
CONTAINER_NAME: ${{ github.event.pull_request.head.sha || github.sha }} | ||
AUTH0_TEST_DOMAIN: ${{ secrets.AUTH0_TEST_DOMAIN }} | ||
AUTH0_TEST_CLIENT_ID: ${{ secrets.AUTH0_TEST_CLIENT_ID }} | ||
AUTH0_TEST_API_IDENTIFIER: ${{ secrets.AUTH0_TEST_API_IDENTIFIER }} | ||
|
||
runs: | ||
using: composite | ||
|
||
steps: | ||
- name: Replace Auth0 test credentials | ||
shell: bash | ||
env: | ||
AUTH0_CFG: ${{ inputs.working-directory }}/auth_config.json | ||
AUTH0_EXAMPLE_CFG: ${{ inputs.working-directory }}/auth_config.json.example | ||
run: | | ||
sed \ | ||
-e "s/{DOMAIN}/$AUTH0_TEST_DOMAIN/g" \ | ||
-e "s/{CLIENT_ID}/$AUTH0_TEST_CLIENT_ID/g" \ | ||
-e "s/{API_IDENTIFIER}/$AUTH0_TEST_API_IDENTIFIER/g" \ | ||
$AUTH0_EXAMPLE_CFG > $AUTH0_CFG | ||
- name: Set up Docker Buildx | ||
uses: docker/setup-buildx-action@v3 | ||
|
||
- name: Build pull request | ||
run: | | ||
docker build -t $IMAGE_NAME ./$SAMPLE_PATH | ||
docker run -d -p 4200:4200 --name $CONTAINER_NAME $IMAGE_NAME | ||
- name: Wait for app to be available | ||
run: | | ||
sleep 10 | ||
docker run --network host --rm appropriate/curl --retry 8 --retry-connrefused -v localhost:4200 | ||
- name: Run tests | ||
run: | | ||
docker create --env "SAMPLE_PORT=4200" --network host --name tester codeceptjs/codeceptjs codeceptjs run-multiple --all --steps | ||
docker cp $(pwd)/lock_login_test.js tester:/tests/lock_login_test.js | ||
docker cp $(pwd)/codecept.conf.js tester:/tests/codecept.conf.js | ||
docker start -i tester | ||
working-directory: scripts | ||
- name: Copy app container logs | ||
run: | | ||
mkdir -p /tmp/out | ||
docker logs $CONTAINER_NAME > /tmp/out/app_logs.log | ||
docker cp tester:/tests/out /tmp/ | ||
if: failure() |
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