Blame view

tests/FrontEndTests.py 1.94 KB
1fd5c7a5   hitier   Add pytest enviro...
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
# import urllib
#
# from selenium import webdriver
# from flask_testing import LiveServerTestCase
#
# _SERVER_PORT = 8943
# _ROOT_URL = "http://localhost:{}".format(_SERVER_PORT)
#
#
# class BaseTestCase(LiveServerTestCase):
#     def create_app(self):
#         # # remove logging lines on test output
#         import logging
#         log = logging.getLogger('werkzeug')
#         log.setLevel(logging.INFO)
#         log.disabled = True
#         # os.environ['WERKZEUG_RUN_MAIN'] = 'true'
#
#         # pass in test configurations
#         app.config.update(
#             # Change the port that the liveserver listens on as we dont want to conflict with running:5000
#             LIVESERVER_PORT=_SERVER_PORT
#         )
#
#         self.app_context = app.app_context()
#         self.app_context.push()
#         return app
#
#     def setUp(self):
#         # os.environ["PYTHONTRACEMALLOC"] = '1'
#
#         self.driver = self.create_chrome_driver()
#
#     def tearDown(self):
#         self.app_context.pop()
#         self.driver.close()
#         self.driver.quit()
#
#     def create_chrome_driver(self):
#         """
#         Create then return the chrome driver.
#
#         :return: the chrome driver.
#         """
#         from selenium.webdriver.chrome.options import Options
#         options = Options()
#         options.add_argument('--headless')
#
#         return webdriver.Chrome(options=options)
#
#
# class AccessTestCase(BaseTestCase):
#     def test_ping(self):
#         self.assertEqual(_ROOT_URL, self.get_server_url())
#
#     def test_selenium_access(self):
#         # open browser on servers adress
#         self.driver.get(self.get_server_url())
#         # L'adresse dans l'url doit ĂȘtre celle que l'on attend.
#         self.assertEqual(_ROOT_URL+'/', self.driver.current_url)
#
#     def test_server_is_up_and_running(self):
#         response = urllib.request.urlopen(self.get_server_url())
#         self.assertEqual(200, response.code)