Should submitting a form via pressButton wait for page load?

Open
#110 6 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Assessment

Difficulty
4/5
Estimated time
3-5 days
Newbie friendliness
30/100
Issue type
Bug
Clarity
Needs clarification
Activity status
Stale
Tech stack
php
Domain
testing

Research direction

Start with the named tests, especially Form\Html5Test::testHtml5FormInputAttribute and Form\GeneralTest::testSubmitEmptyTextarea, then inspect the pressButton and page->getContent() entry points. Compare when each test observes navigation and determine the intended loading contract. Done means the relevant tests consistently verify that contract without reading the previous page.

Written by the indexing model from the issue text.

Description

bug question

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.

Dominant language
PHP
Stars
8
Forks
29
Avg merge
22h 21m
Merged PRs (30d)
2

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from minkphp/driver-testsuite

All issues in minkphp/driver-testsuite

Similar issues

More PHP issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.