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

MNT Apply changes requested from peer review #1058

Merged

Conversation

GuySartorelli
Copy link
Member

// in this case that provides a false negative result (confirmed by trying a timeout
// with queryByRole in the "Header should not contain a Tooltip for a broken element" test
// which causes that test to fail)
const tooltip = await screen.findByRole('tooltip', null, { onTimeout: () => {} });
Copy link
Member

Choose a reason for hiding this comment

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

Won't this wait for the default 5000 milliseconds rather 500 milliseconds? Means test suite is now way slower

Copy link
Member Author

Choose a reason for hiding this comment

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

This is the only combination of this test and the previous test that gave consistent results. If, for example, I tried the waitFor(() => null, { timeout: 500 }); and then check screen.queryByText('File') in the previous test, it said that element didn't exist. Which meant this test would actually always pass.

Copy link
Member

@emteknetnz emteknetnz May 8, 2023

Choose a reason for hiding this comment

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

The test is supposed to pass though because there isn't supposed to be a tooltip? i.e. It would fail the previous test if there was a tooltip in the DOM - meaning the test is useful for detecting regressions?

Not sure what what was wrong with the previous test? Happy to change it to fileByRole() though otherwise not happy with the 5000 millisecond delay on the test.

Copy link
Member

Choose a reason for hiding this comment

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

and then check screen.queryByText('File') in the previous test

Oh - previous testing meaning a test where there is supposed to be a tooltip? Meaning the way the test was meant it didn't detect tooltips when they were supposed to be there?

Copy link
Member Author

Choose a reason for hiding this comment

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

Yup. Sorry, I should have said "the test above"

Copy link
Member

Choose a reason for hiding this comment

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

The updated code in the PR also doesn't seem to work with the test above

This should work:

await screen.findByRole('tooltip', {}, { timeout: 500, onTimeout: () => null });

Copy link
Member Author

Choose a reason for hiding this comment

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

Done

@emteknetnz emteknetnz merged commit 98daefd into silverstripe:5.0 May 9, 2023
@emteknetnz emteknetnz deleted the pulls/5.0/post-pr-pr branch May 9, 2023 22:07
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants