Skip to content

feat: add auth endpoint for playwright tests against dev server deployment#315

Merged
allison-truhlar merged 14 commits intomainfrom
add-auth-for-playwright-against-dev-server-tests
Mar 13, 2026
Merged

feat: add auth endpoint for playwright tests against dev server deployment#315
allison-truhlar merged 14 commits intomainfrom
add-auth-for-playwright-against-dev-server-tests

Conversation

@allison-truhlar
Copy link
Collaborator

@allison-truhlar allison-truhlar commented Feb 23, 2026

Clickup id: 86ae17ge1

This PR adds an endpoint specifically for use on the fileglancer-dev server deployment to enable Playwright integration test to bypass the Okta multi-factor authentication. This endpoint is disabled by default, and requires a flag to enable it as well as a key that matches the key provided by the Playwright tests.

To test:

  • Checkout the fileglancer-janelia repo and switch to the playwright-tests-against-fileglancer-dev repo.
  • Inside /fileglancer-janelia/playwright, add a .env file with the value of FGC_TEST_API_KEY found in the .env file on fileglancer-dev.
  • Run the tests from /fileglancer-janelia, using the command pixi run test-ui

Merging this PR will mean JaneliaSciComp/fileglancer-janelia#2 and JaneliaSciComp/fileglancer-hub#12 are also ready to merge.

@krokicki

@allison-truhlar
Copy link
Collaborator Author

allison-truhlar commented Mar 13, 2026

I made the requested changes to remove the extra enable_test_api_key setting and also to limit the login username to only jacs, in commit 38c8e46. This is now ready for review.

Copy link
Member

@neomorphic neomorphic left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

As it stands, this looks fine to me. We could simplify the requests by removing the username header, but that is not essential. See my additional comment.

raise HTTPException(status_code=400, detail="X-API-Username header is required")

if username != "jacs":
raise HTTPException(status_code=403, detail="Username not permitted for test login")
Copy link
Member

@neomorphic neomorphic Mar 13, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Since we are limiting this login to a single user account, Is there any point in checking the username and forcing the tests to provide it. We could just hard code it in the db.create_session() call. We could also set this as a configurable username that can be changed in the settings.py

Copy link
Collaborator Author

@allison-truhlar allison-truhlar Mar 13, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That makes sense - it's probably also better not to have the username hard-coded and exposed in frontend code. I made this suggested change in commit 446145d in this repo and in commit JaneliaSciComp/fileglancer-janelia@68334c6 in fileglancer-janelia. I made a new Fileglancer alpha release, 2.7.0a2, that is currently running on fileglancer-dev with these changes. I confirmed the new fileglancer-janelia setup code without the username works to run the tests against fileglancer-dev.

@allison-truhlar allison-truhlar merged commit c947d75 into main Mar 13, 2026
7 checks passed
@allison-truhlar allison-truhlar deleted the add-auth-for-playwright-against-dev-server-tests branch March 13, 2026 20:17
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.

2 participants