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

122 Add E2E Documentation #126

Merged
merged 6 commits into from
Jun 17, 2024
Merged
Changes from 5 commits
Commits
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
27 changes: 27 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
- [Development](#development)
- [Gotchas](#gotchas)
- [Manual testing](#manual-testing)
- [E2E testing](#e2e-testing)
- [Architecture](#architecture)
- [Release Process](#release-process)
- [Upgrade Policy](#upgrade-policy)
Expand Down Expand Up @@ -61,6 +62,32 @@ The SDKs provide the following functionality:
- Access token can be automatically and continuously refreshed
- Redirect callback is invoked after login or register

## E2E testing
The [Playwright](https://playwright.dev/docs/intro) end-to-end tests verify the proper functionality of several authentication and authorization endpoints in the FA SDK.

Prerequisites
- Ensure Playwright has been installed as a dependency
- On a seperate server run the FA SDK consuming quickstart application.

Configuration

The Playwright configuration (playwright.config.ts) includes settings for running tests in parallel, specifying browser environments, and defining the base URL the tests will perform on.

Running the Tests

Prior to running the tests you will want to check the Server Command that is used to start up a local instance of the FA SDK consuming quickstart application. Additionally you will want to note the port number this application will run on.
BriDavidson marked this conversation as resolved.
Show resolved Hide resolved

Run Tests:

`SERVER_COMMAND="your-server-start-command" PORT=your-port-number yarn test:e2e`
Example: `SERVER_COMMAND="npm run start" PORT=9011 yarn test:e2e`

Structure

The e2e tests are structured to use the Page Object Model (POM) design pattern. A POM is a design pattern in test automation that creates an object repository for web UI elements found in the pages directory. This makes tests more maintainable and reusable.
Example: In common.page.ts, methods for navigation and authentication are defined.
Tests import these page objects to perform actions, ensuring that if the UI changes, only the page object needs updating, not all the tests.

## Architecture

We use a monorepo because our SDKs share core functionality, which is contained in the @fusionauth-sdk/core package. This private module is bundled into the distributed SDK packages, allowing us to maintain core logic in a single place.
Expand Down