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

Configure E2E testing package #1493

merged 29 commits into from
Mar 12, 2024

Conversation

trslater
Copy link
Collaborator

@trslater trslater commented Mar 11, 2024

  • Move end-to-end tests
  • Clean up env data
  • Clean up unused files
  • Add types for Node
  • Allow .env configurable secrets for local dev
  • Allow .env configurable base URL
  • Align editor style with other projects
  • Add template.env and instructions to setup local secrets
  • Add some more detailed instructions
  • Ignore appropriate files
  • Configure projects for browsers
  • Frontend (e.g., portal, ALCS) selectable via directory
  • Add basic portal inbox test
  • Add parameterized login fixture
  • Add/config eslint/prettier

@trslater trslater marked this pull request as ready for review March 11, 2024 19:49
@@ -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

@@ -35,16 +36,27 @@ export default defineConfig({
{
name: 'chromium',
use: { ...devices['Desktop Chrome'] },
testIgnore: '**',
Copy link
Collaborator

Choose a reason for hiding this comment

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

Is this temporary? Whats the long term plan here?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

This is a base project, so is never run by itself. It just includes Chrome for use in other projects.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

After re-investigating this, I don't think this works for multiple browsers. I'll come up with a better solution.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Project dependencies did not work how I thought. I've changed the way this works. Now, projects only select browser, and frontend is selected via directory. Each top-level directory will have its own fixtures file that sets the base URL via the environment (this will allow us to modify the URL for dev/test/local as needed).

- Frontend now selected via directory
- Fixtures now per-frontend
- Base URL is set in frontend's fixtures file
e2e/package.json Outdated
@@ -18,7 +18,17 @@
"url": "https://github.com/bcgov/alcs/issues"
},
"homepage": "https://github.com/bcgov/alcs#readme",
"dependencies": {
"@playwright/test": "^1.32.0",
"@types/node": "^20.11.24",
Copy link
Collaborator

Choose a reason for hiding this comment

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

nitpick: This doesn't matter since this won't get shipped but types should go in devDependencies

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Could be. I considered it as a main dependency since running the E2E tests is what this package does. I think you could make the case either way.

Copy link
Collaborator

Choose a reason for hiding this comment

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

The transpiled code will be JS not TS, meaning the types won't be used.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Good point. Changed.

Copy link
Collaborator

@dhaselhan dhaselhan left a comment

Choose a reason for hiding this comment

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

LGTM 👍

inboxLoggedIn: Page;
}

export const test = base.extend<FixtureOptions & Fixtures>({
Copy link
Collaborator

Choose a reason for hiding this comment

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

Ideally the name of fixture should represent the action that it performs, in this case it is login

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 does, on line 18: inboxLoggedIn. The way fixtures work in Playwright is that you extend the main test function with an object that contains the fixtures.

Copy link
Collaborator

@mhuseinov mhuseinov left a comment

Choose a reason for hiding this comment

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

👍

@trslater trslater merged commit af1c28d into develop Mar 12, 2024
3 checks passed
@trslater trslater deleted the task/ALCS-1758 branch March 12, 2024 19:38
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants