test: create tests for index export button (#4117)#4217
Conversation
7cc3e57 to
f05f64d
Compare
MillenniumFalconMechanic
left a comment
There was a problem hiding this comment.
Really solid Jonah - thank you! Just a few nits and q's.
| header: detail, | ||
| value: ((await page.getByText(detailBoxRegexp).innerText()) | ||
| .trim() | ||
| .match(detailBoxRegexp) ?? ["", "ERROR"])[1], |
There was a problem hiding this comment.
This is an interesting one! I feel like it'd be slightly more readable if you handled the error case separately/explicitly rather than creating a dummy match array. I'd probably write it more like:
- Get the inner text, trim, match
- If the match is truthy, push the
[1]value to the headers array - Otherwise, push "
ERROR" to the headers array
Thoughts?
There was a problem hiding this comment.
I refactored it so that it just fails the test if the regex doesn't match fully, let me know if that works! I think it's a little easier to read this way.
There was a problem hiding this comment.
Got it. I think the regex complexities should be resolved when we started adding test IDs.
85d46fd to
30b8182
Compare
| await expect(exportButtonLocator).toBeVisible(); | ||
| await exportButtonLocator.click(); | ||
| await expect( | ||
| page.getByText(tab.indexExportPage.requestLandingMessage ?? "") |
There was a problem hiding this comment.
Do we need the nullish coalescing here now that requestLandingMessage is a required value? If it is still necessary, I feel it might make more sense to only execute the expect if there is a value for requestLandingMessage; that way, we will never be in a situation where we're calling page.getByText(""). Something like:
const requestLandingMessage = tab.indexExportPage.requestLandingMessage;
if ( requestLandingMessage ) {
expect(...)
}
There was a problem hiding this comment.
Whoops, no we don't! Thanks for catching that, I'll fix it
| header: detail, | ||
| value: ((await page.getByText(detailBoxRegexp).innerText()) | ||
| .trim() | ||
| .match(detailBoxRegexp) ?? ["", "ERROR"])[1], |
There was a problem hiding this comment.
Got it. I think the regex complexities should be resolved when we started adding test IDs.
30b8182 to
fc99db6
Compare
|
@MillenniumFalconMechanic I addressed your one comment, and also updated the test timeouts, since I noticed it had failed once because the loading screen after clicking the request button was taking long enough that it timed out. I'll document this as part of #4213, but just wanted to let you know! |
MillenniumFalconMechanic
left a comment
There was a problem hiding this comment.
LGTM, thanks Jonah!
Ticket
Closes #4117.
Reviewers
@NoopDog .
Changes
Questions