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 our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Innerbrowser submitForm uses wrong value for select. #3824

Closed
JorisVanEijden opened this Issue Dec 8, 2016 · 2 comments

Comments

Projects
None yet
2 participants
@JorisVanEijden
Contributor

JorisVanEijden commented Dec 8, 2016

Problem:

getFormFromCrawler() in the InnerBrowser adds an empty option to select elements that have no empty options.

This results in submitForm() submitting this empty value in stead of the default.

Testform:

<form method="post">
    <select name="test">
        <option value="_none">- None -</option>
    </select>
</form>

There is no option without a value and no default selected option so the getFormFromCrawler() method adds one:

    <select name="test">
        <option value=""></option>
        <option value="_none">- None -</option>
    </select>

The submitForm() method now submits test="" in stead of the correct test="_none"

Solution:

  1. Find out why extra <option> adding code was added in commit c048980
  2. Create another solution for whatever problem the extra <option> fixed.
  3. Remove the extra <option> adding code.

Details:

  • Codeception version: 2.2.6

JorisVanEijden added a commit to JorisVanEijden/Codeception that referenced this issue Dec 8, 2016

@JorisVanEijden

This comment has been minimized.

Show comment
Hide comment
@JorisVanEijden

JorisVanEijden Dec 8, 2016

Contributor

I created a PR: #3825 that adds a test for this issue and removes the extra <option> adding code.
All tests pass so still no idea why @zbateson added that code in the first place.

Contributor

JorisVanEijden commented Dec 8, 2016

I created a PR: #3825 that adds a test for this issue and removes the extra <option> adding code.
All tests pass so still no idea why @zbateson added that code in the first place.

@zbateson

This comment has been minimized.

Show comment
Hide comment
@zbateson

zbateson Dec 8, 2016

Member

Hi @JorisVanEijden

It's been a while since I've been active on this project -- but looking at my comment in the docblock it says "Codeception expects an empty value to match an unselected select box."

It's also possible that scenario isn't tested specifically, or its been fixed, but I expect since my code hadn't yet been removed that it probably hasn't been addressed :)

Member

zbateson commented Dec 8, 2016

Hi @JorisVanEijden

It's been a while since I've been active on this project -- but looking at my comment in the docblock it says "Codeception expects an empty value to match an unselected select box."

It's also possible that scenario isn't tested specifically, or its been fixed, but I expect since my code hadn't yet been removed that it probably hasn't been addressed :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment