Skip to content

[ENHANCEMENT] [MER-5850] Add parameterized OAuth login Playwright tests - #6764

Open
manelli wants to merge 2 commits into
masterfrom
MER-5850/automation-tests/oauth-login
Open

[ENHANCEMENT] [MER-5850] Add parameterized OAuth login Playwright tests#6764
manelli wants to merge 2 commits into
masterfrom
MER-5850/automation-tests/oauth-login

Conversation

@manelli

@manelli manelli commented Aug 6, 2026

Copy link
Copy Markdown
Collaborator

Summary

Adds fully parameterized Playwright smoke tests for Google OAuth login across Torus account classes and deployment environments.

The suite covers:

  • Learner login through /users/log_in
  • Author login through /authors/log_in
  • Redirect to Google authorization
  • Successful Torus callback
  • Correct account type and workspace
  • Session persistence after reload
  • Logout and return to the public/login state

Implementation

  • Adds one parameterized test case for each account class: learner and author.
  • Reads the target environment, account credentials, selectors, paths, and expected UI from the YAML selected by PLAYWRIGHT_PARAMETER_CONFIG_URL.
  • Runs headed Chrome because Google may reject automated headless authentication.
  • Disables tracing to avoid storing credentials, cookies, and OAuth response data.
  • Validates runtime configuration and rejects placeholder values before attempting login.
  • Adds npm run test-oauth-logins.

Full configuration documentation is in assets/automation/README.md.

Prerequisites

Each target environment requires:

  • Google OAuth enabled in Torus.
  • One dedicated learner Google account.
  • One dedicated author Google account.
  • Accounts without MFA, CAPTCHA, recovery, or other interactive challenges.
  • The Google identities linked to the correct Torus account class.
  • A private YAML configuration containing the account credentials and target URL.

Do not commit credentials or the runtime YAML.

All commands below should be run from:

cd assets/automation

Testing locally

Configure a Google OAuth web client with these authorized redirect URIs:

http://localhost/users/auth/google/callback
http://localhost/authors/auth/google/callback

Start Torus with the OAuth client credentials set (GOOGLE_CLIENT_ID, GOOGLE_CLIENT_SECRET):

Set the YAML target:

target:
  base_url: http://localhost

Fill in the learner and author account values, including the exact Torus display names.

Serve the configuration on loopback:

python3 -m http.server 8787 --bind 127.0.0.1 --directory /tmp

Run:

PLAYWRIGHT_PARAMETER_CONFIG_URL=http://127.0.0.1:8787/oauth-local.yaml \
  npm run test-oauth-logins

Testing Tokamak/Stellarator
Use dedicated accounts already linked in Tokamak and set:

target:
  base_url: https://tokamak.oli.cmu.edu

Run:

PLAYWRIGHT_PARAMETER_CONFIG_URL=http://127.0.0.1:8787/oauth-tokamak.yaml \
  npm run test-oauth-logins

See: https://eliterate.atlassian.net/browse/MER-5850

@manelli
manelli marked this pull request as ready for review August 6, 2026 21:30
@github-actions

github-actions Bot commented Aug 7, 2026

Copy link
Copy Markdown
Contributor

Risk score: 3 → risk/low

Generated by 🚫 dangerJS against e5ab70a

@github-actions

github-actions Bot commented Aug 7, 2026

Copy link
Copy Markdown
Contributor

AI Review —

No issues found

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant