Skip to content

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

fix: test-list should update blob hash (#39262)

Simon Knott734ccb635a6c
diff --git a/packages/playwright/src/runner/reporters.ts b/packages/playwright/src/runner/reporters.ts
index ac5c621239..d3324a5383 100644
--- a/packages/playwright/src/runner/reporters.ts
+++ b/packages/playwright/src/runner/reporters.ts
@@ -13,7 +13,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-
+import fs from 'fs';
import { calculateSha1 } from 'playwright-core/lib/utils';
import { loadReporter } from './loadUtils';
@@ -127,6 +127,10 @@ function computeCommandHash(config: FullConfigInternal) {
command.cliOnlyChanged = config.cliOnlyChanged;
if (config.config.tags.length)
command.tags = config.config.tags.join(' ');
+ if (config.cliTestList)
+ command.cliTestList = calculateSha1(fs.readFileSync(config.cliTestList));
+ if (config.cliTestListInvert)
+ command.cliTestListInvert = calculateSha1(fs.readFileSync(config.cliTestListInvert));
if (Object.keys(command).length)
parts.push(calculateSha1(JSON.stringify(command)).substring(0, 7));
return parts.join('-');
diff --git a/tests/playwright-test/reporter-blob.spec.ts b/tests/playwright-test/reporter-blob.spec.ts
index 2cf828cec3..c278de2f6e 100644
--- a/tests/playwright-test/reporter-blob.spec.ts
+++ b/tests/playwright-test/reporter-blob.spec.ts
@@ -2196,6 +2196,18 @@ test('project filter in report name', async ({ runInlineTest }) => {
const reportFiles = await fs.promises.readdir(reportDir);
expect(reportFiles.sort()).toEqual(['report-foo-b-r-6d9d49e-1.zip']);
}
+
+ {
+ const result = await runInlineTest({ ...files, 'test-list.txt': `foo` }, { 'test-list': 'test-list.txt' });
+ expect(result.exitCode).toBe(0);
+ const reportFiles = await fs.promises.readdir(reportDir);
+
+ const result2 = await runInlineTest({ ...files, 'test-list.txt': `bar` }, { 'test-list': 'test-list.txt' });
+ expect(result2.exitCode).toBe(0);
+ const reportFiles2 = await fs.promises.readdir(reportDir);
+
+ expect(reportFiles2.sort()).not.toEqual(reportFiles.sort());
+ }
});
test('should report duration across all shards', async ({ runInlineTest, mergeReports }) => {