-
Notifications
You must be signed in to change notification settings - Fork 14
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Lisää OmaDataOAuth2 e2e testit CI-buildeihin;
Samalla siirrä yksikkötestit erilliseen .unit-packageen, koska github actions yritti ajaa muuten e2e-testejäkin melkein samannimisestä packagesta. Siirrä samalla OmaDataOAuth2Sample-testit samalla tavalla uudelleenkäytettävästi ajettaviksi kuin kosken all_tests, eli push:in sijasta workflow_call ja kutsuminen halutuista muista workflowsta. Mahdollista koski-backendin kutsuminen ympäristömuuttujalla muusta kuin default-portista OmaDataOAuth2-samplen serverissä.
- Loading branch information
1 parent
59d799c
commit 37c482c
Showing
20 changed files
with
184 additions
and
21 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,34 @@ | ||
name: OmaDataOAuth2 Playwright E2E tests | ||
|
||
inputs: | ||
shardIndex: | ||
required: true | ||
type: string | ||
shardTotal: | ||
required: true | ||
type: string | ||
|
||
runs: | ||
using: "composite" | ||
steps: | ||
- name: "🔨 Setup backend and databases" | ||
uses: ./.github/actions/setup_backend | ||
- name: "🌍 Setup Playwright" | ||
uses: ./.github/actions/omadataoauth2_setup_playwright | ||
|
||
- name: Run Playwright tests | ||
env: | ||
PLAYWRIGHT_SHARD_INDEX: ${{inputs.shardIndex}} | ||
PLAYWRIGHT_SHARD_TOTAL: ${{inputs.shardTotal}} | ||
PLAYWRIGHT_HTML_REPORT: omadataoauth2-e2e-report-${{inputs.shardIndex}}-of-${{inputs.shardTotal}} | ||
uses: nick-fields/retry@v3 | ||
with: | ||
max_attempts: 2 | ||
timeout_minutes: 45 | ||
command: mvn scalatest:test -Pomadataoauth2e2e -Dsuites="fi.oph.koski.omadataoauth2.e2e.OmaDataOAuth2E2ESpec" --batch-mode | ||
- uses: actions/upload-artifact@v3 | ||
if: always() | ||
with: | ||
name: omadataoauth2-e2e-report-${{inputs.shardIndex}}-of-${{inputs.shardTotal}} | ||
path: omadata-oauth2-sample/client/omadataoauth2-e2e-report-${{inputs.shardIndex}}-of-${{inputs.shardTotal}}/ | ||
retention-days: 3 |
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,35 @@ | ||
runs: | ||
using: composite | ||
steps: | ||
- name: Install project dependencies server | ||
working-directory: omadata-oauth2-sample/server | ||
run: npm ci | ||
shell: bash | ||
- name: Install project dependencies client | ||
working-directory: omadata-oauth2-sample/client | ||
run: npm ci | ||
shell: bash | ||
- name: Get playwright version | ||
working-directory: omadata-oauth2-sample/client | ||
id: playwright-version | ||
run: echo "version=$(npm ls @playwright/test | grep @playwright | sed 's/.*@//')" >> $GITHUB_OUTPUT | ||
shell: bash | ||
- name: Cache Playwright Browsers | ||
uses: actions/cache@v3 | ||
id: playwright-cache | ||
with: | ||
path: | | ||
~/.cache/ms-playwright | ||
key: ${{ runner.os }}-playwright-${{ steps.playwright-version.outputs.version }} | ||
restore-keys: | | ||
${{ runner.os }}-playwright- | ||
- name: Install Playwright with dependencies | ||
if: steps.playwright-cache.outputs.cache-hit != 'true' | ||
working-directory: omadata-oauth2-sample/client | ||
run: npx playwright install --with-deps | ||
shell: bash | ||
- name: Install Playwright's dependencies | ||
if: steps.playwright-cache.outputs.cache-hit == 'true' | ||
working-directory: omadata-oauth2-sample/client | ||
run: npx playwright install-deps | ||
shell: bash |
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
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
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,6 @@ | ||
#!/bin/bash | ||
set -eou pipefail | ||
echo "Running OmaDataOAuth2 Sample Playwright tests, shard $2 of $3, using backend on $1" | ||
cd $(dirname "$0")/../omadata-oauth2-sample/client | ||
|
||
KOSKI_BACKEND_HOST="$1" npm run playwright:test -- --shard=$2/$3 |
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
23 changes: 23 additions & 0 deletions
23
src/test/scala/fi/oph/koski/omadataoauth2/e2e/OmaDataOAuth2E2ESpec.scala
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,23 @@ | ||
package fi.oph.koski.omadataoauth2.e2e | ||
|
||
import fi.oph.koski.mocha.KoskiCommandLineSpec | ||
import fi.oph.koski.{KoskiApplicationForTests, SharedJetty} | ||
import org.scalatest.Tag | ||
import org.scalatest.freespec.AnyFreeSpec | ||
|
||
class OmaDataOAuth2E2ESpec extends AnyFreeSpec with KoskiCommandLineSpec { | ||
// Oletuksena vain yksi shardi, jotta kaikki testit menevät kerralla ajoon | ||
def shardIndex: String = scala.util.Properties.envOrElse("PLAYWRIGHT_SHARD_INDEX", "1") | ||
def shardTotal: String = scala.util.Properties.envOrElse("PLAYWRIGHT_SHARD_TOTAL", "1") | ||
|
||
"OmaDataOAuth2 integration tests" in { | ||
val sharedJetty = new SharedJetty(KoskiApplicationForTests) | ||
sharedJetty.start() | ||
runTestCommand("omadata-oauth2-e2e-tests", Seq( | ||
"scripts/omadata-oauth2-e2e-test.sh", | ||
sharedJetty.hostUrl, | ||
shardIndex, | ||
shardTotal | ||
)) | ||
} | ||
} |
2 changes: 1 addition & 1 deletion
2
...dataoauth2/OmaDataOAuth2BackendSpec.scala → ...auth2/unit/OmaDataOAuth2BackendSpec.scala
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
8 changes: 1 addition & 7 deletions
8
...uth2/OmaDataOAuth2ClientDetailsSpec.scala → ...unit/OmaDataOAuth2ClientDetailsSpec.scala
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
4 changes: 2 additions & 2 deletions
4
...ataoauth2/OmaDataOAuth2FrontendSpec.scala → ...uth2/unit/OmaDataOAuth2FrontendSpec.scala
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
2 changes: 1 addition & 1 deletion
2
...omadataoauth2/OmaDataOAuth2TestBase.scala → ...taoauth2/unit/OmaDataOAuth2TestBase.scala
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