()
| 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", |
no test coverage detected
searching dependent graphs…