Skip to content

Playwright is a framework for Web Testing and Automation. It allows testing Chromium, Firefox and WebKit with a single API.

fix(test runner): dot reporter incorrectly splits by 80 (#7925)

Dmitry Gozman5a3ebfc9f90c
diff --git a/src/test/reporters/dot.ts b/src/test/reporters/dot.ts
index b5a4f80d6a..0a7cce7e19 100644
--- a/src/test/reporters/dot.ts
+++ b/src/test/reporters/dot.ts
@@ -23,10 +23,11 @@ class DotReporter extends BaseReporter {
onTestEnd(test: TestCase, result: TestResult) {
super.onTestEnd(test, result);
- if (++this._counter === 81) {
+ if (this._counter === 80) {
process.stdout.write('\n');
- return;
+ this._counter = 0;
}
+ ++this._counter;
if (result.status === 'skipped') {
process.stdout.write(colors.yellow('°'));
return;
@@ -37,7 +38,7 @@ class DotReporter extends BaseReporter {
}
switch (test.outcome()) {
case 'expected': process.stdout.write(colors.green('·')); break;
- case 'unexpected': process.stdout.write(colors.red(test.results[test.results.length - 1].status === 'timedOut' ? 'T' : 'F')); break;
+ case 'unexpected': process.stdout.write(colors.red(result.status === 'timedOut' ? 'T' : 'F')); break;
case 'flaky': process.stdout.write(colors.yellow('±')); break;
}
}
diff --git a/tests/playwright-test/dot-reporter.spec.ts b/tests/playwright-test/dot-reporter.spec.ts
index d7a85e5449..3e39218c0b 100644
--- a/tests/playwright-test/dot-reporter.spec.ts
+++ b/tests/playwright-test/dot-reporter.spec.ts
@@ -90,3 +90,20 @@ test('should work from config', async ({ runInlineTest }) => {
expect(result.output).toContain(colors.green('·'));
expect(result.exitCode).toBe(0);
});
+
+test('render 243 tests in rows by 80', async ({ runInlineTest }) => {
+ const result = await runInlineTest({
+ 'a.test.js': `
+ const { test } = pwt;
+ for (let i = 0; i < 243; i++) {
+ test('test' + i, () => {});
+ }
+ `,
+ });
+ expect(result.exitCode).toBe(0);
+ expect(result.output).toContain(
+ colors.green('·').repeat(80) + '\n' +
+ colors.green('·').repeat(80) + '\n' +
+ colors.green('·').repeat(80) + '\n' +
+ colors.green('·').repeat(3));
+});