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

fix(ui): broken playwright authentication for cleanup #1016

Merged
merged 20 commits into from
Sep 16, 2024

Conversation

andrewrisse
Copy link
Contributor

@andrewrisse andrewrisse commented Sep 10, 2024

Description

Our workflow currently does not run all the Playwright tests and there is a separate issue to enable all of them. After deleting and re-deploying Supabase on leapfrog-04, it was discovered then when running all the playwright tests with a locally running frontend against the backend on leapfrog-04, the cleanup steps that utilize playwright fixtures no longer worked.
The root cause of the issue was that the fakekeycloak user in leapforg-04 Supabase had previously had their keycloak password manually applied to their account in Supabase. Normally, when creating a user with Keycloak, Keycloak stores the password, and it is not stored in Supabase. Our playwright cleanup functions were trying to get an access token for a user using the service role key and the user's username/password, but the password no longer existed in Supabase.

CHANGES

This PR refactors the way we get an access token for playwright cleanup functions by using cookies instead. It works when keycloak is turned on or off. Additionally, it removes the need for the SERVICE_KEY_ROLE env variable.
The tests at test/chat.test.ts have also been added to the workflow to ensure these fixtures are utilized in the pipeline and this issue doesn't is caught if it ever happens again.

IMPORTANT
These changes allow e2e tests under the /tests folder that utilize the getOpenAI client or supabase clients to run. I attempted to run the chat.test.ts tests in the workflow, but only the 'it can chat with an assistant that doesnt have files' test would pass. The other tests can now run (which is what this PR fixes) but they could not get chat responses successfully from the backend. The chat.test.ts tests were removed from the workflow (as they were before) and this issue will need be addressed separately with #894. A comment was added to that issue to explain this problem.

Checklist before merging

@andrewrisse andrewrisse added the bug Something isn't working label Sep 10, 2024
@andrewrisse andrewrisse self-assigned this Sep 10, 2024
Copy link

netlify bot commented Sep 10, 2024

Deploy Preview for leapfrogai-docs canceled.

Name Link
🔨 Latest commit 7f9508f
🔍 Latest deploy log https://app.netlify.com/sites/leapfrogai-docs/deploys/66e1b4cad542c800087d7700

@andrewrisse andrewrisse marked this pull request as ready for review September 10, 2024 14:56
@andrewrisse andrewrisse requested a review from a team as a code owner September 10, 2024 14:56
@andrewrisse andrewrisse changed the title fix(ui): broken playwright authentication for cleanup bug(ui): broken playwright authentication for cleanup Sep 10, 2024
@andrewrisse andrewrisse changed the title bug(ui): broken playwright authentication for cleanup fix(ui): broken playwright authentication for cleanup Sep 10, 2024
@andrewrisse andrewrisse mentioned this pull request Sep 11, 2024
2 tasks
@andrewrisse andrewrisse merged commit 6d17187 into main Sep 16, 2024
24 checks passed
@andrewrisse andrewrisse deleted the fix-playwright-cleanup branch September 16, 2024 14:18
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants