Playwright is a framework for Web Testing and Automation. It allows testing Chromium, Firefox and WebKit with a single API.
TypeScript automationchromechromiume2e-testingelectronend-to-end-testingfirefoxjavascriptplaywrighttesttest-automationtestingtesting-toolswebwebkit
fix: Fixes #19169 Issue with moving up a directory in snapshotPathTemplate (#19170)
Shubham Kanodia4679cfaeb914
diff --git a/packages/playwright-test/src/testInfo.ts b/packages/playwright-test/src/testInfo.tsindex a582b8fd1d..35e24792bd 100644--- a/packages/playwright-test/src/testInfo.ts+++ b/packages/playwright-test/src/testInfo.ts@@ -246,19 +246,20 @@ export class TestInfoImpl implements TestInfo {const parsedRelativeTestFilePath = path.parse(relativeTestFilePath);const projectNamePathSegment = sanitizeForFilePath(this.project.name);- const snapshotPath = path.resolve(this.config._configDir, this.project.snapshotPathTemplate+ const snapshotPath = this.project.snapshotPathTemplate.replace(/\{(.)?testDir\}/g, '$1' + this.project.testDir).replace(/\{(.)?snapshotDir\}/g, '$1' + this.project.snapshotDir)- .replace(/\{(.)?snapshotSuffix\}/g, this.snapshotSuffix ? '$1' + this.snapshotSuffix : ''))+ .replace(/\{(.)?snapshotSuffix\}/g, this.snapshotSuffix ? '$1' + this.snapshotSuffix : '')+ .replace(/\{(.)?testFileDir\}/g, '$1' + parsedRelativeTestFilePath.dir).replace(/\{(.)?platform\}/g, '$1' + process.platform).replace(/\{(.)?projectName\}/g, projectNamePathSegment ? '$1' + projectNamePathSegment : '').replace(/\{(.)?testName\}/g, '$1' + this._fsSanitizedTestName())- .replace(/\{(.)?testFileDir\}/g, '$1' + parsedRelativeTestFilePath.dir).replace(/\{(.)?testFileName\}/g, '$1' + parsedRelativeTestFilePath.base).replace(/\{(.)?testFilePath\}/g, '$1' + relativeTestFilePath).replace(/\{(.)?arg\}/g, '$1' + path.join(parsedSubPath.dir, parsedSubPath.name)).replace(/\{(.)?ext\}/g, parsedSubPath.ext ? '$1' + parsedSubPath.ext : '');- return path.normalize(snapshotPath);++ return path.normalize(path.resolve(this.config._configDir, snapshotPath));}skip(...args: [arg?: any, description?: string]) {