Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[test] Add test for issue4637 #6645

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 10 additions & 0 deletions test/sanity/issue4637-chromiun-args-disable-logging/index.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>issue4637</title>
</head>
<body>
<h1 id="result">Success</h1>
</body>
</html>
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
{
"name": "issue4637",
"main": "index.html",
"chromium-args": "--disable-logging"
}
52 changes: 52 additions & 0 deletions test/sanity/issue4637-chromiun-args-disable-logging/test.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
import os
import sys
import shutil
import platform

sys.path.append(os.path.join(os.path.dirname(__file__), '..'))
from nw_util import *

from selenium import webdriver
from selenium.webdriver.chrome.options import Options

chrome_options = Options()
testdir = os.path.dirname(os.path.abspath(__file__))
chrome_options.add_argument("nwapp=" + testdir)

pkgname = 'issue4637'

if platform.system() == "Windows":
user_data_dir = os.path.join(os.getenv('LOCALAPPDATA'), pkgname, "User Data")
elif platform.system() == 'Linux':
user_data_dir = os.path.join(os.getenv('HOME'), '.config', pkgname)
else:
user_data_dir = os.path.join(os.getenv('HOME'), 'Library', 'Application Support', pkgname)

log_file = os.path.join(user_data_dir, "chrome_debug.log")

try:
shutil.rmtree(user_data_dir)
except:
pass

def check_cache():
if os.path.exists(log_file):
print "Debug log file is enabled"
assert(False)
else:
print "Debug log file is disabled"
assert(True)


chrome_options.add_argument("user-data-dir=" + user_data_dir)

driver = webdriver.Chrome(executable_path=os.environ["CHROMEDRIVER"], chrome_options=chrome_options, service_log_path="log", service_args=["--verbose"])
driver.implicitly_wait(2)

try:
print driver.current_url
check_cache()
output = wait_for_element_id_content(driver, "result", "Success")
assert("Success" in output)
finally:
driver.quit()