Skip to content

oarepo/invenio-e2e

Repository files navigation

E2E Testing Framework for Invenio

Note: This is a suggestion only; it might be changed or abandoned at any time.

Dependencies

How to Try It Out

Directory Structure

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

Steps

  1. Create a pnpm-workspace.yaml file in parent directory:

    # pnpm-workspace.yaml
    packages:
      - <my-repository>/e2e
      - invenio-e2e
  2. Clone the invenio-e2e repository from GitHub:

    gh repo clone oarepo/invenio-e2e
    # Switch to a feature branch if needed
  3. Create the e2e directory inside your repository:

    cp -r invenio-e2e/e2e <my-repository>/e2e
  4. Install dependencies:

    cd <my-repository>/e2e
    pnpm install
  5. Configure environment variables (see src/config/env.ts for all options):

Setup a test user and admin (and possibly other users) in your InvenioRDM instance with the credentials matching those in your environment variables (see src/config/env.ts).:

source .venv/bin/activate

invenio users create user@demo.org --password 123456 --active --confirm

invenio roles create admin
invenio access allow administration-access role admin
invenio users create admin@demo.org --password 123456 --active --confirm
invenio roles add admin@demo.org admin
invenio access allow superuser-access user admin@demo.org

export INVENIO_USER_EMAIL=user@demo.org
export INVENIO_USER_PASSWORD=123456
  1. Add this to your invenio.cfg to enable tests for the FETCH transport:
# invenio.cfg

RECORDS_RESOURCES_FILES_ALLOWED_DOMAINS = [
    "inveniordm.docs.cern.ch",
]
  1. Initialize translations
source .venv/bin/activate
cd e2e
npm run build-translations -- -l en
npm run build-translations -- -l de
npm run build-translations -- -l cs
  1. Run your server in another terminal:

    cd <my-repository>
    invenio-cli run
  2. Run tests:

    cd <my-repository>/e2e
    npx playwright test

Tests can be filtered with the following tags:

  • @api - run API tests
  • @smoke - run smoke tests

Example:

    npx playwright test --grep "@api|@smoke"

What is tested

API

UI

Translations

Development

This package contains linter configuration and scripts to build and test the code. Please run:

pnpm install

npm run lint
npm run lint:fix

npm run prettier
npm run prettier:fix

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors