Testing localStorage URL Crash Prevention in NW.js
This test suite validates the handling of localStorage.getItem() behavior with URL parameters in NW.js, specifically focusing on crash prevention. The test ensures proper null handling and URL state management across different platforms.
Test Coverage Overview
Implementation Analysis
Technical Details
Best Practices Demonstrated
nwjs/nwJs
test/sanity/issue5947-localStorage_getItem_url_crash/test.py
import time
import os
import platform
import sys
if platform.system() == 'Darwin':
print('Skipped for Mac platform')
sys.exit(0)
sys.path.append(os.path.dirname(os.path.dirname(os.path.abspath(__file__))))
from nw_util import *
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)
try:
print(driver.current_url)
res = wait_for_element_id_content(driver, "result", "URL is: null")
print(res)
assert("URL is: null" in res)
print("There is no crash")
finally:
driver.quit()