Skip to content

Commit

Permalink
webdriver: fix is_fullscreen assertions
Browse files Browse the repository at this point in the history
The "is True" and "is False" style is unnecessary as the return
values are boolean, which means "assert is_fullscreen(session)"
and "assert not is_fullscreen(session)" is sufficient.

Depends on D8404

Differential Revision: https://phabricator.services.mozilla.com/D8405

bugzilla-url: https://bugzilla.mozilla.org/show_bug.cgi?id=1492499
gecko-commit: 246b45eae45c12e0755be1665208309d2e9f4b6f
gecko-integration-branch: autoland
gecko-reviewers: automatedtester
  • Loading branch information
andreastt authored and moz-wptsync-bot committed Oct 31, 2018
1 parent 75b0f33 commit 342f7cf
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 16 deletions.
8 changes: 4 additions & 4 deletions webdriver/tests/fullscreen_window/fullscreen.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ def test_fullscreen(session):
response = fullscreen(session)
assert_success(response)

assert is_fullscreen(session) is True
assert is_fullscreen(session)


def test_payload(session):
Expand All @@ -47,12 +47,12 @@ def test_payload(session):


def test_fullscreen_twice_is_idempotent(session):
assert is_fullscreen(session) is False
assert not is_fullscreen(session)

first_response = fullscreen(session)
assert_success(first_response)
assert is_fullscreen(session) is True
assert is_fullscreen(session)

second_response = fullscreen(session)
assert_success(second_response)
assert is_fullscreen(session) is True
assert is_fullscreen(session)
14 changes: 6 additions & 8 deletions webdriver/tests/fullscreen_window/user_prompts.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,41 +24,39 @@ def is_fullscreen(session):
@pytest.fixture
def check_user_prompt_closed_without_exception(session, create_dialog):
def check_user_prompt_closed_without_exception(dialog_type, retval):
assert is_fullscreen(session) is False
assert not is_fullscreen(session)

create_dialog(dialog_type, text=dialog_type)

response = fullscreen(session)
assert_success(response)

assert_dialog_handled(session, expected_text=dialog_type, expected_retval=retval)

assert is_fullscreen(session) is True
assert is_fullscreen(session)

return check_user_prompt_closed_without_exception


@pytest.fixture
def check_user_prompt_closed_with_exception(session, create_dialog):
def check_user_prompt_closed_with_exception(dialog_type, retval):
assert is_fullscreen(session) is False
assert not is_fullscreen(session)

create_dialog(dialog_type, text=dialog_type)

response = fullscreen(session)
assert_error(response, "unexpected alert open")

assert_dialog_handled(session, expected_text=dialog_type, expected_retval=retval)

assert is_fullscreen(session) is False
assert not is_fullscreen(session)

return check_user_prompt_closed_with_exception


@pytest.fixture
def check_user_prompt_not_closed_but_exception(session, create_dialog):
def check_user_prompt_not_closed_but_exception(dialog_type):
assert is_fullscreen(session) is False
assert not is_fullscreen(session)

create_dialog(dialog_type, text=dialog_type)

Expand All @@ -68,7 +66,7 @@ def check_user_prompt_not_closed_but_exception(dialog_type):
assert session.alert.text == dialog_type
session.alert.dismiss()

assert is_fullscreen(session) is False
assert not is_fullscreen(session)

return check_user_prompt_not_closed_but_exception

Expand Down
4 changes: 2 additions & 2 deletions webdriver/tests/maximize_window/maximize.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,11 +24,11 @@ def test_no_browsing_context(session, closed_window):

def test_fully_exit_fullscreen(session):
session.window.fullscreen()
assert is_fullscreen(session) is True
assert is_fullscreen(session)

response = maximize(session)
assert_success(response)
assert is_fullscreen(session) is False
assert not is_fullscreen(session)


def test_restore_the_window(session):
Expand Down
4 changes: 2 additions & 2 deletions webdriver/tests/set_window_rect/set.py
Original file line number Diff line number Diff line change
Expand Up @@ -142,14 +142,14 @@ def test_no_change(session, rect):

def test_fully_exit_fullscreen(session):
session.window.fullscreen()
assert is_fullscreen(session) is True
assert is_fullscreen(session)

response = set_window_rect(session, {"width": 400, "height": 400})
value = assert_success(response)
assert value["width"] == 400
assert value["height"] == 400

assert is_fullscreen(session) is False
assert not is_fullscreen(session)


def test_restore_from_minimized(session):
Expand Down

0 comments on commit 342f7cf

Please sign in to comment.