Skip to content

Commit

Permalink
deps(ui): Upgrade RTL
Browse files Browse the repository at this point in the history
upgrades `@testing-library/react` from 14 -> 16.
upgrades `@testing-library/dom` from 9 -> 10

Notes:
- @testing-library/dom is now a peer dependency, have to install
- Support for react 19
- Upgrades aria-query to 5.3.0 testing-library/dom-testing-library#1241
  - changes getByRole('link') `a element now requires a set href attribute to have an implicit link role`
  • Loading branch information
scttcper committed Jun 5, 2024
1 parent be2219c commit 8c5056e
Show file tree
Hide file tree
Showing 4 changed files with 67 additions and 132 deletions.
5 changes: 3 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -180,9 +180,10 @@
"@sentry/jest-environment": "6.0.0",
"@sentry/profiling-node": "^8.0.0",
"@styled/typescript-styled-plugin": "^1.0.1",
"@testing-library/dom": "10.1.0",
"@testing-library/jest-dom": "6.4.5",
"@testing-library/react": "^14.2.1",
"@testing-library/user-event": "^14.5.2",
"@testing-library/react": "16.0.0",
"@testing-library/user-event": "14.5.2",
"@types/node": "^20.11.7",
"babel-gettext-extractor": "^4.1.3",
"babel-jest": "29.7.0",
Expand Down
2 changes: 1 addition & 1 deletion static/app/components/sidebar/index.spec.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -257,7 +257,7 @@ describe('Sidebar', function () {
const {unmount} = renderSidebar({organization});

// This will start timer to mark as seen
await userEvent.click(await screen.findByRole('link', {name: "What's new"}), {
await userEvent.click(await screen.findByTestId('sidebar-broadcasts'), {
delay: null,
});
expect(await screen.findByText("What's new in Sentry")).toBeInTheDocument();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,13 +21,13 @@ describe('SwitchOrganization', function () {
expect(screen.getByRole('list')).toBeInTheDocument();

expect(screen.getByText('Organization 1')).toBeInTheDocument();
expect(screen.getByRole('link', {name: 'org slug Organization 1'})).toHaveAttribute(
expect(screen.getByRole('link', {name: 'OS Organization 1'})).toHaveAttribute(
'href',
'/organizations/org-slug/issues/'
);

expect(screen.getByText('Organization 2')).toBeInTheDocument();
expect(screen.getByRole('link', {name: 'org2 Organization 2'})).toHaveAttribute(
expect(screen.getByRole('link', {name: 'O Organization 2'})).toHaveAttribute(
'href',
'/organizations/org2/issues/'
);
Expand Down Expand Up @@ -57,11 +57,11 @@ describe('SwitchOrganization', function () {

expect(screen.getByRole('list')).toBeInTheDocument();

const org1Link = screen.getByRole('link', {name: 'org1 Organization 1'});
const org1Link = screen.getByRole('link', {name: 'O Organization 1'});
expect(org1Link).toBeInTheDocument();
expect(org1Link).toHaveAttribute('href', '/organizations/org1/issues/');

const org2Link = screen.getByRole('link', {name: 'org2 Organization 2'});
const org2Link = screen.getByRole('link', {name: 'O Organization 2'});
expect(org2Link).toBeInTheDocument();
expect(org2Link).toHaveAttribute(
'href',
Expand Down Expand Up @@ -92,11 +92,11 @@ describe('SwitchOrganization', function () {

expect(screen.getByRole('list')).toBeInTheDocument();

const org1Link = screen.getByRole('link', {name: 'org1 Organization 1'});
const org1Link = screen.getByRole('link', {name: 'O Organization 1'});
expect(org1Link).toBeInTheDocument();
expect(org1Link).toHaveAttribute('href', '/organizations/org1/issues/');

const org2Link = screen.getByRole('link', {name: 'org2 Organization 2'});
const org2Link = screen.getByRole('link', {name: 'O Organization 2'});
expect(org2Link).toBeInTheDocument();
expect(org2Link).toHaveAttribute('href', '/organizations/org2/issues/');
jest.useRealTimers();
Expand Down Expand Up @@ -128,7 +128,7 @@ describe('SwitchOrganization', function () {

expect(screen.getByRole('list')).toBeInTheDocument();

const org1Link = screen.getByRole('link', {name: 'org1 Organization 1'});
const org1Link = screen.getByRole('link', {name: 'O Organization 1'});
expect(org1Link).toBeInTheDocument();
// Current hostname in the URL is expected to be org2.sentry.io, so we need to make use of sentryUrl to link to an
// organization that does not support customer domains.
Expand All @@ -137,7 +137,7 @@ describe('SwitchOrganization', function () {
'https://sentry.io/organizations/org1/issues/'
);

const org2Link = screen.getByRole('link', {name: 'org2 Organization 2'});
const org2Link = screen.getByRole('link', {name: 'O Organization 2'});
expect(org2Link).toBeInTheDocument();
expect(org2Link).toHaveAttribute(
'href',
Expand Down Expand Up @@ -180,11 +180,11 @@ describe('SwitchOrganization', function () {

expect(screen.getByRole('list')).toBeInTheDocument();

const org1Link = screen.getByRole('link', {name: 'org1 Organization 1'});
const org1Link = screen.getByRole('link', {name: 'O Organization 1'});
expect(org1Link).toBeInTheDocument();
expect(org1Link).toHaveAttribute('href', '/organizations/org1/issues/');

const org3Link = screen.getByRole('link', {name: 'org3 Organization 3'});
const org3Link = screen.getByRole('link', {name: 'O Organization 3'});
expect(org3Link).toBeInTheDocument();
expect(org3Link).toHaveAttribute(
'href',
Expand Down
Loading

0 comments on commit 8c5056e

Please sign in to comment.