Skip to content

Should submitting a form via pressButton wait for page load? #110

@uuf6429

Description

@uuf6429

Many tests, such as \Behat\Mink\Tests\Driver\Form\Html5Test::testHtml5FormInputAttribute, seem to guard against the possibility of asserting things after a form is submitted, but before the next page is loaded.

Some other tests, notably* \Behat\Mink\Tests\Driver\Form\GeneralTest::testSubmitEmptyTextarea seem to assume the opposite - after a button is submitted, the fully-loaded page is expected.

Which case should it be?

  1. should pressButton (and similar) detect submission and wait for the page to load?
  2. should methods in general wait for the page to be fully loaded?
  3. or is that specific methods - such as page->getContent() are supposed to block until page load?

*after many tries, I managed to get that test to fail locally with the following error:

Failed asserting that '<html lang="en"><head>\n
    <title>Empty textarea submission</title>\n
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">\n
</head>\n
<body>\n
    <h1>Empty textarea submission</h1>\n
    <form method="POST" action="advanced_form_post.php">\n
        <textarea name="textarea"></textarea>\n
        <input type="submit" name="submit" value="Save">\n
    </form>\n
\n
\n
</body></html>' contains "textarea = ``,".

but the following screenshot:

Image

which seems to prove that the test checked the content of the previous page instead of the submit result page.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions