Skip to content
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

Implement Send Alert Text tests for WPT wdspec tests #8155

Merged
merged 2 commits into from
Nov 13, 2017
Merged

Implement Send Alert Text tests for WPT wdspec tests #8155

merged 2 commits into from
Nov 13, 2017

Conversation

alchiem
Copy link
Contributor

@alchiem alchiem commented Nov 10, 2017

delete trailing whitespace

Deleted unused import. Simplified send alert text test.

Test non string input. Test text with whitespace. Formatting fixes.

Add more tests for invalid input

Copy link
Member

@andreastt andreastt left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for testing invalid input. The test is unnecessarily complicated and could be simplified using parametrization. I’ve included an example of how to make the test simpler.

Once you make that final change, I think this PR is ready for integration.

"number": 123}
session.execute_script("window.result = window.prompt(\"Enter Your Name: \", \"Name\");")
for item in elements:
body = {"text": elements[item]}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This iterator is not very Pythonic. Can you change the test to use @pytest.parametrize?

This would look roughly something like this:

@pytest.parametrize("text", [None, {}, [], 42, True])
def test_invalid_input(session, text):
    session.execute_script("""window.result = window.prompt("foo")""")
    response = send_alert_text(session, {"text": text})
    assert_error(response, "invalid argument")

Note that I haven’t run the above code.

@andreastt
Copy link
Member

Also, there are conflicts which you must resolve.

alchiem and others added 2 commits November 13, 2017 12:00
delete trailing whitespace

Deleted unused import. Simplified send alert text test.

Test non string input. Test text with whitespace. Formatting fixes.

Add more tests for invalid input

Initiate the prompt once only

Parametrize invalid input test
@w3c-bots
Copy link

w3c-bots commented Nov 13, 2017

Build PASSED

Started: 2017-11-13 21:59:17
Finished: 2017-11-13 22:06:42

Failing Jobs

  • chrome:unstable

View more information about this build on:

@andreastt andreastt merged commit 698818a into web-platform-tests:master Nov 13, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants