Skip to content

Commit

Permalink
[wdspec] Use shared assert_png() method in screenshot tests.
Browse files Browse the repository at this point in the history
Depends on D10626

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

bugzilla-url: https://bugzilla.mozilla.org/show_bug.cgi?id=1503804
gecko-commit: 8ee95012eaf0271baf406be0f0b712198f9e01da
gecko-integration-branch: autoland
gecko-reviewers: ato
  • Loading branch information
whimboo authored and moz-wptsync-bot committed Nov 5, 2018
1 parent f917e2d commit ba41afb
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 24 deletions.
8 changes: 2 additions & 6 deletions webdriver/tests/take_element_screenshot/screenshot.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,4 @@
import base64
import imghdr

from tests.support.asserts import assert_error, assert_success
from tests.support.asserts import assert_error, assert_png, assert_success
from tests.support.inline import inline


Expand All @@ -27,8 +24,7 @@ def test_screenshot(session):
response = take_element_screenshot(session, element.id)
value = assert_success(response)

image = base64.decodestring(value)
assert imghdr.what("", image) == "png"
assert_png(value)


def test_stale(session):
Expand Down
8 changes: 2 additions & 6 deletions webdriver/tests/take_element_screenshot/user_prompts.py
Original file line number Diff line number Diff line change
@@ -1,11 +1,8 @@
# META: timeout=long

import base64
import imghdr

import pytest

from tests.support.asserts import assert_success
from tests.support.asserts import assert_png, assert_success
from tests.support.inline import inline


Expand All @@ -30,8 +27,7 @@ def check_user_prompt_not_closed_without_exception(dialog_type):
response = take_element_screenshot(session, element.id)
value = assert_success(response)

image = base64.decodestring(value)
assert imghdr.what("", image) == "png"
assert_png(value)

assert session.alert.text == dialog_type
session.alert.dismiss()
Expand Down
8 changes: 2 additions & 6 deletions webdriver/tests/take_screenshot/screenshot.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,4 @@
import base64
import imghdr

from tests.support.asserts import assert_error, assert_success
from tests.support.asserts import assert_error, assert_png, assert_success
from tests.support.inline import inline


Expand All @@ -21,5 +18,4 @@ def test_screenshot(session):
response = take_screenshot(session)
value = assert_success(response)

image = base64.decodestring(value)
assert imghdr.what("", image) == "png"
assert_png(value)
8 changes: 2 additions & 6 deletions webdriver/tests/take_screenshot/user_prompts.py
Original file line number Diff line number Diff line change
@@ -1,11 +1,8 @@
# META: timeout=long

import base64
import imghdr

import pytest

from tests.support.asserts import assert_success
from tests.support.asserts import assert_png, assert_success
from tests.support.inline import inline


Expand All @@ -24,8 +21,7 @@ def check_user_prompt_not_closed_without_exception(dialog_type):
response = take_screenshot(session)
value = assert_success(response)

image = base64.decodestring(value)
assert imghdr.what("", image) == "png"
assert_png(value)

assert session.alert.text == dialog_type
session.alert.dismiss()
Expand Down

0 comments on commit ba41afb

Please sign in to comment.