Note: This is a suggestion only; it might be changed or abandoned at any time.
At the beginning, you have just your repository:
parent-directory
+-- <my-repository>
+-- site
You will need to change it to the following structure:
parent-directory
+-- <my-repository>
+-- e2e
+-- site
+-- invenio-e2e
+-- ...
+-- pnpm-workspace.yaml
-
Create a
pnpm-workspace.yamlfile in parent directory:# pnpm-workspace.yaml packages: - <my-repository>/e2e - invenio-e2e
-
Clone the
invenio-e2erepository from GitHub:gh repo clone oarepo/invenio-e2e # Switch to a feature branch if needed -
Create the
e2edirectory inside your repository:gh repo clone mesemus/sample-e2e-repository temp-repository mv temp-repository/e2e <my-repository>/e2e rm -rf temp-repository
-
Install dependencies:
cd <my-repository>/e2e pnpm install
-
Configure environment variables (see
src/config/env.tsfor all options):You will need a test user that can deposit records in your InvenioRDM instance.
export INVENIO_USER_EMAIL=... export INVENIO_USER_PASSWORD=...
-
Run your server in another terminal:
cd <my-repository> invenio-cli run
-
Run tests:
cd <my-repository>/e2e npx playwright test
The project also ships with a lightweight API regression suite that reuses the same authentication helpers as the UI tests.
-
Generate an authenticated storage state once by running:
npx playwright test tests/api/auth.setup.tsThe state is saved to
tests/playwright/.auth/user.jsonby default. Override the destination by setting theAUTH_USER_FILE_PATHenvironment variable. -
Execute the API suite:
npx playwright test tests/api/invenio-api.spec.tsRequests target various endpoints like
/api/recordsunless you provide a different base URL. See the JSDoc insrc/tests/apifor additional customization options.