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

Configure E2E testing package #1493

Merged
merged 29 commits into from
Mar 12, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
29 commits
Select commit Hold shift + click to select a range
23a4349
Move end-to-end tests
trslater Mar 1, 2024
60b7b59
Clean up env data
trslater Mar 1, 2024
7ba82a6
Clean up unused files
trslater Mar 1, 2024
a7e3fbd
Add types for Node
trslater Mar 1, 2024
9ccd635
Allow .env configurable secrets for local dev
trslater Mar 1, 2024
13a6781
Align editor style with other projects
trslater Mar 1, 2024
02fe763
Add `template.env` and instructions to setup local secrets
trslater Mar 1, 2024
d02eac4
Add table of contents
trslater Mar 1, 2024
f2e12fe
First draft of GitHub actions for E2E testing
trslater Mar 5, 2024
dd674ee
Remove unnecessary editor config
trslater Mar 5, 2024
d216722
Replace user/pass env vars with correct name
trslater Mar 5, 2024
2fde234
Add expect statement to test
trslater Mar 5, 2024
3c56819
Fix UI mode instructions
trslater Mar 5, 2024
46beaae
Add back editor config
trslater Mar 5, 2024
82051b4
Ignore test results
trslater Mar 5, 2024
ecdcc9e
Configure project for portal
trslater Mar 5, 2024
ddde7ae
Improve login test
trslater Mar 5, 2024
0c1dabd
Add instructions on running projects
trslater Mar 5, 2024
55ee278
Fix comment on cron
trslater Mar 6, 2024
a578144
Allow running E2E tests manually
trslater Mar 6, 2024
352b23f
Use correct branch and working-dir
trslater Mar 6, 2024
d67686d
Do not include GitHub workflow in this branch
trslater Mar 11, 2024
28d1696
Start writing tests instructions
trslater Mar 11, 2024
66f1f19
Use basic login fixture
trslater Mar 11, 2024
76a41cc
Run tests against dev env for now
trslater Mar 11, 2024
cf98b33
Load base URL from environment
trslater Mar 11, 2024
d17ead4
Create better frontend/browser selection strategy
trslater Mar 12, 2024
b97c5ab
Setup Prettier/eslint
trslater Mar 12, 2024
8ef944d
Move Node types to dev deps
trslater Mar 12, 2024
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
16 changes: 16 additions & 0 deletions e2e/.editorconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
# Editor configuration, see https://editorconfig.org
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should we use prettier like all our other packages?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I copied this from portal frontend, so does it need to be updated as well?

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not sure, I have no idea what this file does.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It configures the code style for editors. It's set up the same for portal and ALCS frontends, not for services. Perhaps it is part of Angular scaffolding?

For now I'll leave it, but I'll install prettier as a dev dep and include .prettierrc as well.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Added prettier and eslint

root = true

[*]
charset = utf-8
indent_style = space
indent_size = 2
insert_final_newline = true
trim_trailing_whitespace = true

[*.ts]
quote_type = single

[*.md]
max_line_length = off
trim_trailing_whitespace = false
2 changes: 2 additions & 0 deletions e2e/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
.env
test-results/
8 changes: 8 additions & 0 deletions e2e/.prettierrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
{
"printWidth": 120,
"singleQuote": true,
"useTabs": false,
"tabWidth": 2,
"semi": true,
"bracketSpacing": true
}
87 changes: 87 additions & 0 deletions e2e/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,87 @@
# End-to-End Testing

- [Writing Tests](#writing-tests)
- [Running Tests](#running-tests)
- [Local Setup](#local-setup)
- [Installation](#installation)
- [Configure secrets](#configure-secrets)

E2E test automation is implemented using the [Playwright](https://playwright.dev/).

> [!WARNING]
> When writing tests, make sure they do not contain any credentials _before_ committing to the repo.

## Writing Tests

- Write tests for a given project, i.e., tests for the portal go in `/e2e/tests/portal`.

## Running Tests

To run tests:

```bash
$ npx playwright test
```

To run tests just for a specific browser:

```bash
$ npx playwright test --project=[chromium]
```

To run tests just for a specific frontend, specify by directory:

```bash
$ npx playwright test portal/
```

These can be combined:

````bash
$ npx playwright test --project=chromium portal/
```

To run headed:

```bash
$ npx playwright test --headed
````

To run in UI mode:

```bash
$ npx playwright test --ui
```

To run in debug mode:

```bash
$ npx playwright test --debug
```

To show a report:

```bash
$ npx playwright show-report REPORT_DIR
```

## Local Setup

### Installation

Install package:

```bash
$ npm i
```

Install browsers:

```bash
$ npx playwright install
```

### Configure secrets

1. Copy `template.env` --> `.env`
2. Fill in details
Loading