Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

bump @testing-library #78270

Merged
merged 4 commits into from
Sep 24, 2020
Merged

bump @testing-library #78270

merged 4 commits into from
Sep 24, 2020

Conversation

Dosant
Copy link
Contributor

@Dosant Dosant commented Sep 23, 2020

Summary

Bumps @testing-library/* libs

Notable changes:

Note:

Copy link
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

@@ -29,4 +29,4 @@ import '@testing-library/jest-dom';
import { configure } from '@testing-library/react/pure';

// 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
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


// Wrap the hook with a provider so it can useApmPluginContext
const wrapper = MockApmPluginContextWrapper;

describe('useFetcher', () => {
describe('when resolving after 500ms', () => {
let hook: ReturnType<typeof renderHook>;
Copy link
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

@@ -31,7 +35,16 @@ const renderUseMetricsExplorerDataHook = () => {
return <KibanaContextProvider services={services}>{children}</KibanaContextProvider>;
};
return renderHook(
(props) =>
Copy link
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
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

@@ -76,7 +76,8 @@ describe('Transform: <DefinePivotForm />', () => {

// Act
// Assert
expect(getByLabelText('Index pattern')).toBeInTheDocument();
Copy link
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
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
@@ -80,7 +80,7 @@ test('If not enough license, button is disabled', () => {
// 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
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.

@@ -77,7 +78,8 @@ test('Allows to manage drilldowns', async () => {
target: { value: URL },
});

[createHeading, createButton] = screen.getAllByText(/Create Drilldown/i);
Copy link
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 review from a team as code owners September 23, 2020 13:47
Copy link
Member

@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 All issues that need APM UI Team support label Sep 23, 2020
@elasticmachine
Copy link
Contributor

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

Copy link
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
Member

@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
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
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>?

@@ -76,7 +76,8 @@ describe('Transform: <DefinePivotForm />', () => {

// Act
// Assert
expect(getByLabelText('Index pattern')).toBeInTheDocument();
Copy link
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
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
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 All issues that need APM UI Team support v7.10.0 v8.0.0
Projects
None yet
Development

Successfully merging this pull request may close these issues.

9 participants