Commit Graph

380 Commits

Author SHA1 Message Date
Patrik Oldsberg 3843732b73 scaffolder-react: update useTemplateSchema test to use new test utils
Signed-off-by: Patrik Oldsberg <poldsberg@gmail.com>
2026-02-09 19:53:32 +01:00
Patrik Oldsberg 36fb574fff use new mockApis
Signed-off-by: Patrik Oldsberg <poldsberg@gmail.com>
2026-02-05 23:50:28 +01:00
Patrik Oldsberg 2eeca031c4 scaffolder: migrate nfs form fields to utility API
Signed-off-by: Patrik Oldsberg <poldsberg@gmail.com>
2026-01-26 16:53:04 +01:00
Johan Persson cd0b8a11a3 chore: make jest a peer dependency with v29/v30 support
Move jest from dependencies to peer dependencies, allowing users to
choose between Jest 29 and Jest 30.

The CLI now detects the Jest version at runtime and uses the
appropriate environment:
- Jest 29: Uses standard jest-environment-jsdom
- Jest 30: Uses a custom environment based on @jest/environment-jsdom-abstract
  with fixes for Web API globals (fetch, streams, Error, etc.)

The cross-fetch polyfill is only injected for Jest 29, as with Jest 30+
our patched Jest environment is used. The network request blocker is made
MSW-compatible by checking if fetch was wrapped before blocking.

Jest 30 (with jsdom v27) fixes `Could not parse CSS stylesheet`
warnings/errors when testing components from @backstage/ui or other
packages using CSS `@layer` declarations.

New peer dependencies (install based on your Jest version):
- jest (required, ^29 or ^30)
- Jest 29 requires: jest-environment-jsdom
- Jest 30 requires: @jest/environment-jsdom-abstract, jsdom

Production code changes for jsdom 27 testability:
- AppIdentityProxy: extract navigateToUrl method for spying
- LiveReloadAddon: export utils.reloadPage for spying
- collect.ts: export internal.resolvePackagePath for mocking

MockFetchApi: evaluate global.fetch at call time instead of construction
time, allowing MSW to patch fetch after MockFetchApi is constructed.

Test adaptations for jsdom 27:
- Use RGB values instead of named colors in CSS assertions
- Update error format expectations (hyphenated type names, SyntaxError
  instead of FetchError for JSON parse errors)
- Simplify URL error assertions for cross-version compatibility
- Fix accessible name whitespace handling for external links
- Use history.replaceState for location mocking (non-configurable)
- Use fireEvent.blur for contentEditable elements
- Move async assertions inside waitFor for race conditions
- Remove Blob.prototype.text polyfill (now native)
- Remove test case using credentials in plugin:// URLs

Test adaptations for Jest 30:
- Replace `expect.objectContaining([...])` with direct array equality
- Replace `expect.objectContaining({ length: N })` with
  `expect.any(Array)` + separate `toHaveLength()` assertions
- Use child process for native Node.js module resolution in
  collect.test.ts to work around Jest 30's resolver behavior
- Update snapshot headers for new Jest format

Also removes the jest-haste-map patch which is no longer needed.

Signed-off-by: Johan Persson <johanopersson@gmail.com>
2025-12-11 18:06:55 +01:00
ambulgm 275a57d772 don't format custom names
Signed-off-by: ambulgm <mukul.ambulgekar@autodesk.com>
2025-11-25 17:35:54 +01:00
Patrik Oldsberg b436f73803 Merge pull request #31166 from schultzp2020/constructor-parameters
refactor: convert constructor parameter properties for erasableSyntaxOnly compatibility
2025-10-15 18:56:42 +02:00
Paul Schultz 05f60e1e0a refactor: convert constructor parameter properties for erasableSyntaxOnly compatibility
Signed-off-by: Paul Schultz <pschultz@pobox.com>
2025-10-14 08:29:21 -05:00
Iain van der Wiel 5a33f640c2 fix: Fixed bug in template parsing in the useTemplateSchema hook by completely removing title from step instead of setting it to undefined
Signed-off-by: Iain van der Wiel <iain.vanderwiel@gmail.com>
2025-10-10 13:51:11 +02:00
benjdlambert 48df0d0e32 chore: fixing loading state
Signed-off-by: benjdlambert <ben@blam.sh>
2025-09-26 12:50:15 +02:00
Stephen Glass 58fc108846 Set a minimum height for scaffolder task log stream
Signed-off-by: Stephen Glass <stephen@stephen.glass>
2025-08-20 23:16:24 -04:00
Patrik Oldsberg 147482b700 frontend-plugin-api: switch naming recommendation from define to defineParams
Signed-off-by: Patrik Oldsberg <poldsberg@gmail.com>
2025-08-04 17:17:05 +02:00
Ben Lambert 1315a825cf Merge pull request #27771 from solimant/23819_scaffolder_openapi
Move Scaffolder API to OpenAPI
2025-07-29 14:36:47 +02:00
Ben Lambert cf6fb4b5aa Merge pull request #30670 from backstage/export
Export `FormField` type from Scaffolder
2025-07-29 14:08:29 +02:00
benjdlambert c48a43fe53 chore: small refactor and moving types around
Signed-off-by: benjdlambert <ben@blam.sh>
2025-07-29 13:45:11 +02:00
solimant d2da49c568 Deprecate and re-export
Signed-off-by: solimant <solimant@users.noreply.github.com>
2025-07-28 20:59:34 +00:00
Patrik Oldsberg f2f133ce8d update all usages of ApiBlueprint
Signed-off-by: Patrik Oldsberg <poldsberg@gmail.com>
2025-07-28 22:27:13 +02:00
Ben Lambert d95621b1ee Merge pull request #29202 from 04kash/scaffolder-task-granular-permissions
Scaffolder task granular permissions
2025-07-08 12:54:43 +02:00
Stephen Glass 7f650756b1 Fix scroll to on step change test
Signed-off-by: Stephen Glass <stephen@stephen.glass>
2025-07-06 00:57:12 -04:00
Stephen Glass 428b4349f4 Add test for form template scroll to top on step change
Signed-off-by: Stephen Glass <stephen@stephen.glass>
2025-07-06 00:31:17 -04:00
Stephen Glass 94c11a5d7f Scroll to the top of the page when navigating between template form steps
Signed-off-by: Stephen Glass <stephen@stephen.glass>
2025-07-06 00:24:27 -04:00
Kashish Mittal 152ae1e3c5 feat: initial implementation of scaffolder granular permissions
Signed-off-by: Kashish Mittal <kmittal@redhat.com>
Co-authored-by: Frank Kong <frkong@redhat.com>
2025-06-18 16:18:33 -04:00
Vincenzo Scamporlino 2c77bd52d7 scaffolder: track steps
Signed-off-by: Vincenzo Scamporlino <vincenzos@spotify.com>
2025-06-13 10:30:49 +02:00
Vincenzo Scamporlino bea4f7f368 scaffolder: do not error on render method
Signed-off-by: Vincenzo Scamporlino <vincenzos@spotify.com>
2025-06-13 10:01:33 +02:00
Vincenzo Scamporlino 2da89d1289 scaffolder: refine analytics events data
Signed-off-by: Vincenzo Scamporlino <vincenzos@spotify.com>
2025-06-13 10:00:42 +02:00
Gabriel Dugny 72d019d663 chore(typos): Fix low-impact typos
Signed-off-by: Gabriel Dugny <gabriel.dugny@believe.com>
2025-04-23 17:56:22 +02:00
Matt Benson 4235e87d2f add templating extensions page
Signed-off-by: Matt Benson <gudnabrsam@gmail.com>
2025-04-21 10:07:41 -05:00
benjdlambert dc949c8073 templateExtensions -> templatingExtensions
Signed-off-by: benjdlambert <ben@blam.sh>
2025-04-17 10:18:40 +02:00
Ben Lambert aee08a7aa1 Merge pull request #29416 from Vity01/scaffolding-detail-button-color-fix
Scaffolding detail button color fix
2025-04-15 11:26:49 +02:00
Paul Schultz 2e26579e06 chore: update react imports
Signed-off-by: Paul Schultz <pschultz@pobox.com>
2025-04-08 07:35:24 -05:00
Ladislav Vitásek 7ae999684a feat: add customizable className prop to TemplateDetailButton and update CardHeader to use it
Signed-off-by: Ladislav Vitásek <ladislav.vitasek@gendigital.com>
2025-03-28 15:54:48 +01:00
Matt Benson 5890016e8a add api to retrieve template extensions info from scaffolder-backend
Signed-off-by: Matt Benson <gudnabrsam@gmail.com>
2025-03-24 13:25:43 -05:00
Ladislav Vitásek 609a3a123e test fix + button system icon as default
Signed-off-by: Ladislav Vitásek <ladislav.vitasek@gendigital.com>
2025-03-18 12:28:30 +01:00
Ladislav Vitásek 6ed42b764c feat: add TemplateDetailButton to CardHeader and update tests
Signed-off-by: Ladislav Vitásek <ladislav.vitasek@gendigital.com>
2025-03-18 11:26:20 +01:00
JounQin 3db64ba50f feat(scaffolder): disable the submit button on creating
close #29054

Signed-off-by: JounQin <admin@1stg.me>
2025-03-08 02:28:26 +08:00
JounQin 48aab132f6 feat: add i18n support for scaffolder-react plugin
Signed-off-by: JounQin <admin@1stg.me>
2025-03-05 15:11:44 +08:00
Ben Lambert a22c38e5f5 Merge pull request #28944 from acierto/issue-28239-fix
Fix field extension validation not working when field is in dependencies in an array field
2025-02-28 11:25:28 +01:00
bnechyporenko 4d26652893 Fix field extension validation not working when field is in dependencies in an array field
Signed-off-by: bnechyporenko <bnechyporenko@bol.com>
2025-02-23 11:05:53 +01:00
Patrik Oldsberg b3b7c9c99b scaffolder: attach form field extensions to page instead
Signed-off-by: Patrik Oldsberg <poldsberg@gmail.com>
2025-02-12 10:06:30 +01:00
Ben Lambert 8688bcc40d Merge pull request #28521 from yu-kkurii/optional-text-output-button
Hide text output button if only one text output is defined
2025-02-04 11:02:12 +01:00
Bogdan Nechyporenko 656f67b491 Reverted the validation in depenendencies in scaffolder
Signed-off-by: Bogdan Nechyporenko <bnechyporenko@bol.com>
2025-01-28 22:52:15 +01:00
Vladimir Kobzev 662ba8c55d Hide the text output button if only one text output is defined
Signed-off-by: Vladimir Kobzev <vkobzev@bol.com>
2025-01-16 14:54:04 +01:00
Vladimir Kobzev 2003fc2360 Add option to hide text output buttons
Signed-off-by: Vladimir Kobzev <vkobzev@bol.com>
2025-01-16 10:24:18 +01:00
Stephen Glass 3edf7e7352 Add output return type to makeFieldSchema
Signed-off-by: Stephen Glass <stephen@stephen.glass>
2025-01-15 14:54:48 -05:00
Tim Hansen 528e51e258 Fix attachTo
Signed-off-by: Tim Hansen <timbonicush@spotify.com>
2025-01-09 11:07:23 -07:00
Tim Hansen 6bb6a7c7c3 Add FormDecoratorBlueprint
Signed-off-by: Tim Hansen <timbonicush@spotify.com>
Co-authored-by: blam <ben@blam.sh>
2025-01-09 11:07:23 -07:00
Ben Lambert f9208c00fd Merge pull request #28367 from acierto/issue-28239
Fixed the issue #28239 (Bug Report: Field extension validation does not work when field is in dependencies in an array field)
2025-01-07 15:02:59 +01:00
Bogdan Nechyporenko 45b6d163f9 wip
Signed-off-by: Bogdan Nechyporenko <bnechyporenko@bol.com>
2025-01-05 12:36:31 +01:00
Bogdan Nechyporenko 91bb99ae22 Fixed the issue #28239 (Bug Report: Field extension validation does not work when field is in dependencies in an array field)
Signed-off-by: Bogdan Nechyporenko <bnechyporenko@bol.com>
2025-01-05 12:33:58 +01:00
Tim Hansen 37421bce02 Fix formFieldsApi resolution in useCustomFieldExtensions hook
Signed-off-by: Tim Hansen <timbonicush@spotify.com>
2024-12-20 08:39:03 -07:00
Ben Lambert 87ca8957c9 Merge pull request #27699 from kalleericson/template-card-meta-data
Feat: Additional test coverage and component structure for TemplateCard
2024-12-17 11:42:17 +01:00