Multiple tag values: how to get Cypress or Playwright test tags into Test Visibility #4413
-
Hello community, So this question is oriented at enriching the metadata for the test runs that are recorded into Datadog with the Test Visibility feature. We are currently migrating from Cypress to Playwright, and to get more visibility on what's going on with the testing in our pipelines, we want to add more tags and metadata to each test run. One of the things that we want to do is to add the tags that a test already has, i.e. both in Cypress and Playwright we can basically Ideally, we would like to push an array of these tag values to some names tag in Datadog, but from what I've researched so far in the docs, it seems like a tag is basically a key-value pair, so for the same key, we can't have multiple values (as we would like in this case, something like
Has anyone come up with a better approach? Any help is very much appreciated 😄 |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments 10 replies
-
Probably @juan-fernandez can shed some light in this topic? 🙏 |
Beta Was this translation helpful? Give feedback.
-
hey @cgutierrezpa! Thanks for opening the discussion.
Could you tell me exactly how do you set those per test tags in your code? Is it by using playwright's tags? https://playwright.dev/docs/test-annotations#tag-tests test('test login page', {
tag: '@fast',
}, async ({ page }) => {
// ...
});
test('test full report @slow', async ({ page }) => {
// ...
}); This is something that we'd like to support natively so any piece of information is welcome.
Arrays are indeed not supported for arbitrary tags. Custom tags are supported by playwright annotations: https://docs.datadoghq.com/tests/setup/javascript/?tab=playwright#adding-custom-tags-to-tests, but only strings are supported. You could do something like: test('user profile', async ({ page }) => {
test.info().annotations.push({
type: 'DD_TAGS[test.memory.array]', // DD_TAGS is mandatory and case sensitive
description: JSON.stringify(["@smoke", "@third-party"]),
}); But the experience wouldn't be great, as you'd have to use string query params to do search, like:
I think this would be essentially the same as your suggested approach with
It does not 😄
This is probably the approach that makes filtering the easiest, though I agree having a long list of facets is not the greatest. To sum up:
|
Beta Was this translation helpful? Give feedback.
hey @cgutierrezpa! Thanks for opening the discussion.
I'll try to go point by point.
Could you tell me exactly how do you set those per test tags in your code? Is it by using playwright's tags? https://playwright.dev/docs/test-annotations#tag-tests