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 1 #114

Merged
merged 3 commits into from
Jun 6, 2024

Conversation

BriDavidson
Copy link
Collaborator

@BriDavidson BriDavidson commented Jun 5, 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/me

  • Verifies the presence of the app.at cookie.
  • Sends a request to /app/me endpoint with the authentication token.
  • Asserts that the response content type is application/json and the response is successful.

Added tests for GET /app/logout

  • Checks for the presence of required cookies before logout.
  • Routes the /app/logout endpoint and ensures a 302 status redirect to /oauth2/logout.
  • Verifies that the cookies are cleared post-logout.

Added tests for GET /app/login

  • Logs out before starting the test.
  • Routes the /app/login endpoint and ensures a 302 status redirect to /oauth2/authorize.
  • Verifies that the PKCE code challenge is passed along correctly and set.
  • Confirms that the redirect_uri is encoded and saved to the state, redirecting to /app/callback.

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 5, 2024
@BriDavidson BriDavidson linked an issue Jun 5, 2024 that may be closed by this pull request
2 tasks
@JakeLo123
Copy link
Collaborator

JakeLo123 commented Jun 6, 2024

Great idea to add those command line arguments. I think that's perfect because the tests don't know which framework they're testing, they just get configured with the port and server command. 👏

Let's make sure we add practical instructions for running these tests to our README soon. I commented that on issue 111

@JakeLo123 JakeLo123 merged commit c698a3a into main Jun 6, 2024
3 checks passed
@JakeLo123 JakeLo123 deleted the re-111-add-endpoints-e2e-tests-pt1 branch June 6, 2024 20:31
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
2 participants