Skip to content

Commit

Permalink
Development: Add different execution modes for local playwright setup (
Browse files Browse the repository at this point in the history
  • Loading branch information
SimonEntholzer authored Jan 5, 2025
1 parent 1c58a6d commit 24bab3c
Show file tree
Hide file tree
Showing 6 changed files with 43 additions and 10 deletions.
25 changes: 21 additions & 4 deletions supporting_scripts/playwright/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,10 +16,27 @@ In case you stop the client, you can simply re-run it at the root of the Artemis
## 2. Setup users

Playwright needs users for it's tests. If you do not have users set up, you can simply do so by running:
`setupUsers.sh`

```bash
setupUsers.sh
```

This will create 20 test users.

## 3. Setup Playwright and run Playwright in UI-mode
## 3. Setup Playwright and run Playwright tests

You can run Playwright tests in two different ways: running all tests or running in UI mode.

### Running All Tests
The `startPlaywright.sh` script runs the full suite of Playwright tests in a headless mode, outputting the results to the command line.
- Executes all test cases defined in the Playwright test suite.
- Runs in a headless environment for faster execution.
- Outputs test results, including logs, in the terminal.

### Running Tests in UI mode
The `startPlaywrightUI.sh` script starts Playwright in a graphical mode for debugging and interactive test execution.
- Launches a browser window to display available test cases.
- Allows manual selection and execution of individual or multiple tests.
- Provides real-time debugging features, such as visual test steps and screenshots.
- Useful for debugging and inspecting browser behavior during test execution.

Simply run: `startPlaywright.sh`. This will install the necessary dependencies for playwright and start it in UI mode.
If you already have playwright installed, you can also start playwright directly from the `src/test/playwright` directory with `npm run playwright:open`.
2 changes: 1 addition & 1 deletion supporting_scripts/playwright/runArtemisInDocker_linux.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

set -e

artemis_path="$(readlink -f "$(dirname $0)/../..")"
artemis_path="$(readlink -f "$(dirname "$0")/../..")"

cd "$artemis_path/docker"

Expand Down
2 changes: 1 addition & 1 deletion supporting_scripts/playwright/runArtemisInDocker_macOS.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

set -e

artemis_path="$(readlink -f "$(dirname $0)/../..")"
artemis_path="$(readlink -f "$(dirname "$0")/../..")"

cd "$artemis_path/docker"
open -a Docker
Expand Down
2 changes: 1 addition & 1 deletion supporting_scripts/playwright/setupUsers.sh
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
# We use the supporting scripts to create users

set -e
artemis_path="$(readlink -f "$(dirname $0)/../..")"
artemis_path="$(readlink -f "$(dirname "$0")/../..")"

cd "$artemis_path/supporting_scripts"

Expand Down
6 changes: 3 additions & 3 deletions supporting_scripts/playwright/startPlaywright.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

set -e

artemis_path="$(readlink -f "$(dirname $0)/../..")"
artemis_path="$(readlink -f "$(dirname "$0")/../..")"

echo "Installing Playwright and dependencies"

Expand All @@ -12,5 +12,5 @@ npm install

npm run playwright:setup-local || true

echo "Starting Playwright in UI mode"
npm run playwright:open
echo "Run all playwright tests"
npm run playwright:test
16 changes: 16 additions & 0 deletions supporting_scripts/playwright/startPlaywrightUI.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
#!/bin/sh

set -e

artemis_path="$(readlink -f "$(dirname "$0")/../..")"

echo "Installing Playwright and dependencies"

cd "$artemis_path/src/test/playwright"

npm install

npm run playwright:setup-local || true

echo "Start Playwright in UI mode"
npm run playwright:open

0 comments on commit 24bab3c

Please sign in to comment.