 542f7d0d7b
			
		
	
	
		542f7d0d7b
		
	
	
	
	
		
			
			In the past, some files were tested with the standard profile, others with a profile in which most of the messages were switched off ... some files were not checked at all. - ``PYLINT_SEARXNG_DISABLE_OPTION`` has been abolished - the distinction ``# lint: pylint`` is no longer necessary - the pylint tasks have been reduced from three to two 1. ./searx/engines -> lint engines with additional builtins 2. ./searx ./searxng_extra ./tests -> lint all other python files Signed-off-by: Markus Heiser <markus.heiser@darmarit.de>
		
			
				
	
	
		
			78 lines
		
	
	
		
			2.4 KiB
		
	
	
	
		
			Python
		
	
	
	
	
	
			
		
		
	
	
			78 lines
		
	
	
		
			2.4 KiB
		
	
	
	
		
			Python
		
	
	
	
	
	
| # SPDX-License-Identifier: AGPL-3.0-or-later
 | |
| # pylint: disable=missing-module-docstring,missing-function-docstring
 | |
| 
 | |
| from time import sleep
 | |
| 
 | |
| url = "http://localhost:11111/"
 | |
| 
 | |
| 
 | |
| def test_index(browser):
 | |
|     # Visit URL
 | |
|     browser.visit(url)
 | |
|     assert browser.is_text_present('searxng')
 | |
| 
 | |
| 
 | |
| 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.links.find_by_text('searxng').click()
 | |
|     assert browser.is_text_present('Why use it?')
 | |
| 
 | |
| 
 | |
| def test_preferences(browser):
 | |
|     browser.visit(url)
 | |
|     browser.links.find_by_href('/preferences').click()
 | |
|     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.links.find_by_href('/preferences').click()
 | |
| 
 | |
|     assert browser.is_element_present_by_xpath('//label[@for="tab-engines"]')
 | |
|     browser.find_by_xpath('//label[@for="tab-engines"]').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[@type="submit"]').first.click()
 | |
| 
 | |
|     # waiting for the redirect - without this the test is flaky..
 | |
|     sleep(1)
 | |
| 
 | |
|     browser.visit(url)
 | |
|     browser.links.find_by_href('/preferences').click()
 | |
|     browser.find_by_xpath('//label[@for="tab-engines"]').first.click()
 | |
| 
 | |
|     assert browser.find_by_xpath('//input[@id="engine_general_dummy__general"]').first.checked
 | |
| 
 | |
| 
 | |
| def test_preferences_locale(browser):
 | |
|     browser.visit(url)
 | |
|     browser.links.find_by_href('/preferences').click()
 | |
| 
 | |
|     browser.find_by_xpath('//label[@for="tab-ui"]').first.click()
 | |
|     browser.select('locale', 'fr')
 | |
|     browser.find_by_xpath('//input[@type="submit"]').first.click()
 | |
| 
 | |
|     # waiting for the redirect - without this the test is flaky..
 | |
|     sleep(1)
 | |
| 
 | |
|     browser.visit(url)
 | |
|     browser.links.find_by_href('/preferences').click()
 | |
|     browser.is_text_present('Préférences')
 | |
| 
 | |
| 
 | |
| 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('No results were found')
 |