test: start adding capability smoke tests (#784)
This commit is contained in:
parent
5cb19c6265
commit
2bf88fd178
9
test/assets/wasm/table2.html
Normal file
9
test/assets/wasm/table2.html
Normal file
|
|
@ -0,0 +1,9 @@
|
||||||
|
<script>
|
||||||
|
async function loadTable() {
|
||||||
|
const tbl = new WebAssembly.Table({ initial: 2, element: 'anyfunc' });
|
||||||
|
const response = await fetch('table2.wasm');
|
||||||
|
const body = await response.arrayBuffer();
|
||||||
|
await WebAssembly.instantiate(body, { js: { tbl: tbl } });
|
||||||
|
return `${tbl.get(0)()}, ${tbl.get(1)()}`;
|
||||||
|
}
|
||||||
|
</script>
|
||||||
BIN
test/assets/wasm/table2.wasm
Normal file
BIN
test/assets/wasm/table2.wasm
Normal file
Binary file not shown.
31
test/capabilities.spec.js
Normal file
31
test/capabilities.spec.js
Normal file
|
|
@ -0,0 +1,31 @@
|
||||||
|
/**
|
||||||
|
* Copyright Microsoft Corporation. All rights reserved.
|
||||||
|
*
|
||||||
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
|
* you may not use this file except in compliance with the License.
|
||||||
|
* You may obtain a copy of the License at
|
||||||
|
*
|
||||||
|
* http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
*
|
||||||
|
* Unless required by applicable law or agreed to in writing, software
|
||||||
|
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
|
* See the License for the specific language governing permissions and
|
||||||
|
* limitations under the License.
|
||||||
|
*/
|
||||||
|
|
||||||
|
const utils = require('./utils');
|
||||||
|
const { waitEvent } = utils;
|
||||||
|
|
||||||
|
module.exports.describe = function({testRunner, expect}) {
|
||||||
|
const {describe, xdescribe, fdescribe} = testRunner;
|
||||||
|
const {it, fit, xit, dit} = testRunner;
|
||||||
|
const {beforeAll, beforeEach, afterAll, afterEach} = testRunner;
|
||||||
|
|
||||||
|
describe('Capabilities', function() {
|
||||||
|
it('Web Assembly should work', async function({page, server}) {
|
||||||
|
await page.goto(server.PREFIX + '/wasm/table2.html');
|
||||||
|
expect(await page.evaluate(() => loadTable())).toBe('42, 83');
|
||||||
|
});
|
||||||
|
});
|
||||||
|
};
|
||||||
|
|
@ -171,6 +171,7 @@ module.exports.describe = ({testRunner, product, playwrightPath}) => {
|
||||||
testRunner.loadTests(require('./interception.spec.js'), testOptions);
|
testRunner.loadTests(require('./interception.spec.js'), testOptions);
|
||||||
testRunner.loadTests(require('./geolocation.spec.js'), testOptions);
|
testRunner.loadTests(require('./geolocation.spec.js'), testOptions);
|
||||||
testRunner.loadTests(require('./workers.spec.js'), testOptions);
|
testRunner.loadTests(require('./workers.spec.js'), testOptions);
|
||||||
|
testRunner.loadTests(require('./capabilities.spec.js'), testOptions);
|
||||||
|
|
||||||
if (CHROMIUM) {
|
if (CHROMIUM) {
|
||||||
testRunner.loadTests(require('./chromium/chromium.spec.js'), testOptions);
|
testRunner.loadTests(require('./chromium/chromium.spec.js'), testOptions);
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue