Commit bfae32d
feat: add setCustomTag API for custom test metadata (#51)
* feat: add setCustomTag API for custom test metadata
Expose browser.setCustomTag(keyName, keyValue, buildLevelCustomTag) to
let users tag tests with custom metadata sent to TestHub. Tags with the
same key are merged (not overridden). Supports both test-level and
build-level metadata, comma-separated values, and pending tag buffering
for calls made before the test UUID is assigned.
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
* fix: resolve custom tag bugs — regex parsing, UUID race condition, and worker IPC
- Fix splitValues regex to handle whitespace before quoted strings
(e.g. `foo, "bar,baz"` now correctly parses as ["foo", "bar,baz"])
- Fix test-level tags missing for non-first tests in a suite: test body
runs before TestRunStarted assigns the new UUID, so setCustomTag was
storing tags under the previous test's UUID. Now clear UUID in
TestRunFinished and drain pendingTestTags synchronously before the
async sendTestRunEvent to avoid race conditions.
- Add worker IPC for build-level tags: workers send tags via
process.send (Cucumber) and temp files (Nightwatch parallel),
parent aggregates before stopBuildUpstream.
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
* fix: scope temp files to run ID, deep-clone metadata getters
- Scope build-tag temp files with BROWSERSTACK_TESTHUB_UUID to prevent
cross-run contamination from stale files in tmpdir
- Deep-clone returns from getTestLevelCustomMetadata and
getBuildLevelCustomMetadata to prevent callers mutating internal state
- Add tests for deep-clone and temp file scoping
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
* eslint comments
---------
Co-authored-by: Claude Opus 4.6 (1M context) <noreply@anthropic.com>1 parent abe5c4f commit bfae32d
5 files changed
Lines changed: 433 additions & 0 deletions
File tree
- .github/dev-guide
- nightwatch
- src
- utils
- test/src/utils
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
| 48 | + | |
| 49 | + | |
| 50 | + | |
| 51 | + | |
| 52 | + | |
| 53 | + | |
| 54 | + | |
| 55 | + | |
| 56 | + | |
| 57 | + | |
| 58 | + | |
| 59 | + | |
| 60 | + | |
| 61 | + | |
| 62 | + | |
| 63 | + | |
| 64 | + | |
| 65 | + | |
| 66 | + | |
| 67 | + | |
| 68 | + | |
| 69 | + | |
| 70 | + | |
| 71 | + | |
| 72 | + | |
| 73 | + | |
| 74 | + | |
| 75 | + | |
| 76 | + | |
| 77 | + | |
| 78 | + | |
| 79 | + | |
| 80 | + | |
| 81 | + | |
| 82 | + | |
| 83 | + | |
| 84 | + | |
| 85 | + | |
| 86 | + | |
| 87 | + | |
| 88 | + | |
| 89 | + | |
| 90 | + | |
| 91 | + | |
| 92 | + | |
| 93 | + | |
| 94 | + | |
| 95 | + | |
| 96 | + | |
| 97 | + | |
| 98 | + | |
| 99 | + | |
| 100 | + | |
| 101 | + | |
| 102 | + | |
| 103 | + | |
| 104 | + | |
| 105 | + | |
| 106 | + | |
| 107 | + | |
| 108 | + | |
| 109 | + | |
| 110 | + | |
| 111 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
6 | 6 | | |
7 | 7 | | |
8 | 8 | | |
| 9 | + | |
| 10 | + | |
9 | 11 | | |
10 | 12 | | |
11 | 13 | | |
12 | 14 | | |
| 15 | + | |
13 | 16 | | |
14 | 17 | | |
15 | 18 | | |
| |||
99 | 102 | | |
100 | 103 | | |
101 | 104 | | |
| 105 | + | |
| 106 | + | |
| 107 | + | |
| 108 | + | |
| 109 | + | |
| 110 | + | |
| 111 | + | |
| 112 | + | |
102 | 113 | | |
103 | 114 | | |
104 | 115 | | |
| |||
151 | 162 | | |
152 | 163 | | |
153 | 164 | | |
| 165 | + | |
154 | 166 | | |
155 | 167 | | |
156 | 168 | | |
| |||
279 | 291 | | |
280 | 292 | | |
281 | 293 | | |
| 294 | + | |
| 295 | + | |
| 296 | + | |
| 297 | + | |
282 | 298 | | |
283 | 299 | | |
| 300 | + | |
| 301 | + | |
| 302 | + | |
284 | 303 | | |
285 | 304 | | |
286 | 305 | | |
| |||
479 | 498 | | |
480 | 499 | | |
481 | 500 | | |
| 501 | + | |
| 502 | + | |
| 503 | + | |
| 504 | + | |
| 505 | + | |
| 506 | + | |
| 507 | + | |
| 508 | + | |
| 509 | + | |
| 510 | + | |
| 511 | + | |
| 512 | + | |
| 513 | + | |
| 514 | + | |
| 515 | + | |
| 516 | + | |
| 517 | + | |
| 518 | + | |
| 519 | + | |
| 520 | + | |
482 | 521 | | |
483 | 522 | | |
484 | 523 | | |
| |||
499 | 538 | | |
500 | 539 | | |
501 | 540 | | |
| 541 | + | |
| 542 | + | |
| 543 | + | |
| 544 | + | |
| 545 | + | |
| 546 | + | |
| 547 | + | |
502 | 548 | | |
503 | 549 | | |
504 | 550 | | |
| |||
552 | 598 | | |
553 | 599 | | |
554 | 600 | | |
| 601 | + | |
| 602 | + | |
| 603 | + | |
| 604 | + | |
| 605 | + | |
| 606 | + | |
| 607 | + | |
| 608 | + | |
| 609 | + | |
| 610 | + | |
| 611 | + | |
| 612 | + | |
| 613 | + | |
| 614 | + | |
| 615 | + | |
| 616 | + | |
| 617 | + | |
| 618 | + | |
555 | 619 | | |
556 | 620 | | |
557 | 621 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
12 | 12 | | |
13 | 13 | | |
14 | 14 | | |
| 15 | + | |
15 | 16 | | |
16 | 17 | | |
17 | 18 | | |
| |||
265 | 266 | | |
266 | 267 | | |
267 | 268 | | |
| 269 | + | |
| 270 | + | |
| 271 | + | |
| 272 | + | |
268 | 273 | | |
269 | 274 | | |
270 | 275 | | |
| |||
523 | 528 | | |
524 | 529 | | |
525 | 530 | | |
| 531 | + | |
| 532 | + | |
| 533 | + | |
| 534 | + | |
| 535 | + | |
| 536 | + | |
| 537 | + | |
| 538 | + | |
| 539 | + | |
526 | 540 | | |
527 | 541 | | |
528 | 542 | | |
| |||
685 | 699 | | |
686 | 700 | | |
687 | 701 | | |
| 702 | + | |
| 703 | + | |
| 704 | + | |
| 705 | + | |
| 706 | + | |
| 707 | + | |
| 708 | + | |
| 709 | + | |
| 710 | + | |
688 | 711 | | |
689 | 712 | | |
690 | 713 | | |
| |||
0 commit comments