Skip to content
This repository has been archived by the owner on Aug 7, 2024. It is now read-only.

[OTHER] Playwright automated tests for authenticated pages #5788

Closed
2 tasks
eddiejaoude opened this issue Apr 2, 2023 · 9 comments · Fixed by #6164
Closed
2 tasks

[OTHER] Playwright automated tests for authenticated pages #5788

eddiejaoude opened this issue Apr 2, 2023 · 9 comments · Fixed by #6164
Assignees
Labels
💻 aspect: code undefined 🤖 aspect: dx undefined 🔢 points: 5 undefined 🟧 priority: high undefined 🏁 status: ready for dev You can asked for this issue to be assigned (if not already assigned)

Comments

@eddiejaoude
Copy link
Member

eddiejaoude commented Apr 2, 2023

What would you like to share?

Playwright has an example of authenticated tests, to be able to test pages that require authentication

  • Logged in, can reach Account page and check title
  • Not logged in, trying to navigate to Account page, but redirected

Here are the Playwright docs https://playwright.dev/docs/auth but we don't want to use a real username and password, we want to mock those out, this blog might help https://dev.to/kuroski/writing-integration-tests-for-nextjs-next-auth-prisma-using-playwright-and-msw-388m

Additional information

Plan B: We could during testing switch to credential login and create a fake user in the DB

@eddiejaoude eddiejaoude added 💻 aspect: code undefined 🏁 status: ready for dev You can asked for this issue to be assigned (if not already assigned) 🤖 aspect: dx undefined 🟧 priority: high undefined 🔢 points: 5 undefined labels Apr 2, 2023
@github-actions
Copy link
Contributor

github-actions bot commented Apr 2, 2023

It's great having you contribute to this project

Welcome to the community 🤓

If you would like to continue contributing to open source and would like to do it with an awesome inclusive community, you should join our Discord chat and our GitHub Organisation - we help and encourage each other to contribute to open source little and often 🤓 . Any questions let us know.

@Vishrut19
Copy link
Member

Hey! No issue is assigned to me right now. So, can I try to work on this issue? If that's okay

@eddiejaoude
Copy link
Member Author

Sure, thanks Vishrut 👍

@Vishrut19
Copy link
Member

Hey! Can someone collaborate with me on this issue as it is very large for me? @eddiejaoude

@eddiejaoude
Copy link
Member Author

Hey! Can someone collaborate with me on this issue as it is very large for me? @eddiejaoude

@Vishrut19 you showed an interest in another issue, please only work on 1 issue at a time. I think it is best if I unassign this issue and you start with #5787. Also please read our contributing guidelines to keep things efficient https://github.com/EddieHubCommunity/LinkFree/blob/main/CONTRIBUTING.md#working-on-an-issue-get-it-assigned-to-you

@Vishrut19
Copy link
Member

Okay! I can understand as you have unassigned me from this issue. I will be working on issue #5787

@eddiejaoude
Copy link
Member Author

eddiejaoude commented Apr 11, 2023

Okay! I can understand as you have unassigned me from this issue. I will be working on issue #5787

As mentioned in issue #5787, please do not work directly on that issue, it is an EPIC which needs to be split into smaller issues, please see the link I shared above that has more information #5787 (comment) (any questions please ask in that issue, not this one)

@amandamartin-dev amandamartin-dev self-assigned this Apr 15, 2023
@amandamartin-dev
Copy link
Contributor

@eddiejaoude asking a potentially silly question here. Why not use a GitHub login stored in dot env so as to not expose the credentials versus standing up a separate server to try to intercept calls for the one test like in the blog example? Is this less secure or is there another reason I'm missing?

@eddiejaoude
Copy link
Member Author

@eddiejaoude asking a potentially silly question here. Why not use a GitHub login stored in dot env so as to not expose the credentials versus standing up a separate server to try to intercept calls for the one test like in the blog example? Is this less secure or is there another reason I'm missing?

There are no silly questions Amanda. If we need to use anything private like a "real" login (which I hope we don't need to) then yep we should store it in the .env file. TBH I didn't go through the blog, just had a very quick glance, so I am open to suggestions.

I am happy to bounce ideas on a call if easier, as I know this is a challenging ticket, just let me know in Discord.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
💻 aspect: code undefined 🤖 aspect: dx undefined 🔢 points: 5 undefined 🟧 priority: high undefined 🏁 status: ready for dev You can asked for this issue to be assigned (if not already assigned)
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants