-
-
Notifications
You must be signed in to change notification settings - Fork 29
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
Change password playwright tests #1358
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM, but I believe I should let Chris review this too before it's merged. Because I've been looking at this code for days, and if there's a flaw in it, I'll miss it because of being too familiar with it by this point.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Great job @JeanneSon and @rmunn - you are paving the way for our E2E tests and in this PR we have established a good pattern:
- we have a beforeAll() which opens the tab
- each test() will re-use the existing tab
- each playwright file will be a unit. Multiple files should be able to be run in parallel
- test fixtures provide setup data for the application and ease of accessing that metadata
* Tab fixtures: extract data setup into own function This is in preparation for creating new admin/member/etc. fixtures that parallel adminTab, memberTab, etc., but which don't create a new browser context; they will only carry data. * Add new UserDetails fixtures (faster than UserTab) If you just need user details like username, password, etc., it's overkill to request a whole adminTab or memberTab just to access its username and password. Instead, we create 'admin' and 'member' (and so on) fixtures to just contain the data. These fixtures are extremely fast to create, speeding up some tests that didn't need a full browser tab. * Speed up change password tests by reusing fixtures In some cases, it can make sense to reuse a browser context fixture for efficiency's sake (it can take a second or two to create a new browser context). The "change password" tests are one such case, because the tests don't actually need a new browser tab for the ones that simply verify whether a button is disabled. Note that when beforeEach was changed to beforeAll, we had to remove the page.close() and context.close() calls from the fixture setup. Otherwise we'd have closed changePasswordPage over that browser tab instance and then immediately closed it when the fixture went out of scope at the end of beforeAll. Which would result in every test failing due to its browser tab having been closed! In this commit, we also use the more-efficient member fixtures instead of memberTab when all we want is the username and password. * Improve TypeScript typing of test function With the `test.extend` feature in Playwright, it's better to extend it once with a large number of fixture definitions, rather than extend it multiple times with one fixture each. The former results in a much nicer TypeScript type overlay when you over over the `test` function later.
728f7ba
to
188262c
Compare
Description
The following tests have been converted to playwright
Bellows E2E Change Password app
✓ setup: login as user, go to change password page
✓ refuses to allow form submission if the confirm input does not match
✓ allows form submission if the confirm input matches
[previously commented out] should not allow a password less than 7 characters
✓ can successfully changes user's password after form submission
For details/remarks regarding converting the above tests, refer to the spreadsheet; https://docs.google.com/spreadsheets/d/1w9wjfm-02QHLhv0ObPAKKlqnDWeag379GIXwOcRU4W0/edit#gid=0
Type of Change
E2E test
Screenshots
Checklist