Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Development: Add different execution modes for local playwright setup #10064

Merged
merged 5 commits into from
Jan 5, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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`.
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
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
Loading