hackathon-starter icon indicating copy to clipboard operation
hackathon-starter copied to clipboard

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

Open YasharF opened this issue 3 months ago • 10 comments

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

YasharF avatar Oct 05 '25 22:10 YasharF

Blocked on https://github.com/sahat/hackathon-starter/pull/1414

YasharF avatar Oct 05 '25 22:10 YasharF

@YasharF Does GitHub API keys mean GitHub Tokens? Where do I get the API keys from? Also, is there any other platform like discord where I can discuss queries?

akilesh1706 avatar Oct 07 '25 16:10 akilesh1706

Look for the GitHub section under https://github.com/sahat/hackathon-starter?tab=readme-ov-file#obtaining-api-keys

YasharF avatar Oct 07 '25 19:10 YasharF

Any updates? Let me know if you have any questions or stuck on something.

YasharF avatar Oct 11 '25 23:10 YasharF

Any updates? Let me know if you have any questions or stuck on something.

I'm working on it. Got stuck with a bit of work, will finish it soon.

akilesh1706 avatar Oct 12 '25 00:10 akilesh1706

I'm getting this error now, after I pulled the recent changes from the repo master branch. I tried changing the port to 587 from 465, but doesn't seem to work. Any idea on how do I resolve this? Here, I'm trying to create a new account by registering, shows this error.

ERROR: Could not send login by email link. Error: connect ETIMEDOUT 142.250.4.108:587 at TCPConnectWrap.afterConnect [as oncomplete] (node:net:1637:16) { errno: -4039, code: 'ESOCKET', syscall: 'connect', address: '142.250.4.108', port: 587, command: 'CONN' }

PS: I tried changing my network, it worked. Thanks.

akilesh1706 avatar Oct 13 '25 15:10 akilesh1706

@YasharF Raised a PR. Requesting for review.

akilesh1706 avatar Oct 13 '25 17:10 akilesh1706

Hi all — quick status check.

I'm a bit confused by the current state of this issue/PR: I see a few merged commits and related PRs referenced (e.g., #1414, #1421, #1462), but I'm not sure which branch or PR is considered the current work-in-progress and whether anything else is needed before this can be merged.

Could someone please clarify:

Which PR should be reviewed/merged next? Are there any outstanding blockers (tests, CI, or Mongo persistence setup) that I can help with? Is there a simple reproduction or checklist you want contributors to follow for the authenticated Playwright tests? Happy to help pick up any remaining work — just tell me where to jump in. Thanks!

Sid0004 avatar Oct 29 '25 06:10 Sid0004

It is in progress

YasharF avatar Oct 29 '25 07:10 YasharF

Ok.

Sid0004 avatar Oct 29 '25 07:10 Sid0004