Beispiel #1
0
def test_capture_tag():
    """
    Verify that we can capture iframe and script tags
    :return:
    """
    pb = output.create(build="capture_tag_test",
                       config="testconfig",
                       cid="testcid",
                       tagsize="skyscraper",
                       tagtype="iframe")
    tags = {
        "skyscraper": {
            "iframe": "<iframe>iframe tag for skyscraper</iframe>",
            "script": "<script>script tag for skyscraper</script>",
        }
    }
    capabilities = {"platform": "Windows 7", "browserName": "chrome"}
    driver = webdriver.setup_webdriver(capabilities)
    result = capture.__capture_tag(pathbuilder=pb,
                                   tags_per_campaign=tags,
                                   driver=driver,
                                   capture_existing=True)
    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 tags!"
    assert os.path.exists(pb.tagimage), "tagimage was not captured!"
    assert os.path.exists(pb.taghtml), "taghtml was not captured!"
    pb.rmbuild()
Beispiel #2
0
def test_capture_tag():
    """
    Verify that we can capture iframe and script tags
    :return:
    """
    pb = output.create(build="capture_tag_test", config="testconfig", cid="testcid",
                       tagsize="skyscraper", tagtype="iframe")
    tags = {"skyscraper": {
        "iframe": "<iframe>iframe tag for skyscraper</iframe>",
        "script": "<script>script tag for skyscraper</script>",
    }}
    capabilities = {
        "platform": "Windows 7",
        "browserName": "chrome"
    }
    driver = webdriver.setup_webdriver(capabilities)
    result = capture.__capture_tag(pathbuilder=pb, tags_per_campaign=tags,
                                   driver=driver,
                                   capture_existing=True)
    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 tags!"
    assert os.path.exists(pb.tagimage), "tagimage was not captured!"
    assert os.path.exists(pb.taghtml), "taghtml was not captured!"
    pb.rmbuild()
Beispiel #3
0
def test_webdriver_screenshot_tag():
    testcaps = {
        "name": "tagcompare_test",
        "platform": "Windows 7",
        "browserName": "chrome"
    }
    testdriver = webdriver.setup_webdriver(capabilities=testcaps)
    __test_webdriver_display_tag(testdriver)
    __test_screenshot_tag(testdriver)
    testdriver.quit()
Beispiel #4
0
def test_setup_webdriver_exceptions():
    with pytest.raises(ValueError):
        webdriver.setup_webdriver(drivertype=None)
    with pytest.raises(ValueError):
        webdriver.setup_webdriver(drivertype='badtype')
    with pytest.raises(ValueError):
        webdriver.setup_webdriver(drivertype=WebDriverType.REMOTE,
                                  capabilities=None)
Beispiel #5
0
def test_phantomjs_screenshot_tag():
    testdriver = webdriver.setup_webdriver(
        WebDriverType.PHANTOM_JS, screenshot_on_exception=True)
    __test_webdriver_display_tag(testdriver, check_errors=False)
    __test_screenshot_tag(testdriver)
    testdriver.quit()