IUSCA / bioloop

Scientific data management portal and pipeline application template
Other
4 stars 2 forks source link

152 - added playwright config, tests and dev setup #225

Closed ri-pandey closed 7 months ago

ri-pandey commented 7 months ago

Description

Added Playwright test config, and some proof-of-concept tests.

Related Issue(s)

Closes #152

Changes Made

List the main changes made in this PR. Be as specific as possible.

Checklist

Before submitting this PR, please make sure that:

Additional Information

This PR contains the setup for Playwright, and some tests. The current set of tests asserts

  1. role-specific features
  2. the navigation guard intercepting attempts to access the app UI while logged out

This documentation explains the authentication bypass mechanism that's needed to make the tests pass, how to configure Playwright and how to setup your tests to run in a logged-out/logged-in state.

The only changes made to the application code are:

  1. Adding data-testids to DOM elements, which is used by the tests.
  2. Ignoring the ticket verification logic in CI environment.
deepakduggirala commented 7 months ago

Add the below to config/default.json. It makes it easier to add new configs under e2e key


"e2e": {
    "users": {
      "admin": {
        "username": ""
      },
      "operator": {
        "username": ""
      },
      "user": {
        "username": ""
      }
    }
  }```
ri-pandey commented 7 months ago

I have dockerized the tests so they can be more easily run on dev's machines. The instructions on how to do so have been updated.

I have also added an alert that displays the envrionment (pictured below). The alert is shown in logged-in as well as logged-out views. This is achieved by an unauthenticated route that simply returns the process.env.NODE_ENV that's set on the API-side.

Screenshot 2024-04-26 at 9 25 48 AM Screenshot 2024-04-26 at 9 26 00 AM

The envs that this alert needs to enabled for can be configured in ui/config.js in property alertForEnvironments.