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

Upgrade package @testing-library/user-event from 12.8.3 to 13.5.0 #2468 #2471

Closed
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
36 commits
Select commit Hold shift + click to select a range
65a766e
Updated branching strategy
DangaRanga May 23, 2021
0a6d4d6
Removed duplicate entry
DangaRanga May 23, 2021
e16a3ad
Updated contributing.md
DangaRanga May 23, 2021
653345e
Added extra markdown styling to contribute.md
DangaRanga May 23, 2021
13180c2
Merge pull request #54 from DangaRanga/master
DangaRanga May 23, 2021
07f4465
Bump dns-packet from 1.3.1 to 1.3.4
dependabot[bot] May 30, 2021
f9d7eae
Merge pull request #60 from PalisadoesFoundation/dependabot/npm_and_y…
palisadoes May 30, 2021
1a57176
Update pull_request_template.md
palisadoes May 30, 2021
c4580fa
disabled CodeQL cron jobs and push actions (#72)
akshatgarg12 Jun 6, 2021
f71bc11
Merge Develop into Main (#1099)
noman2002 Nov 30, 2023
1fd4105
[#1123] Changes position and text of "All Organizations" button (#1124)
adi790uu Dec 10, 2023
9ff2924
Revert "[#1123] Changes position and text of "All Organizations" butt…
noman2002 Dec 12, 2023
a320d35
Added Base branch check to main (#1515)
palisadoes Jan 29, 2024
42633e2
Pre-GSoC 2024 - Stable (#1934)
palisadoes Apr 27, 2024
f6c6f03
Update README.md
palisadoes Apr 27, 2024
423b990
Merge develop - 20240504 (#1956)
palisadoes May 4, 2024
7befb35
Merge develop - 20240504 (#1957)
palisadoes May 4, 2024
a4d2a07
Bump follow-redirects from 1.15.5 to 1.15.6 (#1960)
dependabot[bot] May 5, 2024
9b5d158
Bump tar from 6.1.15 to 6.2.1 (#1959)
dependabot[bot] May 5, 2024
389ac01
Bump tj-actions/changed-files from 40 to 41 in /.github/workflows (#1…
dependabot[bot] May 5, 2024
d3d681f
Bump express from 4.18.2 to 4.19.2 (#1962)
dependabot[bot] May 5, 2024
7091c76
Bump ejs from 3.1.9 to 3.1.10 (#1963)
dependabot[bot] May 5, 2024
bf9852d
coderabbit yaml file (#1991)
pranshugupta54 May 19, 2024
f661cc9
Updating the main branch to the latest develop code (#2020)
palisadoes Jun 2, 2024
5010350
Latest Develop 20240724 (#2127)
palisadoes Jul 27, 2024
b991d54
Update README.md
palisadoes Aug 11, 2024
f358420
Update CONTRIBUTING.md
palisadoes Aug 11, 2024
15c8753
Update CONTRIBUTING.md
palisadoes Aug 11, 2024
30c1d18
Merge with Develop 20240924 (#2306)
palisadoes Sep 29, 2024
6fbba6e
Bump tj-actions/changed-files from 40 to 41 in /.github/workflows (#2…
dependabot[bot] Sep 29, 2024
e828b78
Bump rollup from 4.21.3 to 4.22.5 (#2308)
dependabot[bot] Sep 29, 2024
d01b5d2
Merge with Develop 2024-1-14 (#2432)
palisadoes Nov 14, 2024
1fe19c1
Update dependabot.yaml
palisadoes Nov 16, 2024
9b9321d
Upgrade package @testing-library/user-event from 12.8.3 to 13.5.0
mohamedrehan1 Nov 24, 2024
d62dc3d
Merge branch 'develop-postgres' of https://github.com/PalisadoesFound…
mohamedrehan1 Nov 25, 2024
0dceb82
Upgrade package @testing-library/user-event from 12.8.3 to 13.5.0
mohamedrehan1 Nov 25, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 6 additions & 2 deletions .github/pull_request_template.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@

<!--

Check warning on line 1 in .github/pull_request_template.md

View workflow job for this annotation

GitHub Actions / Performs linting, formatting, type-checking, checking for different source and target branch

File ignored by default.
This section can be deleted after reading.

We employ the following branching strategy to simplify the development process and to ensure that only stable code is pushed to the `master` branch:
Expand All @@ -10,7 +9,6 @@
NOTE!!!

ONLY SUBMIT PRS AGAINST OUR `DEVELOP` BRANCH. THE DEFAULT IS `MAIN`, SO YOU WILL HAVE TO MODIFY THIS BEFORE SUBMITTING YOUR PR FOR REVIEW. PRS MADE AGAINST `MAIN` WILL BE CLOSED.

-->

<!--
Expand All @@ -29,6 +27,12 @@

<!--Add snapshots or videos wherever possible.-->

<!--Yes or No. Note: Add unit tests or automation tests for your code.-->

**Snapshots/Videos:**

<!--Add snapshots or videos wherever possible.-->

**If relevant, did you update the documentation?**

<!--Add link to Talawa-Docs.-->
Expand Down
2 changes: 0 additions & 2 deletions .github/workflows/pull-request.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
##############################################################################

Check warning on line 1 in .github/workflows/pull-request.yml

View workflow job for this annotation

GitHub Actions / Performs linting, formatting, type-checking, checking for different source and target branch

File ignored by default.
##############################################################################
#
# NOTE!
Expand Down Expand Up @@ -217,7 +217,6 @@
npx tsc --noEmit "$file"
fi
done

- name: Present and Upload coverage to Codecov as ${{env.CODECOV_UNIQUE_NAME}}
uses: codecov/codecov-action@v4
with:
Expand Down Expand Up @@ -247,7 +246,6 @@

- name: resolve dependency
run: npm install -g @graphql-inspector/cli

- name: Clone API Repository
run: |
# Retrieve the complete branch name directly from the GitHub context
Expand Down
5 changes: 0 additions & 5 deletions .idea/.gitignore

This file was deleted.

6 changes: 0 additions & 6 deletions .idea/inspectionProfiles/Project_Default.xml

This file was deleted.

8 changes: 0 additions & 8 deletions .idea/modules.xml

This file was deleted.

12 changes: 0 additions & 12 deletions .idea/talawa-admin.iml

This file was deleted.

6 changes: 0 additions & 6 deletions .idea/vcs.xml

This file was deleted.

9 changes: 5 additions & 4 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
{

Check failure on line 1 in package.json

View workflow job for this annotation

GitHub Actions / Performs linting, formatting, type-checking, checking for different source and target branch

Expected an assignment or function call and instead saw an expression
"name": "talawa-admin",
"version": "3.0.0",
"private": true,
Expand Down Expand Up @@ -113,7 +113,7 @@
"@babel/preset-typescript": "^7.26.0",
"@testing-library/jest-dom": "^6.5.0",
"@testing-library/react": "^16.0.1",
"@testing-library/user-event": "^12.1.10",
"@testing-library/user-event": "^13.5.0",
"@types/inquirer": "^9.0.7",
"@types/jest": "^26.0.24",
"@types/js-cookie": "^3.0.6",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -61,10 +61,10 @@ const renderActionItemCategories = (
describe('Testing Organisation Action Item Categories', () => {
it('should render the Action Item Categories Screen', async () => {
renderActionItemCategories(link1, 'orgId');
await waitFor(() => {
await waitFor(async () => {
expect(screen.getByTestId('searchByName')).toBeInTheDocument();
expect(screen.getByText('Category 1')).toBeInTheDocument();
expect(screen.getByText('Category 2')).toBeInTheDocument();
expect(await screen.findByText('Category 1')).toBeInTheDocument();
expect(await screen.findByText('Category 2')).toBeInTheDocument();
});
});

Expand Down
6 changes: 4 additions & 2 deletions src/components/OrganizationScreen/OrganizationScreen.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -81,14 +81,16 @@ describe('Testing OrganizationScreen', () => {
fireEvent.click(closeButton);

// Check for contract class after closing
expect(screen.getByTestId('mainpageright')).toHaveClass('_expand_ccl5z_8');
expect(screen.getByTestId('mainpageright')).toHaveClass(
'_pageContainer_ccl5z_1 _expand_ccl5z_15',
);

const openButton = screen.getByTestId('openMenu');
fireEvent.click(openButton);

// Check for expand class after opening
expect(screen.getByTestId('mainpageright')).toHaveClass(
'_contract_ccl5z_61',
'_pageContainer_ccl5z_1 _contract_ccl5z_121',
);
});

Expand Down
11 changes: 5 additions & 6 deletions src/components/Pagination/Pagination.test.tsx
Original file line number Diff line number Diff line change
@@ -1,11 +1,10 @@
import React, { act } from 'react';
import { render, screen } from '@testing-library/react';
import { fireEvent, render, screen } from '@testing-library/react';
import { Provider } from 'react-redux';
import { BrowserRouter } from 'react-router-dom';
import { createTheme, ThemeProvider } from '@mui/material/styles';
import Pagination from './Pagination';
import { store } from 'state/store';
import userEvent from '@testing-library/user-event';

describe('Testing Pagination component', () => {
const props = {
Expand All @@ -26,8 +25,8 @@ describe('Testing Pagination component', () => {
</BrowserRouter>,
);
await act(async () => {
userEvent.click(screen.getByTestId(/nextPage/i));
userEvent.click(screen.getByTestId(/previousPage/i));
fireEvent.click(screen.getByTestId(/nextPage/i));
fireEvent.click(screen.getByTestId(/previousPage/i));
Comment on lines +28 to +29
Copy link

Choose a reason for hiding this comment

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

🛠️ Refactor suggestion

Consider using userEvent instead of fireEvent

The change from userEvent to fireEvent seems to contradict the PR's objective of upgrading @testing-library/user-event. userEvent is recommended over fireEvent as it more accurately simulates real user interactions by:

  • Firing multiple events that occur in a real browser
  • Better replicating actual user behavior
  • Providing better accessibility testing

Consider this implementation instead:

- fireEvent.click(screen.getByTestId(/nextPage/i));
- fireEvent.click(screen.getByTestId(/previousPage/i));
+ const user = userEvent.setup()
+ await user.click(screen.getByTestId(/nextPage/i));
+ await user.click(screen.getByTestId(/previousPage/i));

Note: With @testing-library/user-event v13+, we need to use the new setup() API and await the interactions.

Committable suggestion skipped: line range outside the PR's diff.

});
});
});
Expand Down Expand Up @@ -58,7 +57,7 @@ test('Component should be rendered properly', async () => {
);

await act(async () => {
userEvent.click(screen.getByTestId(/nextPage/i));
userEvent.click(screen.getByTestId(/previousPage/i));
fireEvent.click(screen.getByTestId(/nextPage/i));
fireEvent.click(screen.getByTestId(/previousPage/i));
});
});
Loading
Loading