UNPKG

testable-playwright-test

Version:

Playwright fixture to run your tests against Testable Cloud

35 lines (30 loc) 959 B
const https = require('https'); const { URL } = require('url'); async function notifyLastExecutionSubmitted(serverUrl, testId, key) { return new Promise((resolve) => { const parsedUrl = new URL(serverUrl); const path = `/api/executions/${testId}/last-execution-submitted?key=${key}`; const options = { hostname: parsedUrl.hostname, port: parsedUrl.port, path, method: 'PUT', timeout: 30000 }; const req = https.request(options, () => { resolve(); }); req.on('error', (error) => { console.error('Error indicating to Testable that all tests are submitted', error); resolve(); }); req.end(); }); } module.exports = async () => { const serverUrl = process.env.TESTABLE_SERVER_URL; const testId = process.env.TESTABLE_TEST_ID; const key = process.env.TESTABLE_KEY; if (serverUrl && testId && key) await notifyLastExecutionSubmitted(serverUrl, testId, key); };