Skip to content

Commit d2ecadc

Browse files
committed
fix: disable contextIsolation on webframes
1 parent 04f97b5 commit d2ecadc

File tree

4 files changed

+31
-18
lines changed

4 files changed

+31
-18
lines changed

test/accessibility-test.js

Lines changed: 9 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ describe('app.client.auditAccessibility()', function () {
5151
it('resolves to an audit object with the results', async function () {
5252
await app.client.waitUntilWindowLoaded();
5353
await app.client.windowByIndex(0);
54-
const audit = await app.client.auditAccessibility();
54+
let audit = await app.client.auditAccessibility();
5555
assert.strictEqual(audit.failed, true);
5656
expect(audit.results).to.have.length(3);
5757

@@ -66,15 +66,14 @@ describe('app.client.auditAccessibility()', function () {
6666
expect(audit.results[2].code).to.equal('AX_COLOR_01');
6767
expect(audit.results[2].elements).to.deep.equal(['DIV']);
6868
expect(audit.results[2].severity).to.equal('Warning');
69-
// TODO: windowByIndex on webviews is failing in Electron 12
70-
// await app.client.windowByIndex(1);
71-
// audit = await app.client.auditAccessibility();
72-
// assert.strictEqual(audit.failed, true);
73-
// expect(audit.results).to.have.length(1);
74-
75-
// expect(audit.results[0].code).to.equal('AX_ARIA_01');
76-
// expect(audit.results[0].elements).to.deep.equal(['DIV']);
77-
// expect(audit.results[0].severity).to.equal('Severe');
69+
await app.client.windowByIndex(1);
70+
audit = await app.client.auditAccessibility();
71+
assert.strictEqual(audit.failed, true);
72+
expect(audit.results).to.have.length(1);
73+
74+
expect(audit.results[0].code).to.equal('AX_ARIA_01');
75+
expect(audit.results[0].elements).to.deep.equal(['DIV']);
76+
expect(audit.results[0].severity).to.equal('Severe');
7877
});
7978

8079
it('ignores warnings when ignoreWarnings is specified', async function () {

test/fixtures/not-accessible/index.html

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,12 @@
1313
<body>
1414
<div>unreadable</div>
1515
<input>
16-
<webview src="web-view.html" nodeintegration>
16+
<webview
17+
src="web-view.html"
18+
enableremotemodule="true"
19+
nodeintegration
20+
webpreferences="contextIsolation=false"
21+
>
22+
</webview>
1723
</body>
1824
</html>

test/fixtures/web-view/index.html

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,15 @@
66
</script>
77
</head>
88
<body>
9-
<webview src="web-view.html" autosize="on" minwidth="500" minheight="500" nodeintegration></webview>
9+
<webview
10+
src="web-view.html"
11+
autosize="on"
12+
minwidth="500"
13+
minheight="500"
14+
enableremotemodule="true"
15+
nodeintegration
16+
webpreferences="contextIsolation=false"
17+
>
18+
</webview>
1019
</body>
1120
</html>

test/web-view-test.js

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -33,11 +33,10 @@ describe('<webview> tags', function () {
3333
await app.client.waitUntilWindowLoaded();
3434
const count = await app.client.getWindowCount();
3535
expect(count).to.equal(2);
36-
// TODO: windowByIndex on webviews is failing in Electron 12
37-
// await app.client.windowByIndex(1);
38-
// const elem = await app.client.$('body');
39-
// const text = await elem.getText();
40-
// expect(text).to.equal('web view');
41-
// await app.webContents.getTitle().should.eventually.equal('Web View');
36+
await app.client.windowByIndex(1);
37+
const elem = await app.client.$('body');
38+
const text = await elem.getText();
39+
expect(text).to.equal('web view');
40+
await app.webContents.getTitle().should.eventually.equal('Web View');
4241
});
4342
});

0 commit comments

Comments
 (0)