test(test-runner): add test for relative outputDir (#9381)

This commit is contained in:
Max Schmitt 2021-10-08 09:20:41 +02:00 committed by GitHub
parent 7e4ef2e202
commit b3a8ccd064
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -395,6 +395,27 @@ test('should accept a relative path for outputDir', async ({ runInlineTest }, te
expect(result.exitCode).toBe(0);
});
test('should have output dir based on rootDir (cwd)', async ({ runInlineTest }, testInfo) => {
test.fixme(true, 'https://github.com/microsoft/playwright/issues/9380');
const result = await runInlineTest({
'playwright.config.js': `
const path = require('path');
module.exports = {
testDir: path.join(__dirname, 'e2e'),
outputDir: 'test-results/',
};`,
'e2e/example.spec.js': `
const { test } = pwt;
const fs = require('fs');
test('hello world', async ({ }, testInfo) => {
fs.writeFileSync(testInfo.outputPath('foo.txt'), 'hello');
});
`,
}, {}, {}, { usesCustomOutputDir: true });
expect(result.exitCode).toBe(0);
expect(fs.existsSync(testInfo.outputPath('test-results', 'example-hello-world', 'hello')));
});
test('should allow nonAscii characters in the output dir', async ({ runInlineTest }, testInfo) => {
const result = await runInlineTest({