MCPcopy
hub / github.com/remix-run/react-router / runFormTests

Function runFormTests

integration/form-test.ts:521–1141  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

519 });
520
521 function runFormTests() {
522 test("posts to a loader", async ({ page }) => {
523 let app = new PlaywrightFixture(appFixture, page);
524 // this indirectly tests that clicking SVG children in buttons works
525 await app.goto("/get-submission");
526 await app.clickSubmitButton("/get-submission", { wait: true });
527 await page.waitForSelector(`pre:has-text("${CHEESESTEAK}")`);
528 });
529
530 test("posts to a loader with an <input name='action' />", async ({
531 page,
532 }) => {
533 let app = new PlaywrightFixture(appFixture, page);
534 await app.goto("/get-submission");
535 await page.locator(`#${FORM_WITH_ACTION_INPUT} button`).click();
536 await page.locator(`pre:has-text("${EAT}")`).waitFor();
537 });
538
539 test("posts to a loader with button data with click", async ({ page }) => {
540 let app = new PlaywrightFixture(appFixture, page);
541 await app.goto("/get-submission");
542 await page.locator("#buttonWithValue").click();
543 await page.locator(`pre:has-text("${LAKSA}")`).waitFor();
544 });
545
546 test("posts to a loader with button data with keyboard", async ({
547 page,
548 }) => {
549 let app = new PlaywrightFixture(appFixture, page);
550 await app.goto("/get-submission");
551 await page.focus(`#${KEYBOARD_INPUT}`);
552 await app.waitForNetworkAfter(async () => {
553 await page.keyboard.press("Enter");
554 // there can be a delay before the request gets kicked off (worse with JS disabled)
555 await new Promise((resolve) => setTimeout(resolve, 50));
556 });
557 await page.waitForSelector(`pre:has-text("${LAKSA}")`);
558 });
559
560 test("posts with the correct checkbox data", async ({ page }) => {
561 let app = new PlaywrightFixture(appFixture, page);
562 await app.goto("/get-submission");
563 await page.locator(`#${CHECKBOX_BUTTON}`).click();
564 await page.locator(`pre:has-text("${LAKSA}")`).waitFor();
565 await page.locator(`pre:has-text("${CHEESESTEAK}")`).waitFor();
566 });
567
568 test("posts button data from outside the form", async ({ page }) => {
569 let app = new PlaywrightFixture(appFixture, page);
570 await app.goto("/get-submission");
571 await page.locator(`#${ORPHAN_BUTTON}`).click();
572 await page.locator(`pre:has-text("${SQUID_INK_HOTDOG}")`).waitFor();
573 });
574
575 test(
576 "when clicking on a submit button as a descendant of an element that " +
577 "stops propagation on click, still passes the clicked submit button's " +
578 "`name` and `value` props to the request payload",

Callers 1

form-test.tsFile · 0.85

Calls 7

gotoMethod · 0.95
clickSubmitButtonMethod · 0.95
waitForNetworkAfterMethod · 0.95
getHtmlMethod · 0.95
uploadFileMethod · 0.95
getElementMethod · 0.95
getElementFunction · 0.85

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…