diff --git a/README.md b/README.md index dc7e0e7..7e7e635 100644 --- a/README.md +++ b/README.md @@ -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) @@ -61,6 +62,33 @@ 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. + +To run the tests, enter the following command with the FA SDK consuming quickstart application server start command and port number: + +`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.