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

111 Add Endpoints E2E Tests Phase 2 #118

Merged
merged 1 commit into from
Jun 12, 2024
Merged

Conversation

BriDavidson
Copy link
Collaborator

@BriDavidson BriDavidson commented Jun 11, 2024

What is this PR and why do we need it?

This PR aims to enhance the test coverage within the SDKs by adding tests to check endpoint behaviors across various authentication states. The tests cover scenarios for unauthenticated users, authenticated users, and post-logout behaviors, ensuring that cookies are correctly set and removed, endpoints are performing their required interactions with the FA API based on simulated real user interactions with the UI.

Changes Made

Added tests for GET /app/register

  • Logs out to ensure a clean state before starting the test.
  • Routes the /app/register endpoint and ensures that it triggers a 302 status redirect to the/oauth2/registerendpoint.
  • Verifies that the PKCE code challenge and code challenge method are included in the redirect URL.
  • Confirms that the redirect_uri is encoded and saved, redirecting to /app/callback.

Added tests for POST /app/refresh

  • Retrieves cookies from the browser context to find the app.rt, app.at, and app.at_exp cookies.
  • Sends a POST request to the /app/refresh/{clientId} endpoint using the authentication token and refresh token found in the cookies.
  • Verifies that the response status is 200 .
  • Checks that the app.at_exp cookie value has been updated (indicating a refreshed token) and is not equal to the original expiration time.
  • Ensures that the new app.at_exp cookie is set in the browser context.

Added tests for Baseline Authentication

  • Performs basic navigation checks in the Quickstart applications ensuring overall general functionality in authentication and navigation for users interacting with the UI.

Testing
To test these changes:

  1. Link the SDK being tested with the corresponding quickstart application.
  2. Run the web server of the quickstart application with the FA server.
  3. In a separate instance of your CLI, execute SERVER_COMMAND='' PORT= yarn test:e2e to run the end-to-end tests.
  4. These tests will need to be verified on Vue, Angular, and React, and all tests should pass successfully on each framework.

#111

Pre-Merge Checklist (if applicable)
[x] Unit and Feature tests have been added/updated for logic changes, or there is a justifiable reason for not doing so.

@BriDavidson BriDavidson self-assigned this Jun 11, 2024
@BriDavidson BriDavidson linked an issue Jun 11, 2024 that may be closed by this pull request
2 tasks
@JakeLo123 JakeLo123 merged commit e31e708 into main Jun 12, 2024
3 checks passed
@JakeLo123 JakeLo123 deleted the 111-add-endpoints-tests-phase-2 branch June 12, 2024 15:10
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.

Improve Testing Coverage by Adding Integration Tests
3 participants