Skip to content

Conversation

wooly
Copy link
Contributor

@wooly wooly commented May 26, 2025

Description

Playwright has the ability to tag tests.

We want to enable execution-level tagging for playwright so that individual executions can be tagged in TE.

This PR adds the ability to specify tags in the form of @key:value and have these parsed by TE as key: value pairs.

const fileName = this._paths.prefixTestPath(test.location.file);
const location = [fileName, test.location.line, test.location.column].join(':');

const tags = (test.tags || []).reduce((acc, test) => {
Copy link
Contributor

@nprizal nprizal May 26, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Have you looked into Test Annotation? It supports key/value-like structure.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I considered that yep, but felt it was more likely that they were already using the annotations for other stuff than using tags in a particular format. I'd then need to allow for an annotation sentinel that I could use to detect annotations that were meant to be passed through to bk, to avoid ones that weren't being passed through.

@wooly wooly force-pushed the wooly/playwright-tag-support branch from 9283f11 to 8e2d05a Compare May 27, 2025 00:22
@wooly wooly force-pushed the wooly/playwright-tag-support branch from 8e2d05a to a6f8066 Compare May 27, 2025 00:25
@wooly wooly requested review from a team and nprizal May 27, 2025 02:51
const { test, expect } = require('@playwright/test');

test('has title', async ({ page }) => {
test('has title', { tag: ['@foo:bar'] }, async ({ page }) => {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

can we make sure it works with multiple tag?

Copy link
Contributor

@nprizal nprizal left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Changes look good to me 👍 Can we also update the readme?

@wooly wooly force-pushed the wooly/playwright-tag-support branch from 94a1da1 to 7768087 Compare May 28, 2025 23:07
@wooly
Copy link
Contributor Author

wooly commented May 28, 2025

@nprizal @KatieWright26 I've updated the tests and added a small section to the README.md. Could I please have a re-review? TIA!

@wooly wooly requested review from KatieWright26 and nprizal May 28, 2025 23:10
@wooly wooly merged commit 9e3d57e into main May 29, 2025
1 check passed
@wooly wooly deleted the wooly/playwright-tag-support branch May 29, 2025 03:00
@wooly wooly changed the title Add support for tagging executions in playwright [TE-3912] Add support for tagging executions in playwright Jun 3, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants