Skip to content

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

chore(test-runner): make outputDir based on cwd instead of testDir (#9360)

Max Schmittb1160ec239c1
diff --git a/packages/playwright-test/src/loader.ts b/packages/playwright-test/src/loader.ts
index 48a5dde911..fb7a5b253a 100644
--- a/packages/playwright-test/src/loader.ts
+++ b/packages/playwright-test/src/loader.ts
@@ -104,7 +104,7 @@ export class Loader {
this._fullConfig.webServer = takeFirst(this._configOverrides.webServer, this._config.webServer, baseFullConfig.webServer);
for (const project of projects)
- this._addProject(project, this._fullConfig.rootDir);
+ this._addProject(project, this._fullConfig.rootDir, rootDir);
this._fullConfig.projects = this._projects.map(p => p.config);
}
@@ -162,13 +162,13 @@ export class Loader {
};
}
- private _addProject(projectConfig: Project, rootDir: string) {
+ private _addProject(projectConfig: Project, rootDir: string, configDir: string) {
let testDir = takeFirst(projectConfig.testDir, rootDir);
if (!path.isAbsolute(testDir))
- testDir = path.resolve(rootDir, testDir);
+ testDir = path.resolve(configDir, testDir);
let outputDir = takeFirst(this._configOverrides.outputDir, projectConfig.outputDir, this._config.outputDir, path.resolve(process.cwd(), 'test-results'));
if (!path.isAbsolute(outputDir))
- outputDir = path.resolve(rootDir, outputDir);
+ outputDir = path.resolve(configDir, outputDir);
const fullProject: FullProject = {
define: takeFirst(this._configOverrides.define, projectConfig.define, this._config.define, []),
expect: takeFirst(this._configOverrides.expect, projectConfig.expect, this._config.expect, undefined),
diff --git a/tests/playwright-test/test-output-dir.spec.ts b/tests/playwright-test/test-output-dir.spec.ts
index dcb349ba72..b47541da38 100644
--- a/tests/playwright-test/test-output-dir.spec.ts
+++ b/tests/playwright-test/test-output-dir.spec.ts
@@ -396,7 +396,6 @@ test('should accept a relative path for outputDir', async ({ runInlineTest }, te
});
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');