diff options
author | Adam Tauber <asciimoo@gmail.com> | 2016-11-30 18:43:03 +0100 |
---|---|---|
committer | Adam Tauber <asciimoo@gmail.com> | 2017-05-15 12:02:30 +0200 |
commit | 52e615dede8538c36f569d2cf07835427a9a0db6 (patch) | |
tree | ac65990c72156def2d49e81d981f0b3beda4fd2e /tests/robot/__init__.py | |
parent | 46a2c63f8e1c3819cceff2d61fe9106051e8ecee (diff) | |
download | searxng-52e615dede8538c36f569d2cf07835427a9a0db6.tar.gz searxng-52e615dede8538c36f569d2cf07835427a9a0db6.zip |
[enh] py3 compatibility
Diffstat (limited to 'tests/robot/__init__.py')
-rw-r--r-- | tests/robot/__init__.py | 75 |
1 files changed, 75 insertions, 0 deletions
diff --git a/tests/robot/__init__.py b/tests/robot/__init__.py index e69de29bb..038a3196f 100644 --- a/tests/robot/__init__.py +++ b/tests/robot/__init__.py @@ -0,0 +1,75 @@ +# -*- coding: utf-8 -*- + +from time import sleep + +url = "http://localhost:11111/" + + +def test_index(browser): + # Visit URL + browser.visit(url) + assert browser.is_text_present('about') + + +def test_404(browser): + # Visit URL + browser.visit(url + 'missing_link') + assert browser.is_text_present('Page not found') + + +def test_about(browser): + browser.visit(url) + browser.click_link_by_text('about') + assert browser.is_text_present('Why use searx?') + + +def test_preferences(browser): + browser.visit(url) + browser.click_link_by_text('preferences') + assert browser.is_text_present('Preferences') + assert browser.is_text_present('Cookies') + + assert browser.is_element_present_by_xpath('//label[@for="checkbox_dummy"]') + + +def test_preferences_engine_select(browser): + browser.visit(url) + browser.click_link_by_text('preferences') + + assert browser.is_element_present_by_xpath('//a[@href="#tab_engine"]') + browser.find_by_xpath('//a[@href="#tab_engine"]').first.click() + + assert not browser.find_by_xpath('//input[@id="engine_general_dummy__general"]').first.checked + browser.find_by_xpath('//label[@for="engine_general_dummy__general"]').first.check() + browser.find_by_xpath('//input[@value="save"]').first.click() + + # waiting for the redirect - without this the test is flaky.. + sleep(1) + + browser.visit(url) + browser.click_link_by_text('preferences') + browser.find_by_xpath('//a[@href="#tab_engine"]').first.click() + + assert browser.find_by_xpath('//input[@id="engine_general_dummy__general"]').first.checked + + +def test_preferences_locale(browser): + browser.visit(url) + browser.click_link_by_text('preferences') + + browser.select('locale', 'hu') + browser.find_by_xpath('//input[@value="save"]').first.click() + + # waiting for the redirect - without this the test is flaky.. + sleep(1) + + browser.visit(url) + browser.click_link_by_text('beállítások') + browser.is_text_present('Beállítások') + + +def test_search(browser): + browser.visit(url) + browser.fill('q', 'test search query') + browser.find_by_xpath('//button[@type="submit"]').first.click() + assert browser.is_text_present('didn\'t find any results') |