From 8d8de5de8e00914a18ca2c32f7a6598283da295f Mon Sep 17 00:00:00 2001 From: Cong Liu Date: Tue, 19 Jan 2016 14:10:44 +0800 Subject: [PATCH] test case for issue #4187 --- .../issue4187-close-hidden/index.html | 31 +++++++++++++++++++ .../issue4187-close-hidden/package.json | 7 +++++ .../issue4187-close-hidden/splash.html | 14 +++++++++ test/remoting/issue4187-close-hidden/test.py | 25 +++++++++++++++ 4 files changed, 77 insertions(+) create mode 100644 test/remoting/issue4187-close-hidden/index.html create mode 100644 test/remoting/issue4187-close-hidden/package.json create mode 100644 test/remoting/issue4187-close-hidden/splash.html create mode 100644 test/remoting/issue4187-close-hidden/test.py diff --git a/test/remoting/issue4187-close-hidden/index.html b/test/remoting/issue4187-close-hidden/index.html new file mode 100644 index 0000000000..ed3b966418 --- /dev/null +++ b/test/remoting/issue4187-close-hidden/index.html @@ -0,0 +1,31 @@ + + + + + + hidden crash + + + +

success

+ + + + diff --git a/test/remoting/issue4187-close-hidden/package.json b/test/remoting/issue4187-close-hidden/package.json new file mode 100644 index 0000000000..1cdc181690 --- /dev/null +++ b/test/remoting/issue4187-close-hidden/package.json @@ -0,0 +1,7 @@ +{ + "name": "issue4187-close-hidden", + "main": "index.html", + "window": { + "show": false + } +} diff --git a/test/remoting/issue4187-close-hidden/splash.html b/test/remoting/issue4187-close-hidden/splash.html new file mode 100644 index 0000000000..66c5e58e5b --- /dev/null +++ b/test/remoting/issue4187-close-hidden/splash.html @@ -0,0 +1,14 @@ + + + + + + + splash + + + +

This is a splash

+ + + diff --git a/test/remoting/issue4187-close-hidden/test.py b/test/remoting/issue4187-close-hidden/test.py new file mode 100644 index 0000000000..8ad73bb339 --- /dev/null +++ b/test/remoting/issue4187-close-hidden/test.py @@ -0,0 +1,25 @@ +import time +import os + +from selenium import webdriver +from selenium.webdriver.chrome.options import Options + +chrome_options = Options() +chrome_options.add_argument("nwapp=" + os.path.dirname(os.path.abspath(__file__))) + +driver = webdriver.Chrome(executable_path=os.environ['CHROMEDRIVER'], chrome_options=chrome_options) +driver.implicitly_wait(2) +time.sleep(1) +try: + print driver.current_url + time.sleep(1) # wait for window open + print 'Wait for splash window close' + while len(driver.window_handles) != 1: + time.sleep(1) + print driver.window_handles + driver.switch_to_window(driver.window_handles[0]) + result = driver.find_element_by_id('result').get_attribute('innerHTML') + print result + assert('success' in result) +finally: + driver.quit()