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 Dismiss Alert tests for WPT wdspec tests #7353

Merged
merged 6 commits into from Sep 27, 2017
Merged

Implement Dismiss Alert tests for WPT wdspec tests #7353

merged 6 commits into from Sep 27, 2017

Conversation

alchiem
Copy link
Contributor

@alchiem alchiem commented Sep 14, 2017

No description provided.

@w3c-bots
Copy link

w3c-bots commented Sep 14, 2017

Build PENDING

Started: None
Finished: None

Failing Jobs

  • firefox:nightly

View more information about this build on:

@alchiem
Copy link
Contributor Author

alchiem commented Sep 14, 2017

Testing webdriver dismiss alert spec.
http://www.w3.org/TR/webdriver/#dismiss-alert


def test_dismiss_confirm(session):
# 18.1 step 3
session.execute_script("window.confirm(\"Hello\");")
Copy link
Member

Choose a reason for hiding this comment

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

window.confirm returns a boolean based on whether it is accepted or dismissed. You should store that value on the window global and validate it.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

fixed


def test_dismiss_prompt(session):
# 18.1 step 3
session.execute_script("window.prompt(\"Enter Your Name: \", \"Federer\");")
Copy link
Member

Choose a reason for hiding this comment

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

window.prompt returns an empty string if accepted without value or null otherwise. Set this value on the window global to verify that the prompt gets dismissed.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

fixed

# 18.1 step 3
session.execute_script("window.result = window.prompt(\"Enter Your Name: \", \"Federer\");")
response = dismiss_alert(session)
assert None == session.execute_script("return window.result")
Copy link
Member

Choose a reason for hiding this comment

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

This should be assert session.execute_script("return window.result") is None.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

fixed

session.execute_script("window.result = window.prompt(\"Enter Your Name: \", \"Federer\");")
response = dismiss_alert(session)
assert None == session.execute_script("return window.result")
assert_success(response)
Copy link
Member

Choose a reason for hiding this comment

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

This should come before the assertion?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

fixed

session.execute_script("window.result = window.confirm(\"Hello\");")
response = dismiss_alert(session)
assert False == session.execute_script("return window.result;")
assert_success(response)
Copy link
Member

Choose a reason for hiding this comment

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

This should come before the assertion?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

fixed

# 18.1 step 3
session.execute_script("window.result = window.confirm(\"Hello\");")
response = dismiss_alert(session)
assert False == session.execute_script("return window.result;")
Copy link
Member

Choose a reason for hiding this comment

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

Should be session.execute_script("return window.result") is False.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

fixed

@andreastt andreastt merged commit d31bf6a into web-platform-tests:master Sep 27, 2017
jakearchibald pushed a commit to jakearchibald/web-platform-tests that referenced this pull request Nov 16, 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.

None yet

4 participants