feat(testmanagement): template selection + multi-select custom fields#319
Merged
Merged
Conversation
…tom fields createTestCase gains an optional `template` (internal slug, e.g. test_case_steps or test_case_bdd) passed through to the TM v2 create endpoint, with a warning when the API silently falls back to the default for an unrecognized value. Display names are not accepted and the form-fields endpoint does not enumerate templates, so slug pass-through is the only viable approach. template is create-only -- the PATCH/update endpoint ignores it -- so it is not added to updateTestCase. custom_fields on both create and update now accept array values, enabling multi-select custom fields (keyed by field name). Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
ruturaj-browserstack
approved these changes
Jun 15, 2026
Merged
gaurav-singh-9227
added a commit
that referenced
this pull request
Jun 25, 2026
…TestCaseTemplates Follow-up to #319, which added a `template` param that only ever selects a SYSTEM template (the TM create logic maps the slug to {is_system, step_type}, and step_type is constrained to test_case_steps/test_case_bdd and isn't unique). A custom template is selectable only by its numeric template_id. Two capabilities, both verified end-to-end against prod: - listTestCaseTemplates: lists templates with their numeric ids via GET /api/v1/admin-v2/settings/templates?entity_type=TestCase (API-TOKEN auth), with a client-side name filter. - createTestCase template_id: the public v2 create endpoint silently drops template_id, but the v1 create endpoint honours it. When template_id is set we route to POST /api/v1/projects/{numericId}/test-cases (API-TOKEN, folder in the body) and translate custom_fields from the by-name shape (v2) to v1's by-id shape (field name -> id, option value -> option id) so multi-select custom fields keep working alongside a template. With no template_id, the proven v2 path is unchanged (zero regression). A post-create read-back warns if the applied template differs (e.g. id not linked to the project). Verified live: create with template_id + multi-select custom_fields + priority + tags + steps applied all of them. Tests +6. npm run build green (lint, format, tsc, tests). Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What & why
Closes a customer blocker in the Test Management
createTestCase/updateTestCasetools. Two gaps:custom_fieldscouldn't hold multiple values — the Zod schema restricted values tostring | number | boolean, blocking arrays, so multi-select custom fields couldn't be set programmatically.How the contract was determined
I probed the live TM v2 API (a project with real custom fields incl. a
field_multi_dropdown) before writing code:test_case_bddwas recognized (HTTP 422"Scenario is required for BDD test cases"). A display name ("Test Case BDD") was silently ignored and fell back totest_case_steps.form-fields-v2does not enumerate templates and there's no template-list endpoint, so resolving display→slug server-side isn't possible. Pass-through of the slug is the only viable approach.templateis create-only. The PATCH/update endpoint ignores it (even a valid slug didn't switch the template), sotemplateis intentionally not added toupdateTestCase.{ "Field Name": ["opt1","opt2"] }. Keying by field id or a CSV string is silently dropped.Changes
create-testcase.ts: optionaltemplateparam (slug, pass-through) + a mismatch warning when the API silently falls back;custom_fieldswidened to accept arrays (multi-select). New exportedCustomFieldValuetype +customFieldValueSchema.update-testcase.ts:custom_fieldswidened to accept arrays. Notemplate(API ignores it on update).testmanagement.test.ts: +4 tests — slug pass-through, the silent-fallback warning, and arraycustom_fieldson both create and update. (apiClientmock gainedpatch.)Testing
npm run buildpasses locally — lint, format, 186 tests (4 new), andtscall green.Known limitation
Switching an existing test case's template via
updateTestCaseis not supported by the TM API — it ignores thetemplatefield on PATCH. Template can only be set at creation; supporting post-creation switching would need a TM backend change.🤖 Generated with Claude Code