Migrate high-complexity Enzyme tests to RTL (spaces + security)#254896
Draft
elena-shostak wants to merge 4 commits intoelastic:mainfrom
Draft
Migrate high-complexity Enzyme tests to RTL (spaces + security)#254896elena-shostak wants to merge 4 commits intoelastic:mainfrom
elena-shostak wants to merge 4 commits intoelastic:mainfrom
Conversation
- share_to_space_flyout_internal.test.tsx (32 tests): replace Enzyme mountWithIntl/findTestSubject with RTL render/screen/fireEvent, add pass-through mocks for EUI components and internal components to inspect props, use deferred promise pattern for async loading states - feature_table.test.tsx (32 tests): replace Enzyme with RTL, convert all assertions to DOM queries and RTL APIs, use DOM-based selectors for EuiIconTip type detection and EuiAccordion arrow checks - __fixtures__/index.ts: rewrite getDisplayedFeaturePrivileges from Enzyme ReactWrapper to HTMLElement with RTL-compatible DOM querying, handle EuiAccordion id placement, EuiButtonGroup data-test-subj patterns, and EuiCheckbox input-level test subject attributes Co-authored-by: Cursor <cursoragent@cursor.com>
Contributor
|
🤖 Jobs for this PR can be triggered through checkboxes. 🚧
ℹ️ To trigger the CI, please tick the checkbox below 👇
|
…ilege_space_form migration - Replace toBeInTheDocument() with toBeNull()/not.toBeNull() in feature_table.test.tsx (not available in this package's type env) - Fix EuiSelectable mock type from jest.MockedFunction to jest.Mock (EuiSelectable is a class component, not a function) - Migrate privilege_space_form.test.tsx from Enzyme to RTL to match the updated fixture signature (HTMLElement instead of ReactWrapper) Co-authored-by: Cursor <cursoragent@cursor.com>
Contributor
⏳ Build in-progress, with failures
Failed CI StepsHistory
|
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.
Summary
Migrates 3 high-complexity Enzyme test files to React Testing Library (RTL):
share_to_space_flyout_internal.test.tsx(32 tests): Replaces EnzymemountWithIntl/findTestSubjectwith RTLrender/screen/fireEvent, adds pass-through mocks for EUI and internal components to inspect props, uses deferred promise pattern for async loading state tests.feature_table.test.tsx(32 tests): Replaces Enzyme with RTL, converts all assertions to DOM queries and RTL APIs, uses DOM-based selectors forEuiIconTiptype detection andEuiAccordionarrow checks.__fixtures__/index.ts: RewritesgetDisplayedFeaturePrivilegesfrom EnzymeReactWrapperto acceptHTMLElementwith RTL-compatible DOM querying, handlesEuiAccordionid placement,EuiButtonGroupdata-test-subjpatterns, andEuiCheckboxinput-level test subject attributes.Total: 64 tests migrated, all passing.
Test plan
yarn test:jest x-pack/platform/plugins/shared/spaces/public/share_saved_objects_to_space/components/share_to_space_flyout_internal.test.tsx— 32/32 passyarn test:jest x-pack/platform/packages/private/security/ui_components/src/kibana_privilege_table/feature_table.test.tsx— 32/32 passRelated: #223148