Testing VM Crash Handling Integration in NW.js
This test suite validates VM crash handling in NW.js using Selenium WebDriver integration. It focuses on verifying proper behavior when executing JavaScript code in the VM context, ensuring stability and proper error handling.
Test Coverage Overview
Implementation Analysis
Technical Details
Best Practices Demonstrated
nwjs/nwJs
test/sanity/issue4018-vm-crash/test.py
import time
import os
import subprocess
import sys
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
from selenium.webdriver.common import utils
chrome_options = Options()
chrome_options.add_argument("nwapp=" + os.path.dirname(os.path.abspath(__file__)))
capabilities = {"pageLoadStrategy": "none"}
testdir = os.path.dirname(os.path.abspath(__file__))
os.chdir(testdir)
driver = webdriver.Chrome(executable_path=os.environ['CHROMEDRIVER'], chrome_options=chrome_options, desired_capabilities = capabilities)
try:
result = wait_for_element_id(driver, 'ret')
print('result=' + result)
assert("success" in result)
finally:
driver.quit()