Skip to content

Add Playwright authentication capture + authenticated tests for GitHub API integration page #1420

@YasharF

Description

@YasharF

Update Oct 22: As we are approaching the end of October, I'll accept the first PR that is ready to be merged. No need for an exclusive issue assignment. Note that AI generated content including code, PR description, or issue reply text may be marked as SPAM.


Prerequisite:

  1. Have Hackathon Starter up and running with a local account.
  2. Have set valid GitHub API keys and have linked their local account to their GitHub account in Hackathon Starter's account page.

Scope:

  • Create test/helpers/playwright-auth-setup.js that can capture a session for a Hackathon Starter user who already has GitHub linked, and output the session state so it can be set as an environment variable. The output of node test/helpers/playwright-auth-setup.js should include instructions on how to set the environment variable.
  • Create test/e2e/github-authenticated.e2e.test.js for GitHub example page that use the session (via the environment variable) and Playwright to verify the portion of the page that require authentication. Note that these tests can't use mongo mongodb-memory-server and needs to use a persistence Mongo DB instance.
    - The test should be able to run both for a local account that has GitHub linked, and an account that was created using GitHub without a local account. Please verify this manually. You would need to delete your Hackathon Starter accounts thru the accounts page.
  • npx playwright test --config=test/playwright.config.js test/e2e/github-authenticated.e2e.test.js should run the new tests with all passing.
  • Update the readme

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions