-
Notifications
You must be signed in to change notification settings - Fork 72
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Resourceadm: run playwright tests on PR and push to main (#13080)
* playwright tests for resource admin on PR and push to main * increase timeout to wait for deploy to 15 minutes (same as used in studio) * fix script command
- Loading branch information
Showing
2 changed files
with
143 additions
and
0 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,72 @@ | ||
name: Resourceadm Playwright Tests in Dev | ||
|
||
on: | ||
push: | ||
branches: | ||
- main | ||
paths: | ||
- 'frontend/resourceadm/**' | ||
- '.github/workflows/playwright-resourceadm.yml' | ||
|
||
concurrency: | ||
group: ${{ github.workflow }}-${{ github.ref }} | ||
cancel-in-progress: true | ||
|
||
jobs: | ||
playwright-run: | ||
name: 'Resourceadm Playwright Tests' | ||
runs-on: ubuntu-latest | ||
|
||
steps: | ||
- name: 'Checking Out Code' | ||
uses: actions/checkout@v4 | ||
with: | ||
fetch-depth: 0 | ||
|
||
- uses: actions/setup-node@v4 | ||
with: | ||
cache: 'yarn' | ||
|
||
- name: Get yarn cache directory path | ||
working-directory: frontend | ||
id: yarn-cache-dir-path | ||
run: echo "dir=$(yarn config get cacheFolder)" >> $GITHUB_OUTPUT | ||
|
||
- uses: actions/cache@v4 | ||
id: yarn-cache | ||
with: | ||
path: ${{ steps.yarn-cache-dir-path.outputs.dir }} | ||
key: ${{ runner.os }}-yarn-${{ hashFiles('**/yarn.lock') }} | ||
restore-keys: | | ||
${{ runner.os }}-yarn- | ||
- name: Attempt to wait for deploy to environment (15 minutes sleep) | ||
run: | | ||
if [ "${{ github.run_attempt }}" != "1" ]; then | ||
echo "Skip waiting for deploy, since this is a re-run of the pipeline." | ||
else | ||
sleep 15m | ||
fi | ||
- name: Resourceadm Playwright run | ||
working-directory: frontend/resourceadm/testing/playwright | ||
env: | ||
PLAYWRIGHT_TEST_BASE_URL: 'https://dev.altinn.studio' | ||
PLAYWRIGHT_RESOURCES_ORGANIZATION: ttd | ||
PLAYWRIGHT_RESOURCES_REPO_NAME: ttd-resources | ||
PLAYWRIGHT_USER: 'AutoTest' | ||
PLAYWRIGHT_PASS: ${{ secrets.AUTO_TEST_USER_PWD }} | ||
GITEA_ACCESS_TOKEN: ${{ secrets.AUTO_TEST_USER_TOKEN_DEV }} | ||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
run: | | ||
yarn | ||
yarn install --immutable --inline-builds | ||
yarn playwright install --with-deps | ||
yarn resourceadm:playwright:test:all | ||
- name: Store artifacts | ||
uses: actions/upload-artifact@v4 | ||
if: failure() | ||
with: | ||
name: playwright-resourceadm-screenshots | ||
path: frontend/resourceadm/testing/playwright/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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,71 @@ | ||
name: Resource admin playwright tests on pr | ||
on: | ||
pull_request: | ||
branches: [main] | ||
types: [opened, synchronize, reopened] | ||
paths: | ||
- 'frontend/resourceadm/**' | ||
- '.github/workflows/run-playwright-resourceadm-on-pr.yaml' | ||
workflow_dispatch: | ||
|
||
jobs: | ||
playwright-tests: | ||
name: Build environment and run e2e test | ||
timeout-minutes: 25 | ||
runs-on: ubuntu-latest | ||
|
||
steps: | ||
- uses: actions/checkout@v4 | ||
with: | ||
fetch-depth: 0 | ||
|
||
- name: Generate .env file | ||
run: | | ||
echo PLAYWRIGHT_TEST_APP=autodeploy-v3 >> .env | ||
echo DEVELOP_APP_DEVELOPMENT=0 >> .env | ||
echo DEVELOP_RESOURCE_ADMIN=0 >> .env | ||
echo DEVELOP_BACKEND=0 >> .env | ||
echo DEVELOP_DASHBOARD=0 >> .env | ||
echo DEVELOP_PREVIEW=0 >> .env | ||
echo GITEA_ADMIN_PASS=g9wDIG@6gf >> .env | ||
echo GITEA_ADMIN_USER=localg1iteaadmin >> .env | ||
echo GITEA_CYPRESS_USER=cypress_testuser >> .env | ||
echo GITEA_CYPRESS_PASS=g9wDIG@6gf >> .env | ||
echo GITEA_ORG_USER=ttd >> .env | ||
echo POSTGRES_PASSWORD=kyeDIG@eip >> .env | ||
echo COMMIT= >> .env | ||
echo IGNORE_DOCKER_DNS_LOOKUP=true >> .env | ||
- name: Build all images | ||
run: | | ||
docker compose build --no-cache | ||
- name: Install node | ||
uses: actions/setup-node@v4 | ||
with: | ||
cache: 'yarn' | ||
|
||
- name: Run setup.js script | ||
run: | | ||
node ./development/setup.js | ||
- name: Playwright resourceadm run | ||
working-directory: frontend/resourceadm/testing/playwright | ||
env: | ||
environment: local | ||
run: | | ||
yarn | ||
yarn playwright install --with-deps | ||
yarn resourceadm:setup:playwright | ||
yarn resourceadm:playwright:test:all | ||
- name: Stop compose file | ||
if: always() | ||
run: docker-compose down | ||
|
||
- name: Store artifacts | ||
uses: actions/upload-artifact@v4 | ||
if: failure() | ||
with: | ||
name: playwright-resourceadm-screenshots | ||
path: frontend/testing/playwright/test-results |