agama/playwright
2023-03-30 11:29:21 +01:00
..
config Adapt Playwright to Agama 2023-03-29 15:55:44 +01:00
lib Adapt Playwright to Agama 2023-03-29 15:55:44 +01:00
tests Remove references to D-Installer in Playwright 2023-03-30 11:29:21 +01:00
.gitignore Updated screenshots, automate the process using Playwright (#504) 2023-03-27 18:39:02 +02:00
global-setup.ts Test fixes, improved Playwright tests 2023-03-23 15:51:52 +01:00
package-lock.json Experimental integration tests using Playwright 2022-12-09 13:08:26 +01:00
package.json Experimental integration tests using Playwright 2022-12-09 13:08:26 +01:00
playwright.config.ts Updated screenshots, automate the process using Playwright (#504) 2023-03-27 18:39:02 +02:00
README.md Remove references to D-Installer in Playwright 2023-03-30 11:29:21 +01:00

Integration Tests

This directory contains integration tests which use the Playwright testing framework.

Installation

To install the Playwright tool run this command in the playwright subdirectory:

npm install

This will install the NPM packages into the node_modules subdirectory and download the browsers into the ~/.cache/ms-playwright directory.

Note: The downloaded browsers need almost 1GB, make sure you have enough space in your $HOME directory.

Files

  • playwright.config.ts - Playwright configuration, see documentation for more details
  • global-setup.ts - a helper for logging-in
  • tests/\*.spec.ts - individual test files
  • lib/* - shared library files

Running the Tests

To run all tests use this command:

npx playwright test

To run just a specific test:

npx playwright test tests/root_password.spec.ts

Updating the Screenshots

There is one test specially designed for refreshing the screenshots displayed in the main README.md file.

To fully run the installation type this:

RUN_INSTALLATION=1 BASE_URL=https://<host>:9090 npx playwright test --headed take_screenshots

The --headed option shows the browser window so you can see the progress. You can use the --debug option to run the test step-by-step.

The screenshots are saved to the screenshots/ subdirectory.

Target Server

By default the tests use the installer instance running locally at http://localhost:9090. If you want to run the tests against another instance set the BASE_URL environment variable:

BASE_URL=https://192.168.1.12:9090 npx playwright ...

You can use it also with the webpack development server:

BASE_URL=https://localhost:8080/ npx playwright ...

Options

The tests by default run in a headless mode, if you want to see the actions in the browser use the --headed option.

If you want to manually run a test step by step use the --debug option. This also allows to easily get the object selectors using the Explore button.

Troubleshooting Failed Integration Tests in CI

Single Test Failure

There are stored artifacts in the GitHub CI. Go to the failed job and there is a link "Summary". At the bottom of the page there is "Artifacts" section which contains the y2log and also trace.zip file. The trace can be browsed using the playwright tool locally or at page https://trace.playwright.dev/ to get details of the failure.

Stuck at D-Bus Loading

It usually indicates an issue with the Agama D-Bus services. There is a step called "Show D-Bus Services Logs" which should give a hint what is going wrong. Additional help can be the y2log file in the artifacts (see above).

Missing Package/Wrong Container

Packages lives in container at https://build.opensuse.org/package/show/YaST:Head:Containers/agama-testing . Feel free to modify it as the only purpose of this container is CI testing.