1
|
# SPDX-License-Identifier: CC0-1.0
|
2
|
|
3
|
"""
|
4
|
Haketilo unit tests
|
5
|
"""
|
6
|
|
7
|
# This file is part of Haketilo
|
8
|
#
|
9
|
# Copyright (C) 2021, jahoti
|
10
|
# Copyright (C) 2021, Wojtek Kosior
|
11
|
#
|
12
|
# This program is free software: you can redistribute it and/or modify
|
13
|
# it under the terms of the CC0 1.0 Universal License as published by
|
14
|
# the Creative Commons Corporation.
|
15
|
#
|
16
|
# This program is distributed in the hope that it will be useful,
|
17
|
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
18
|
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
19
|
# CC0 1.0 Universal License for more details.
|
20
|
|
21
|
import pytest
|
22
|
from .profiles import firefox_safe_mode
|
23
|
from .server import do_an_internet
|
24
|
|
25
|
@pytest.fixture
|
26
|
def proxy():
|
27
|
httpd = do_an_internet()
|
28
|
yield httpd
|
29
|
httpd.shutdown()
|
30
|
|
31
|
@pytest.fixture
|
32
|
def driver(proxy):
|
33
|
with firefox_safe_mode() as driver:
|
34
|
yield driver
|
35
|
driver.quit()
|
36
|
|
37
|
def test_basic(driver):
|
38
|
driver.get('https://gotmyowndoma.in')
|
39
|
element = driver.find_element_by_tag_name('title')
|
40
|
title = driver.execute_script('return arguments[0].innerText;', element)
|
41
|
assert "Schrodinger's Document" in title
|