From 291dc0af444f84548832c97e1fa0e5a87a0cb6f5 Mon Sep 17 00:00:00 2001 From: James Gunn Date: Thu, 19 Dec 2024 13:57:07 +0000 Subject: [PATCH] Add a just recipe to install Playwright (#1742) Also updates the README. --- .github/workflows/pr.yml | 9 +++++---- README.md | 7 +++++++ justfile | 6 +++++- 3 files changed, 17 insertions(+), 5 deletions(-) diff --git a/.github/workflows/pr.yml b/.github/workflows/pr.yml index 07b2250b1..51149f2b2 100644 --- a/.github/workflows/pr.yml +++ b/.github/workflows/pr.yml @@ -154,13 +154,14 @@ jobs: run: dotnet build -c Release --no-restore working-directory: TeachingRecordSystem/tests/${{ matrix.project }} - - name: Check for Playwright + - name: Install Playwright if required run: | - playwright_script=./bin/Release/net8.0/playwright.ps1 - if [ -f $playwright_script ]; then - pwsh $playwright_script install chromium + if [[ "$PROJECT_NAME" =~ .*EndToEndTests ]]; then + pwsh ./bin/Release/net8.0/playwright.ps1 install chromium fi working-directory: TeachingRecordSystem/tests/${{ matrix.project }} + env: + PROJECT_NAME: ${{ matrix.project }} - name: Run tests uses: ./.github/workflows/actions/test diff --git a/README.md b/README.md index d0304444a..bb7d6c4d5 100644 --- a/README.md +++ b/README.md @@ -82,6 +82,13 @@ As well as NuGet packages, there are some client-side libraries required. A `jus just restore ``` +### Install Playwright + +Playwright is used for end-to-end testing. Install it with a `just` recipe: +```shell +just install-playwright +``` + ### Database setup diff --git a/justfile b/justfile index 4d3ef0dd3..76f57c1ac 100644 --- a/justfile +++ b/justfile @@ -16,7 +16,7 @@ default: # Install local tools install-tools: @cd {{solution-root}} && dotnet tool restore - npm install -g sass + @npm install -g sass # Restore dependencies restore: @@ -24,6 +24,10 @@ restore: @cd {{solution-root / "src" / "TeachingRecordSystem.SupportUi" }} && dotnet libman restore --verbosity quiet @cd {{solution-root / "src" / "TeachingRecordSystem.AuthorizeAccess" }} && dotnet libman restore --verbosity quiet +# Install Playwright +install-playwright: + @cd {{solution-root / "tests" / "TeachingRecordSystem.AuthorizeAccess.EndToEndTests"}} && pwsh bin/Debug/net8.0/playwright.ps1 install chromium + # Run the trscli cli *ARGS: @dotnet {{solution-root / "src" / "TeachingRecordSystem.Cli" / "bin" / "Debug" / "net8.0" / "trscli.dll"}} {{ARGS}}