Skip to content

Commit 5a7238e

Browse files
committed
[test] fix additional_trust_anchors: server termination
If the case failed in the 1st run, the server is not terminated correctly and blocks the test framework
1 parent f25b28e commit 5a7238e

File tree

1 file changed

+29
-26
lines changed
  • test/sanity/additional_trust_anchors

1 file changed

+29
-26
lines changed

test/sanity/additional_trust_anchors/test.py

Lines changed: 29 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -54,36 +54,39 @@ def write_file(filename, content):
5454
driver.implicitly_wait(5)
5555
time.sleep(1)
5656
try:
57-
print driver.current_url
58-
driver.switch_to_frame(driver.find_element_by_id('test-frame'))
59-
title = driver.execute_script('return document.title')
60-
print title
61-
result = driver.find_element_by_id('result').get_attribute('innerHTML')
62-
print result
63-
assert('success' in result)
64-
driver.close()
65-
finally:
66-
driver.quit()
57+
try:
58+
print driver.current_url
59+
driver.switch_to_frame(driver.find_element_by_id('test-frame'))
60+
title = driver.execute_script('return document.title')
61+
print title
62+
result = driver.find_element_by_id('result').get_attribute('innerHTML')
63+
print result
64+
assert('success' in result)
65+
driver.close()
66+
finally:
67+
driver.quit()
6768

68-
# test without trust anchors
69-
pkg_without_trust_anchors = '''
69+
# test without trust anchors
70+
pkg_without_trust_anchors = '''
7071
{
71-
"name": "test_additional_trust_anchors",
72-
"main": "index.html"
72+
"name": "test_additional_trust_anchors",
73+
"main": "index.html"
7374
}
7475
'''
75-
write_file('package.json', pkg_without_trust_anchors)
76+
write_file('package.json', pkg_without_trust_anchors)
77+
78+
driver = webdriver.Chrome(executable_path=os.environ['CHROMEDRIVER'], chrome_options=chrome_options, service_log_path="log", service_args=["--verbose"])
79+
driver.implicitly_wait(5)
80+
time.sleep(1)
81+
try:
82+
print driver.current_url
83+
driver.switch_to_frame(driver.find_element_by_id('test-frame'))
84+
title = driver.execute_script('return document.title')
85+
print title
86+
assert(not 'test.html' in title)
87+
driver.close()
88+
finally:
89+
driver.quit()
7690

77-
driver = webdriver.Chrome(executable_path=os.environ['CHROMEDRIVER'], chrome_options=chrome_options, service_log_path="log", service_args=["--verbose"])
78-
driver.implicitly_wait(5)
79-
time.sleep(1)
80-
try:
81-
print driver.current_url
82-
driver.switch_to_frame(driver.find_element_by_id('test-frame'))
83-
title = driver.execute_script('return document.title')
84-
print title
85-
assert(not 'test.html' in title)
86-
driver.close()
8791
finally:
8892
server.terminate()
89-
driver.quit()

0 commit comments

Comments
 (0)