diff --git a/tests/fixtures/nw/app/index.html b/tests/fixtures/nw/app/index.html index 55fee60..d83eef8 100644 --- a/tests/fixtures/nw/app/index.html +++ b/tests/fixtures/nw/app/index.html @@ -8,6 +8,7 @@ document.addEventListener('DOMContentLoaded', () => { document.getElementById('nw-app-argv').innerText = nw.App.argv; document.getElementById('nw-app-fullargv').innerText = nw.App.fullArgv; + document.getElementById('nw-app-filteredargv').innerText = nw.App.filteredArgv; }); nw.App fixture @@ -18,11 +19,16 @@ nw.App.argv: - +
nw.App.fullArgv:
+
+
+ nw.App.filteredArgv: + +
diff --git a/tests/specs/nw/app.test.js b/tests/specs/nw/app.test.js index 2280124..8227ec3 100644 --- a/tests/specs/nw/app.test.js +++ b/tests/specs/nw/app.test.js @@ -54,7 +54,7 @@ describe('nw.App', { timeout: Infinity }, async function () { it('renders nw.App.fullArgv', async () => { /** - * `nw.App.argv` looks similar to the following: + * `nw.App.fullArgv` looks similar to the following: * * `"--allow-pre-commit-input,--disable-popup-blocking,--enable-automation,--enable-logging,--headless=new,--nwapp=/home/ayushmanchhabra/Git/nwutils/cli/tests/fixtures/nw/app,--remote-debugging-port=0,--user-data-dir=/tmp/.io.nwjs.Jb5Vnk"` * @@ -77,6 +77,27 @@ describe('nw.App', { timeout: Infinity }, async function () { expect(argv).toContain('--user-data-dir='); }); + it('renders nw.App.filteredArgv', async () => { + /** + * `nw.App.filteredArgv` looks similar to the following: + * + * `"/^--url=/,/^--remote-debugging-port=/,/^--renderer-cmd-prefix=/,/^--nwapp=/"` + * + * @type {string} + */ + const argv = await driver.findElement(selenium.By.id('nw-app-filteredargv')).getText(); + + /* There should be 4 command line arguments. */ + const argvLength = argv.split(',').length; + expect(argvLength).toBe(4); + + /* Since order does not matter, the `.toContain` matcher is used.*/ + expect(argv).toContain('--url='); + expect(argv).toContain('--remote-debugging-port='); + expect(argv).toContain('--renderer-cmd-prefix='); + expect(argv).toContain('--nwapp='); + }); + afterAll(async function () { await driver.quit(); });