Skip to content

Commit 7efc0dd

Browse files
committed
web-test-runner fixups
For awhile, the wtr tests on firefox have been timing out. This happened after an upgrade to playwright a few versions ago. Developers will need to re-run the tests CI jobs multiple times to get a pass. This change fixes that. The web test runner config has been modified to adjust the concurrency only for firefox. Other changes: - Rename test-helpers.test.ts to test-helpers.ts so it won't count as a test file. (And fix imports) - Add missing import on webstatus-app.test.ts - Reduce the number of args passed in package.json for testing since now we rely on the web test runner config.
1 parent da1ea64 commit 7efc0dd

File tree

5 files changed

+19
-5
lines changed

5 files changed

+19
-5
lines changed

frontend/package.json

+2-2
Original file line numberDiff line numberDiff line change
@@ -16,8 +16,8 @@
1616
"postinstall": "./scripts/postinstall.js",
1717
"start": "node dist/server/index.js",
1818
"cp-imgs": "mkdir -p build/public/img && cp -v -r src/static/img/* build/public/img && cp -v .postinstall/static/img/* build/public/img",
19-
"test": "npm run build && npm run cp-imgs && wtr --coverage --node-resolve --playwright --browsers chromium firefox webkit",
20-
"test:watch": "npm run build && concurrently -k --raw \"tsc --watch --preserveWatchOutput\" \"wtr --watch --coverage --node-resolve --playwright --browsers chromium firefox webkit\" "
19+
"test": "npm run build && npm run cp-imgs && wtr --coverage",
20+
"test:watch": "npm run build && concurrently -k --raw \"tsc --watch --preserveWatchOutput\" \"wtr --watch --coverage\" "
2121
},
2222
"devDependencies": {
2323
"@browser-logos/chrome": "^2.0.0",

frontend/src/static/js/components/test/webstatus-app.test.ts

+1
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ import {assert, fixture, html} from '@open-wc/testing';
1818

1919
import {type AppSettings} from '../../contexts/settings-context.js';
2020
import {type WebstatusApp} from '../webstatus-app.js';
21+
import '../webstatus-app.js';
2122

2223
describe('webstatus-app', () => {
2324
it('can be added to the page with the settings', async () => {

frontend/src/static/js/components/test/webstatus-line-chart-panel.test.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ import {Task} from '@lit/task';
2525
import {WebStatusDataObj, WebstatusGChart} from '../webstatus-gchart.js';
2626
import {TemplateResult, html} from 'lit';
2727
import {customElement} from 'lit/decorators.js';
28-
import {createMockIterator, taskUpdateComplete} from './test-helpers.test.js';
28+
import {createMockIterator, taskUpdateComplete} from './test-helpers.js';
2929

3030
// Interface for the data used in LineChartMetricData
3131
interface MetricDataPoint {

frontend/web-test-runner.config.mjs

+15-2
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
* See the License for the specific language governing permissions and
1414
* limitations under the License.
1515
*/
16-
16+
import {playwrightLauncher} from '@web/test-runner-playwright';
1717
const filteredLogs = [
1818
'Running in dev mode',
1919
'Lit is in dev mode',
@@ -25,7 +25,6 @@ const filteredLogs = [
2525

2626
export default /** @type {import("@web/test-runner").TestRunnerConfig} */ ({
2727
concurrency: 4,
28-
concurrentBrowsers: 1,
2928
/** Resolve bare module imports */
3029
nodeResolve: {
3130
exportConditions: ['browser', 'development'],
@@ -65,4 +64,18 @@ export default /** @type {import("@web/test-runner").TestRunnerConfig} */ ({
6564
testsFinishTimeout: 1000 * 60 * 1, // (1 min)
6665
// mocha config https://mochajs.org/api/mocha
6766
testFramework: {config: {timeout: 30000}},
67+
68+
browsers: [
69+
playwrightLauncher({
70+
product: 'chromium',
71+
}),
72+
playwrightLauncher({
73+
product: 'firefox',
74+
// For some we need to limit the concurrency for Firefox to ensure test stability.
75+
concurrency: 1,
76+
}),
77+
playwrightLauncher({
78+
product: 'webkit',
79+
}),
80+
],
6881
});

0 commit comments

Comments
 (0)