1
|
# SPDX-License-Identifier: CC0-1.0
|
2
|
|
3
|
"""
|
4
|
Haketilo integration tests
|
5
|
"""
|
6
|
|
7
|
# This file is part of Haketilo
|
8
|
#
|
9
|
# Copyright (C) 2022 Wojtek Kosior <koszko@koszko.org>
|
10
|
#
|
11
|
# This program is free software: you can redistribute it and/or modify
|
12
|
# it under the terms of the CC0 1.0 Universal License as published by
|
13
|
# the Creative Commons Corporation.
|
14
|
#
|
15
|
# This program is distributed in the hope that it will be useful,
|
16
|
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
17
|
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
18
|
# CC0 1.0 Universal License for more details.
|
19
|
|
20
|
import pytest
|
21
|
|
22
|
from selenium.webdriver.support.ui import WebDriverWait
|
23
|
from selenium.webdriver.support import expected_conditions as EC
|
24
|
from selenium.webdriver.common.by import By
|
25
|
|
26
|
from .extension_crafting import get_extension_base_url
|
27
|
|
28
|
@pytest.mark.usefixtures('haketilo')
|
29
|
def test_integration(driver):
|
30
|
"""
|
31
|
Verify that the entire extension functions properly. Also verify bunlded
|
32
|
default settings get loaded properly.
|
33
|
"""
|
34
|
base_url = get_extension_base_url(driver)
|
35
|
driver.get(base_url + 'html/settings.html')
|
36
|
|
37
|
WebDriverWait(driver, 10)\
|
38
|
.until(EC.visibility_of_element_located((By.ID, "main_view")))
|
39
|
|
40
|
for tab_head_id, item_text in [
|
41
|
('resources_head', 'Haketilo demonstrational script'),
|
42
|
('mappings_head', 'Haketilo demonstrational message'),
|
43
|
]:
|
44
|
driver.find_element_by_id(tab_head_id).click()
|
45
|
lst = driver.find_element_by_css_selector('.active_tab .item_list')
|
46
|
assert lst.is_displayed()
|
47
|
assert item_text in lst.text
|
48
|
|
49
|
driver.find_element_by_id('repos_head').click()
|
50
|
lst = driver.find_element_by_css_selector('.active_tab .text_entries')
|
51
|
assert 'https://hydrilla.koszko.org/api_v2' in lst.text
|
52
|
|
53
|
# TODO: do some more tests, including popup interaction and repository
|
54
|
# querying
|