- Notifications
You must be signed in to change notification settings - Fork928
test: fix url checks in e2e tests#12881
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 ourterms of service andprivacy statement. We’ll occasionally send you account related emails.
Already on GitHub?Sign in to your account
Uh oh!
There was an error while loading.Please reload this page.
Changes fromall commits
2c8c3fb
20906d5
a47e239
00cd477
d5b90f4
9319811
3b4c28f
8b1393f
File filter
Filter by extension
Conversations
Uh oh!
There was an error while loading.Please reload this page.
Jump to
Uh oh!
There was an error while loading.Please reload this page.
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
import { expect, type Page } from "@playwright/test"; | ||
type PollingOptions = { timeout?: number; intervals?: number[] }; | ||
export const expectUrl = expect.extend({ | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others.Learn more. This is so interesting. Can we keep a set of extensions and just make it some generic "expectCoder" or something? I just wonder if we'll build up a set of these. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others.Learn more. I think having several of them would be a fine outcome personally. This sort of "scoped custom | ||
/** | ||
* toHavePathName is an alternative to `toHaveURL` that won't fail if the URL contains query parameters. | ||
*/ | ||
async toHavePathName(page: Page, expected: string, options?: PollingOptions) { | ||
let actual: string = new URL(page.url()).pathname; | ||
let pass: boolean; | ||
try { | ||
await expect | ||
.poll(() => (actual = new URL(page.url()).pathname), options) | ||
.toBe(expected); | ||
pass = true; | ||
} catch { | ||
pass = false; | ||
} | ||
return { | ||
name: "toHavePathName", | ||
pass, | ||
actual, | ||
expected, | ||
message: () => "The page does not have the expected URL pathname.", | ||
}; | ||
}, | ||
}); |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -116,6 +116,7 @@ export const CreateTokenForm: FC<CreateTokenFormProps> = ({ | ||
{lifetimeDays === "custom" && ( | ||
<TextField | ||
data-chromatic="ignore" | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others.Learn more. Not sure what this is 🤔 There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others.Learn more. someone let a leaky date sneak in to chromatic again, so I'm muting it 😅 | ||
type="date" | ||
label="Expires on" | ||
defaultValue={dayjs().add(expDays, "day").format("YYYY-MM-DD")} | ||