mirror of
https://github.com/microsoft/playwright.git
synced 2024-11-28 09:23:42 +03:00
chore: remove usesCustomOutputDir from tests (#21011)
This commit is contained in:
parent
ae05808f4b
commit
56dbd1fcb0
@ -122,7 +122,7 @@ test('outputDir should not be removed', async ({ runInlineTest }, testInfo) => {
|
||||
require('fs').writeFileSync(testInfo.outputPath('myfile.txt'), 'hello');
|
||||
});
|
||||
`,
|
||||
}, {}, {}, { usesCustomOutputDir: true });
|
||||
});
|
||||
expect(result1.exitCode).toBe(0);
|
||||
expect(fs.existsSync(path.join(outputDir, 'a-my-test', 'myfile.txt'))).toBe(true);
|
||||
|
||||
@ -136,7 +136,7 @@ test('outputDir should not be removed', async ({ runInlineTest }, testInfo) => {
|
||||
console.log(testInfo.outputDir);
|
||||
});
|
||||
`,
|
||||
}, { list: true }, {}, { usesCustomOutputDir: true });
|
||||
}, { list: true });
|
||||
expect(result2.exitCode).toBe(0);
|
||||
expect(fs.existsSync(path.join(outputDir, 'a-my-test', 'myfile.txt'))).toBe(true);
|
||||
});
|
||||
|
@ -89,8 +89,6 @@ async function runPlaywrightTest(childProcess: CommonFixtures['childProcess'], b
|
||||
const outputDir = path.join(baseDir, 'test-results');
|
||||
const reportFile = path.join(outputDir, 'report.json');
|
||||
const args = ['test'];
|
||||
if (!options.usesCustomOutputDir)
|
||||
args.push('--output=' + outputDir);
|
||||
if (!options.usesCustomReporters)
|
||||
args.push('--reporter=dot,json');
|
||||
args.push(
|
||||
@ -226,7 +224,6 @@ function cleanEnv(env: NodeJS.ProcessEnv): NodeJS.ProcessEnv {
|
||||
|
||||
type RunOptions = {
|
||||
sendSIGINTAfter?: number;
|
||||
usesCustomOutputDir?: boolean;
|
||||
usesCustomReporters?: boolean;
|
||||
additionalArgs?: string[];
|
||||
cwd?: string,
|
||||
|
@ -953,7 +953,6 @@ test.describe('report location', () => {
|
||||
`
|
||||
}, { 'reporter': 'html' }, { PW_TEST_HTML_REPORT_OPEN: 'never' }, {
|
||||
cwd: 'foo/bar/baz/tests',
|
||||
usesCustomOutputDir: true
|
||||
});
|
||||
expect(result.exitCode).toBe(0);
|
||||
expect(result.passed).toBe(1);
|
||||
@ -978,7 +977,6 @@ test.describe('report location', () => {
|
||||
`
|
||||
}, { 'reporter': 'html' }, { 'PW_TEST_HTML_REPORT_OPEN': 'never', 'PLAYWRIGHT_HTML_REPORT': '../my-report' }, {
|
||||
cwd: 'foo/bar/baz/tests',
|
||||
usesCustomOutputDir: true
|
||||
});
|
||||
expect(result.exitCode).toBe(0);
|
||||
expect(result.passed).toBe(1);
|
||||
|
@ -287,7 +287,6 @@ test.describe('report location', () => {
|
||||
`
|
||||
}, { 'reporter': 'json' }, { 'PW_TEST_HTML_REPORT_OPEN': 'never', 'PLAYWRIGHT_JSON_OUTPUT_NAME': '../my-report.json' }, {
|
||||
cwd: 'foo/bar/baz/tests',
|
||||
usesCustomOutputDir: true
|
||||
});
|
||||
expect(result.exitCode).toBe(0);
|
||||
expect(result.passed).toBe(1);
|
||||
|
@ -480,7 +480,6 @@ test.describe('report location', () => {
|
||||
`
|
||||
}, { 'reporter': 'junit' }, { 'PLAYWRIGHT_JUNIT_OUTPUT_NAME': '../my-report.xml' }, {
|
||||
cwd: 'foo/bar/baz/tests',
|
||||
usesCustomOutputDir: true
|
||||
});
|
||||
expect(result.exitCode).toBe(0);
|
||||
expect(result.passed).toBe(1);
|
||||
|
@ -26,7 +26,7 @@ test('should generate raw report', async ({ runInlineTest }, testInfo) => {
|
||||
import { test, expect } from '@playwright/test';
|
||||
test('passes', async ({ page }, testInfo) => {});
|
||||
`,
|
||||
}, { reporter: 'dot,' + kRawReporterPath }, {}, { usesCustomOutputDir: true });
|
||||
}, { reporter: 'dot,' + kRawReporterPath });
|
||||
const json = JSON.parse(fs.readFileSync(testInfo.outputPath('test-results', 'report', 'project.report'), 'utf-8'));
|
||||
expect(json.config).toBeTruthy();
|
||||
expect(json.project).toBeTruthy();
|
||||
@ -47,7 +47,7 @@ test('should use project name', async ({ runInlineTest }, testInfo) => {
|
||||
import { test, expect } from '@playwright/test';
|
||||
test('passes', async ({ page }, testInfo) => {});
|
||||
`,
|
||||
}, { reporter: 'dot,' + kRawReporterPath }, {}, { usesCustomOutputDir: true });
|
||||
}, { reporter: 'dot,' + kRawReporterPath });
|
||||
const json = JSON.parse(fs.readFileSync(testInfo.outputPath('output', 'report', 'project-name.report'), 'utf-8'));
|
||||
expect(json.project.name).toBe('project-name');
|
||||
expect(result.exitCode).toBe(0);
|
||||
@ -64,7 +64,7 @@ test('should save stdio', async ({ runInlineTest }, testInfo) => {
|
||||
process.stderr.write(Buffer.from([4, 5, 6]));
|
||||
});
|
||||
`,
|
||||
}, { reporter: 'dot,' + kRawReporterPath }, {}, { usesCustomOutputDir: true });
|
||||
}, { reporter: 'dot,' + kRawReporterPath });
|
||||
const json = JSON.parse(fs.readFileSync(testInfo.outputPath('test-results', 'report', 'project.report'), 'utf-8'));
|
||||
const result = json.suites[0].tests[0].results[0];
|
||||
expect(result.attachments).toEqual([
|
||||
@ -100,7 +100,7 @@ test('should save attachments', async ({ runInlineTest }, testInfo) => {
|
||||
});
|
||||
});
|
||||
`,
|
||||
}, { reporter: 'dot,' + kRawReporterPath }, {}, { usesCustomOutputDir: true });
|
||||
}, { reporter: 'dot,' + kRawReporterPath });
|
||||
const json = JSON.parse(fs.readFileSync(testInfo.outputPath('test-results', 'report', 'project.report'), 'utf-8'));
|
||||
const result = json.suites[0].tests[0].results[0];
|
||||
expect(result.attachments[0].name).toBe('binary');
|
||||
@ -148,7 +148,7 @@ test(`testInfo.attach should save attachments via path`, async ({ runInlineTest
|
||||
await fs.promises.unlink(tmpPath);
|
||||
});
|
||||
`,
|
||||
}, { reporter: 'dot,' + kRawReporterPath, workers: 1 }, {}, { usesCustomOutputDir: true });
|
||||
}, { reporter: 'dot,' + kRawReporterPath, workers: 1 });
|
||||
const json = JSON.parse(fs.readFileSync(testInfo.outputPath('test-results', 'report', 'project.report'), 'utf-8'));
|
||||
{
|
||||
const result = json.suites[0].tests[0].results[0];
|
||||
@ -210,7 +210,7 @@ test(`testInfo.attach should save attachments via inline attachment`, async ({ r
|
||||
await testInfo.attach('example.json', { body: Buffer.from('We <3 Playwright!'), contentType: 'x-playwright/custom' });
|
||||
});
|
||||
`,
|
||||
}, { reporter: 'dot,' + kRawReporterPath, workers: 1 }, {}, { usesCustomOutputDir: true });
|
||||
}, { reporter: 'dot,' + kRawReporterPath, workers: 1 });
|
||||
const json = JSON.parse(fs.readFileSync(testInfo.outputPath('test-results', 'report', 'project.report'), 'utf-8'));
|
||||
{
|
||||
const result = json.suites[0].tests[0].results[0];
|
||||
@ -253,7 +253,7 @@ test('dupe project names', async ({ runInlineTest }, testInfo) => {
|
||||
import { test, expect } from '@playwright/test';
|
||||
test('passes', async ({ page }, testInfo) => {});
|
||||
`,
|
||||
}, { reporter: 'dot,' + kRawReporterPath }, {}, { usesCustomOutputDir: true });
|
||||
}, { reporter: 'dot,' + kRawReporterPath });
|
||||
const files = fs.readdirSync(testInfo.outputPath('test-results', 'report'));
|
||||
expect(new Set(files)).toEqual(new Set(['project-name.report', 'project-name-1.report', 'project-name-2.report']));
|
||||
});
|
||||
|
@ -99,7 +99,6 @@ test('should default to package.json directory', async ({ runInlineTest }, testI
|
||||
`
|
||||
}, { 'reporter': '' }, {}, {
|
||||
cwd: 'foo/bar/baz/tests',
|
||||
usesCustomOutputDir: true
|
||||
});
|
||||
expect(result.exitCode).toBe(0);
|
||||
expect(result.passed).toBe(1);
|
||||
@ -364,7 +363,7 @@ test('should accept a relative path for outputDir', async ({ runInlineTest }, te
|
||||
{ outputDir: './my-output-dir' },
|
||||
] };
|
||||
`,
|
||||
}, {}, {}, { usesCustomOutputDir: true });
|
||||
});
|
||||
expect(result.exitCode).toBe(0);
|
||||
});
|
||||
|
||||
@ -383,7 +382,7 @@ test('should have output dir based on rootDir (cwd)', async ({ runInlineTest },
|
||||
fs.writeFileSync(testInfo.outputPath('foo.txt'), 'hello');
|
||||
});
|
||||
`,
|
||||
}, {}, {}, { usesCustomOutputDir: true });
|
||||
});
|
||||
expect(result.exitCode).toBe(0);
|
||||
expect(fs.existsSync(testInfo.outputPath('test-results', 'example-hello-world', 'foo.txt'))).toBe(true);
|
||||
});
|
||||
|
Loading…
Reference in New Issue
Block a user