Skip to content

Commit

Permalink
fix: disable contextIsolation on webframes
Browse files Browse the repository at this point in the history
  • Loading branch information
VerteDinde committed Mar 4, 2021
1 parent 04f97b5 commit d2ecadc
Show file tree
Hide file tree
Showing 4 changed files with 31 additions and 18 deletions.
19 changes: 9 additions & 10 deletions test/accessibility-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ describe('app.client.auditAccessibility()', function () {
it('resolves to an audit object with the results', async function () {
await app.client.waitUntilWindowLoaded();
await app.client.windowByIndex(0);
const audit = await app.client.auditAccessibility();
let audit = await app.client.auditAccessibility();
assert.strictEqual(audit.failed, true);
expect(audit.results).to.have.length(3);

Expand All @@ -66,15 +66,14 @@ describe('app.client.auditAccessibility()', function () {
expect(audit.results[2].code).to.equal('AX_COLOR_01');
expect(audit.results[2].elements).to.deep.equal(['DIV']);
expect(audit.results[2].severity).to.equal('Warning');
// TODO: windowByIndex on webviews is failing in Electron 12
// await app.client.windowByIndex(1);
// audit = await app.client.auditAccessibility();
// assert.strictEqual(audit.failed, true);
// expect(audit.results).to.have.length(1);

// expect(audit.results[0].code).to.equal('AX_ARIA_01');
// expect(audit.results[0].elements).to.deep.equal(['DIV']);
// expect(audit.results[0].severity).to.equal('Severe');
await app.client.windowByIndex(1);
audit = await app.client.auditAccessibility();
assert.strictEqual(audit.failed, true);
expect(audit.results).to.have.length(1);

expect(audit.results[0].code).to.equal('AX_ARIA_01');
expect(audit.results[0].elements).to.deep.equal(['DIV']);
expect(audit.results[0].severity).to.equal('Severe');
});

it('ignores warnings when ignoreWarnings is specified', async function () {
Expand Down
8 changes: 7 additions & 1 deletion test/fixtures/not-accessible/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,12 @@
<body>
<div>unreadable</div>
<input>
<webview src="web-view.html" nodeintegration>
<webview
src="web-view.html"
enableremotemodule="true"
nodeintegration
webpreferences="contextIsolation=false"
>
</webview>
</body>
</html>
11 changes: 10 additions & 1 deletion test/fixtures/web-view/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,15 @@
</script>
</head>
<body>
<webview src="web-view.html" autosize="on" minwidth="500" minheight="500" nodeintegration></webview>
<webview
src="web-view.html"
autosize="on"
minwidth="500"
minheight="500"
enableremotemodule="true"
nodeintegration
webpreferences="contextIsolation=false"
>
</webview>
</body>
</html>
11 changes: 5 additions & 6 deletions test/web-view-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -33,11 +33,10 @@ describe('<webview> tags', function () {
await app.client.waitUntilWindowLoaded();
const count = await app.client.getWindowCount();
expect(count).to.equal(2);
// TODO: windowByIndex on webviews is failing in Electron 12
// await app.client.windowByIndex(1);
// const elem = await app.client.$('body');
// const text = await elem.getText();
// expect(text).to.equal('web view');
// await app.webContents.getTitle().should.eventually.equal('Web View');
await app.client.windowByIndex(1);
const elem = await app.client.$('body');
const text = await elem.getText();
expect(text).to.equal('web view');
await app.webContents.getTitle().should.eventually.equal('Web View');
});
});

0 comments on commit d2ecadc

Please sign in to comment.