Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 6 additions & 1 deletion Jenkinsfile
Original file line number Diff line number Diff line change
Expand Up @@ -138,10 +138,15 @@ pipeline {
dir(path: 'wasm') {
sh '''
export PLAYWRIGHT_BROWSERS_PATH=/ms-playwright
npm run test:e2e
npm run test:e2e -- --trace retain-on-failure
'''
}
}
post {
failure {
archiveArtifacts artifacts: 'wasm/test-results/**', allowEmptyArchive: true
}
}
}

stage('Upload to CDN') {
Expand Down
2 changes: 1 addition & 1 deletion submodule/wb-mqtt-serial
Submodule wb-mqtt-serial updated 244 files
1 change: 1 addition & 0 deletions wasm.mk
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,7 @@ SRC = \
$(SERIAL_DIR)/src/rpc/rpc_device_load_config_task.cpp \
$(SERIAL_DIR)/src/rpc/rpc_device_set_task.cpp \
$(SERIAL_DIR)/src/rpc/rpc_device_probe_task.cpp \
$(SERIAL_DIR)/src/rpc/rpc_device_type_json.cpp \
$(SERIAL_DIR)/src/rpc/rpc_exception.cpp \
$(SERIAL_DIR)/src/rpc/rpc_fw_downloader.cpp \
$(SERIAL_DIR)/src/rpc/rpc_fw_get_firmware_info_task.cpp \
Expand Down
17 changes: 17 additions & 0 deletions wasm/e2e/playwright.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,27 @@ export default defineConfig({
testDir: '.',
timeout: 60_000,
workers: 1,
retries: process.env.CI ? 2 : 0,
use: {
// CI's chromium exposes WebSerial even headless, and the first device access
// then falls through to requestPort() without a gesture and kills the page.
// Chrome in Docker gets 64 MB of /dev/shm, which the WASM specs outgrow
launchOptions: {
args: ['--disable-blink-features=Serial,WebUSB', '--disable-dev-shm-usage'],
},
},
projects: [
{
name: 'chromium',
use: { browserName: 'chromium' },
},
// Opt-in (PW_SYSTEM_CHROME=1 npx playwright test --project=system-chrome) for
// hosts without the playwright-managed chromium download
...(process.env.PW_SYSTEM_CHROME
? [{
name: 'system-chrome',
use: { browserName: 'chromium' as const, channel: 'chrome' },
}]
: []),
],
});
24 changes: 15 additions & 9 deletions wasm/public/script.js
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ window.Module =
},

_requestLock: Promise.resolve(),
_finish: null,

async onRuntimeInitialized() {
this.setReleaseSuite(localStorage.getItem('release') || 'stable');
Expand Down Expand Up @@ -75,17 +76,20 @@ window.Module =
}

const timeout = ['fwUpdate', 'fwRestore'].includes(type) ? 600000 : 120000;
const deadline = Date.now() + timeout;
// Woken by the reply, not polled: Chrome clamps every timer in a
// hidden tab to 1 s, so a 1 ms poll cost a second per request
let timer;
await new Promise((resolve) => {
const check = () => {
if (this.finished || Date.now() > deadline) {
resolve();
return;
}
setTimeout(check, 1);
};
check();
// The call may have finished without ever suspending
if (this.finished) {
resolve();
return;
}
this._finish = resolve;
timer = setTimeout(resolve, timeout);
});
clearTimeout(timer);
this._finish = null;

if (!this.finished) {
this.print('RPC request timeout (' + (timeout / 1000) + 's) for: ' + type);
Expand Down Expand Up @@ -153,6 +157,8 @@ window.Module =
this.print('request error ' + this.reply.error.code + ': ' + this.reply.error.message);

this.finished = true;
if (this._finish)
this._finish();
},

subscribeFwUpdateState(callback) {
Expand Down
Loading
Loading