diff --git a/playwright/package.json b/playwright/package.json index a749c3d..906fc97 100644 --- a/playwright/package.json +++ b/playwright/package.json @@ -1,6 +1,6 @@ { "name": "testsolar-oss-playwright", - "version": "0.2.23", + "version": "0.2.24", "description": "TestSolar support for playwright tool", "main": "main.js", "scripts": { diff --git a/playwright/src/playwrightx/utils.ts b/playwright/src/playwrightx/utils.ts index b3dbc74..02abe6a 100644 --- a/playwright/src/playwrightx/utils.ts +++ b/playwright/src/playwrightx/utils.ts @@ -722,6 +722,9 @@ export function createTestResults( const testResults: TestResult[] = []; const casePrefix = getTestcasePrefix(); + // 检查是否为 fileMode + const fileMode = process.env.TESTSOLAR_TTP_FILEMODE == "1"; + // 首先找出参考失败用例(output中的key不在testIdentifiers中的) let referenceFailedTest: TestResult | null = null; @@ -731,7 +734,14 @@ export function createTestResults( const fullTestPath = `${casePrefix}${testCase}`; // 判断当前测试用例是否在testIdentifiers中 - const isInTestIdentifiers = testIdentifiers.includes(testCase); + let isInTestIdentifiers = testIdentifiers.includes(testCase); + + // 在 fileMode 下,需要检查测试用例是否属于指定的文件 + if (fileMode && !isInTestIdentifiers) { + // 提取测试用例的文件路径部分(问号之前的部分) + const testFilePath = testCase.split('?')[0]; + isInTestIdentifiers = testIdentifiers.includes(testFilePath); + } // 处理每个结果 for (const result of results) { diff --git a/playwright/testtool.yaml b/playwright/testtool.yaml index 0ad0ebf..1f0b2ff 100644 --- a/playwright/testtool.yaml +++ b/playwright/testtool.yaml @@ -2,7 +2,7 @@ schemaVersion: 1.0 name: playwright nameZh: Playwright自动化测试 lang: javascript -version: '0.2.23' +version: '0.2.24' defaultBaseImage: node:18 langType: INTERPRETED description: |-