Skip to content

bump @testing-library#78270

Merged
Dosant merged 4 commits intoelastic:masterfrom
Dosant:tl/bump
Sep 24, 2020
Merged

bump @testing-library#78270
Dosant merged 4 commits intoelastic:masterfrom
Dosant:tl/bump

Conversation

@Dosant
Copy link
Copy Markdown
Contributor

@Dosant Dosant commented Sep 23, 2020

Summary

Bumps @testing-library/* libs

Notable changes:

Note:

Copy link
Copy Markdown
Contributor Author

@Dosant Dosant left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Notes below


// instead of default 'data-testid', use kibana's 'data-test-subj'
configure({ testIdAttribute: 'data-test-subj' });
configure({ testIdAttribute: 'data-test-subj', asyncUtilTimeout: 4500 });
Copy link
Copy Markdown
Contributor Author

@Dosant Dosant Sep 23, 2020

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

before 4500 was a default. now it is 1000. Forcing 4500 back as some tests were failing


describe('useFetcher', () => {
describe('when resolving after 500ms', () => {
let hook: ReturnType<typeof renderHook>;
Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Something around types of renderHook has changed that it is now more strict and doesn't allow use hook with this inferred type

return <KibanaContextProvider services={services}>{children}</KibanaContextProvider>;
};
return renderHook(
(props) =>
Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Otherwise it says that props.options and others are missing. I didn't find a way how to nicely infer it from useMetricsExplorerData, so just copied types

.find(`[data-test-subj="description-action"] [data-test-subj="property-actions-quote"]`)
.first()
.simulate('click');
wrapper
Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Internal implementation of waitFor significantly changed between versions. Not sure why exactly, but I had to move this check inside waitFor to make test pass


// Act
// Assert
expect(getByLabelText('Index pattern')).toBeInTheDocument();
Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Here it threw error that Index pattern label is labelling span, which is incorrect.
I fixed the test, but this component should be reviewed from labels/a11y perspective

This was the error here:

TestingLibraryElementError: Found a label with the text of: Index pattern, however the element associated with this label (<span />) is non-labellable [https://html.spec.whatwg.org/multipage/forms.html#category-label]. If you really need to label a <span />, you can use aria-label or aria-labelledby instead.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for flagging this up @Dosant . Yes we have a <span> inside an <EuiFormRow> on this page. Do you know what would be better from the a11y perspective? Should we replace the <span> with EuiText? This form row is displaying a non-editable piece of text (here 'gallery-*' is the span content):

image

@Dosant Dosant added Feature:Unit Testing release_note:skip Skip the PR/issue when compiling release notes v7.10.0 v8.0.0 labels Sep 23, 2020
// check that all factories are displayed to pick
expect(screen.getAllByTestId(new RegExp(TEST_SUBJ_ACTION_FACTORY_ITEM))).toHaveLength(2);

expect(screen.getByText(/Go to URL/i)).toBeDisabled();
Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There is button with a lot of nested content inside. It stopped returning a button, but returns a nested p instead.

target: { value: URL },
});

[createHeading, createButton] = screen.getAllByText(/Create Drilldown/i);
Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

createButton is a button with nested content inside. It stopped returning a button, but returns a nested p instead.

@Dosant Dosant marked this pull request as ready for review September 23, 2020 13:47
@Dosant Dosant requested a review from a team September 23, 2020 13:47
@Dosant Dosant requested review from a team as code owners September 23, 2020 13:47
Copy link
Copy Markdown
Contributor

@mistic mistic left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Changes on files under operations team code owners LGTM

@botelastic botelastic bot added the Team:APM - DEPRECATED Use Team:obs-ux-infra_services. label Sep 23, 2020
@elasticmachine
Copy link
Copy Markdown
Contributor

Pinging @elastic/apm-ui (Team:apm)

Copy link
Copy Markdown
Member

@weltenwort weltenwort left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

infra plugin changes LGTM

Copy link
Copy Markdown
Contributor

@sorenlouv sorenlouv left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for taking the time @Dosant !

Copy link
Copy Markdown
Contributor

@patrykkopycinski patrykkopycinski left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

😍 Thank you @Dosant (SIEM/Endpoint)

Copy link
Copy Markdown
Contributor

@peteharverson peteharverson left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Transforms text edit LGTM.

Do you know what we should be using instead of the <span>?


// Act
// Assert
expect(getByLabelText('Index pattern')).toBeInTheDocument();
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for flagging this up @Dosant . Yes we have a <span> inside an <EuiFormRow> on this page. Do you know what would be better from the a11y perspective? Should we replace the <span> with EuiText? This form row is displaying a non-editable piece of text (here 'gallery-*' is the span content):

image

Copy link
Copy Markdown
Contributor

@streamich streamich left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@Dosant Dosant merged commit 89e1f08 into elastic:master Sep 24, 2020
Dosant added a commit to Dosant/kibana that referenced this pull request Sep 24, 2020
Dosant added a commit that referenced this pull request Sep 24, 2020
@kibanamachine
Copy link
Copy Markdown
Contributor

💚 Build Succeeded

Metrics [docs]

async chunks size

id value diff baseline
enterpriseSearch 632.2KB +62.0B 632.1KB

page load bundle size

id value diff baseline
upgradeAssistant 64.6KB +31.0B 64.5KB

History

To update your PR or re-run it, just comment with:
@elasticmachine merge upstream

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Feature:Unit Testing release_note:skip Skip the PR/issue when compiling release notes Team:APM - DEPRECATED Use Team:obs-ux-infra_services. v7.10.0 v8.0.0

Projects

None yet

Development

Successfully merging this pull request may close these issues.

9 participants