Skip to content
This repository has been archived by the owner on Jan 11, 2018. It is now read-only.

Commit

Permalink
Add preview tests
Browse files Browse the repository at this point in the history
  • Loading branch information
tmillner committed Dec 29, 2015
1 parent 76555c4 commit bbe2e67
Show file tree
Hide file tree
Showing 3 changed files with 43 additions and 2 deletions.
3 changes: 2 additions & 1 deletion tagcompare/test/assets/test_settings.json
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,8 @@
},
"types": {
"iframe": true,
"script": false
"script": false,
"preview": false
}
},
"saucelabs": {
Expand Down
40 changes: 40 additions & 0 deletions tagcompare/test/test_preview.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
import pytest
import os

from tagcompare import capture
from tagcompare import webdriver
from tagcompare import output


@pytest.mark.integration
def test_capture_preview_override():
test_capture_preview(True)


@pytest.mark.integration
def test_capture_preview_dont_override():
test_capture_preview(False)


def test_capture_preview(override):
"""
Verify that we can render the previews
:return:
"""
pb = output.create(build="capture_tag_test", config="testconfig", cid="testcid",
tagsize="leaderboard", tagtype="preview")
capabilities = {
"platform": "Windows 7",
"browserName": "firefox"
}
driver = webdriver.setup_webdriver(capabilities)
result = capture.__capture_preview(pathbuilder=pb,
driver=driver,
capture_existing=override)
driver.quit()
assert result is not None, "Could not capture tags!"
assert result is not False, "Tag capture skipped!"
assert len(result) == 0, "Errors while capturing preview!"
assert os.path.exists(pb.tagimage), "tagimage was not captured!"
assert os.path.exists(pb.taghtml), "taghtml was not captured!"
pb.rmbuild()
2 changes: 1 addition & 1 deletion tagcompare/test/test_settings.py
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ def test_tagtypes():
assert tag_settings, "Could not get tag settings!"
all_types = tag_settings['types']
assert all_types, "Could not get types from tag settings!"
assert len(all_types) == 2, "There should be exactly 4 supported types!"
assert len(all_types) == 3, "There should be exactly 4 supported types!"
enabled_types = SETTINGS.tagtypes
assert len(enabled_types) == 1, "There should be exactly 1 enabled types!"

Expand Down

0 comments on commit bbe2e67

Please sign in to comment.