Closed BillyBolton closed 3 years ago
I'm still getting the same issue. @dgozman Can this be re-opened?
<testsuite name="tests/foo.spec.ts" timestamp="1618404293678" hostname="" tests="3" failures="3" skipped="0" time="16.142" errors="0">
<testcase name="is a basic test with the page" classname="tests/foo.spec.ts " time="7.535">
<failure message="foo.spec.ts:3:1 is a basic test with the page" type="FAILURE">
tests/foo.spec.ts:3:1 › [chromium] is a basic test with the page =================================
Error: expect(received).toBe(expected) // Object.is equality
Expected: &quot;2&quot;
Received: &quot;Playwright&quot;
4 | await page.goto(&quot;https://playwright.dev/&quot;);
5 | const name = await page.innerText(&quot;.navbar__title&quot;);
> 6 | expect(name).toBe(&quot;2&quot;);
| ^
7 | });
at Spec.fn (/home/user/Desktop/dev/tdd-playwright-example/e3e/tests/foo.spec.ts:6:18)
at WorkerRunner._runTestWithBeforeHooks (/home/user/Desktop/dev/tdd-playwright-example/e3e/node_modules/folio/out/workerRunner.js:299:13 ```
Here is my config file based on the new documentation:
import { ChromiumEnv, FirefoxEnv, WebKitEnv, test, setConfig } from "@playwright/test";
import { reporters, setReporters } from "@playwright/test";
setConfig({
testDir: __dirname, // Search for tests in this directory.
timeout: 30000, // Each test is given 30 seconds.
// timeout: 90000, // Each test is given 90 seconds.
retries: 0, // Failing tests will be retried at most two times.
});
setReporters([
// Report to the terminal with "line" reporter.
new reporters.line(),
// Additionally, output a JUnit XML file.
new reporters.junit({ outputFile: 'junit.xml', stripANSIControlSequences: true }),
]);
const options = {
// Launch options:
headless: true,
slowMo: 50,
// Context options:
viewport: { width: 800, height: 600 },
ignoreHTTPSErrors: true,
// Testing options:
// video: 'retain-on-failure',
screenshot: 'only-on-failure'
};
// Run tests in three browsers.
test.runWith(new ChromiumEnv(options), { tag: 'chromium' });
test.runWith(new FirefoxEnv(options), { tag: 'firefox' });
test.runWith(new WebKitEnv(options), { tag: 'webkit' });```
@BillyBolton What is the problem in the example you pasted? You don't like &
escapes? Unfortunately, we'll have to escape at least some characters, e.g. <
, otherwise it won't be a valid xml file.
@dgozman Thanks for getting back to me. Yea the &, "e, > aren't playing well. Comparing the line and junit reporters seem to conclude that it's related to ANSI formatting. I try using the new config option, stripANSIControlSequences: true, but it doesn't seem to make a difference.
I noticed an issue with the junit reporter character encoding when used with playwright-axe. The issue seems to be exclusive to junit reporter, as opposed to perfect output from the line reporter.
Line Reporter Test Result Output:
In the xml file though, the encoding is different:
CircleCi can't parse due to this:
Is this normal behavior? I've been looking at the modules for far too long.