From b7469dda6b193fb4226f325194775271ebab2f51 Mon Sep 17 00:00:00 2001 From: stanislavh Date: Tue, 7 May 2024 09:27:59 +0200 Subject: [PATCH] SONAR-22618 Get rid of aliases to sonar-wb in SR --- .../__tests__/AdminContainer-test.tsx | 2 +- .../__tests__/ComponentContainer-test.tsx | 2 +- .../__tests__/FormattingHelp-test.tsx | 2 +- .../__tests__/GlobalFooter-test.tsx | 2 +- .../__tests__/KeyboardShortcutsModal-test.tsx | 2 +- .../app/components/__tests__/Landing-test.tsx | 2 +- .../__tests__/MigrationContainer-test.tsx | 2 +- .../components/__tests__/PageTracker-test.tsx | 2 +- .../__tests__/PluginRiskConsent-test.tsx | 2 +- .../__tests__/ProjectAdminContainer-test.tsx | 2 +- .../__tests__/ResetPassword-test.tsx | 2 +- .../__tests__/StartupModal-test.tsx | 2 +- .../__tests__/UpdateNotification-it.tsx | 2 +- .../__tests__/GlobalSearch-it.tsx | 2 +- .../IndexationContextProvider-test.tsx | 2 +- .../__tests__/IndexationNotification-test.tsx | 2 +- .../IndexationNotificationRenderer-test.tsx | 2 +- .../PageUnavailableDueToIndexation-test.tsx | 2 +- .../LanguagesContextProvider-test.tsx | 2 +- .../__tests__/MetricsContextProvider-test.tsx | 2 +- .../__tests__/PromotionNotification-test.tsx | 2 +- .../js/apps/account/__tests__/Account-it.tsx | 2 +- .../components/__tests__/AuditApp-it.tsx | 2 +- .../__tests__/BackgroundTasks-it.tsx | 10 +- .../__tests__/ChangeAdminPasswordApp-it.tsx | 2 +- .../main/js/apps/code/__tests__/Code-it.ts | 2 +- .../coding-rules/__tests__/CustomRule-it.ts | 2 +- .../main/js/apps/coding-rules/utils-tests.tsx | 6 +- .../__tests__/ComponentMeasures-it.tsx | 2 +- .../create/project/__tests__/Azure-it.tsx | 2 +- .../create/project/__tests__/Bitbucket-it.tsx | 2 +- .../project/__tests__/BitbucketCloud-it.tsx | 2 +- .../create/project/__tests__/GitHub-it.tsx | 2 +- .../create/project/__tests__/GitLab-it.tsx | 2 +- .../create/project/__tests__/Manual-it.tsx | 2 +- .../__tests__/ManualProjectCreate-test.tsx | 2 +- .../__tests__/MonorepoProjectCreate-it.tsx | 2 +- .../js/apps/groups/__tests__/GroupsApp-it.tsx | 2 +- .../js/apps/issues/__tests__/IssueApp-it.tsx | 2 +- .../apps/issues/__tests__/IssueHeader-it.tsx | 2 +- .../__tests__/IssuesSourceViewer-it.tsx | 2 +- .../__tests__/AssigneeSelect-test.tsx | 2 +- .../IssueSourceViewerHeader-test.tsx | 2 +- .../__tests__/SnippetViewer-test.tsx | 2 +- .../__tests__/SubnavigationIssues-it.tsx | 2 +- .../__tests__/SimpleListStyleFacet-test.tsx | 2 +- .../src/main/js/apps/issues/test-utils.tsx | 2 +- .../__tests__/MarketplaceApp-it.tsx | 2 +- .../branches/__tests__/BranchOverview-it.tsx | 2 +- .../QualityGatePanelSection-test.tsx | 2 +- .../js/apps/overview/branches/test-utils.ts | 2 +- .../__tests__/BranchQualityGate-it.tsx | 2 +- .../__tests__/PullRequestOverview-it.tsx | 2 +- .../__tests__/PermissionTemplatesApp-it.tsx | 2 +- .../main/js/apps/permissions/test-utils.ts | 2 +- .../__tests__/ProjectActivityApp-it.tsx | 2 +- .../__tests__/ProjectBranchesApp-it.tsx | 2 +- .../__tests__/ProjectDeletionApp-it.tsx | 2 +- .../__tests__/ProjectDumpApp-it.tsx | 2 +- .../__tests__/ProjectInformationApp-it.tsx | 2 +- .../__tests__/RegulatoryReport-it.tsx | 2 +- .../projectKey/__tests__/ProjectKeyApp-it.tsx | 2 +- .../__tests__/ProjectLinksApp-it.tsx | 2 +- .../ProjectNewCodeDefinitionApp-it.tsx | 2 +- .../__tests__/ProjectQualityGateApp-it.tsx | 2 +- .../projectQualityProfilesApp-it.tsx | 2 +- .../components/__tests__/AllProjects-test.tsx | 2 +- .../__tests__/CreateApplication-test.tsx | 2 +- .../components/__tests__/PageHeader-test.tsx | 2 +- .../__tests__/ProjectManagementApp-it.tsx | 2 +- .../components/__tests__/QualityGate-it.tsx | 2 +- .../__tests__/QualityProfileApp-it.tsx | 2 +- .../__tests__/QualityProfilesApp-it.tsx | 2 +- .../__tests__/ChangelogContainer-it.tsx | 2 +- .../__tests__/SecurityHotspotsApp-it.tsx | 2 +- .../__tests__/useStickyDetection-test.tsx | 2 +- .../components/__tests__/Login-it.tsx | 2 +- .../__tests__/AnalysisScope-test.tsx | 2 +- .../components/__tests__/Definition-it.tsx | 2 +- .../components/__tests__/Languages-it.tsx | 2 +- .../__tests__/NewCodeDefinition-it.tsx | 2 +- .../components/__tests__/SettingsApp-it.tsx | 2 +- .../AlmBindingDefinitionForm-test.tsx | 2 +- .../__tests__/AlmIntegration-it.tsx | 2 +- .../__tests__/Authentication-Bitbucket-it.tsx | 2 +- .../__tests__/Authentication-Github-it.tsx | 2 +- .../__tests__/Authentication-Gitlab-it.tsx | 2 +- .../__tests__/Authentication-Scim-it.tsx | 2 +- .../__tests__/Authentication-it.tsx | 2 +- .../__tests__/PRDecorationBinding-it.tsx | 2 +- .../encryption/__tests__/EncryptionApp-it.tsx | 2 +- .../components/__tests__/SystemApp-it.tsx | 2 +- .../__tests__/TutorialsApp-test.tsx | 2 +- .../js/apps/users/__tests__/UsersApp-it.tsx | 2 +- .../web-api-v2/__tests__/WebApiApp-it.tsx | 2 +- .../js/apps/web-api/__tests__/WebApi-it.tsx | 2 +- .../components/__tests__/Actions-test.tsx | 2 +- .../webhooks/components/__tests__/App-it.tsx | 2 +- .../__tests__/SourceViewer-it.tsx | 2 +- .../__tests__/ActivityGraph-it.tsx | 7 +- .../__tests__/EventInner-it.tsx | 2 +- .../controls/__tests__/SelectList-test.tsx | 2 +- .../components/issue/__tests__/Issue-it.tsx | 2 +- .../__tests__/NCDAutoUpdateMessage-test.tsx | 2 +- .../__tests__/TutorialSelection-it.tsx | 2 +- .../GithubCFamilyExampleRepositories-test.tsx | 2 +- .../jenkins/__tests__/JenkinsTutorial-it.tsx | 2 +- .../other/__tests__/OtherTutorial-it.tsx | 2 +- .../js/components/tutorials/test-utils.ts | 2 +- .../upgrade/__tests__/SystemUpgrade-test.tsx | 2 +- .../workspace/__tests__/Workspace-test.tsx | 2 +- .../a11y/__tests__/A11yLinks-test.tsx | 2 +- .../__tests__/DocHelpTooltip-test.tsx | 2 +- .../helpers/__tests__/testSelector-test.tsx | 280 ++++++++++++++++++ .../js/sonar-aligned/helpers/mocks/branch.ts | 31 ++ .../helpers/testSelector.ts | 0 116 files changed, 435 insertions(+), 119 deletions(-) create mode 100644 server/sonar-web/src/main/js/sonar-aligned/helpers/__tests__/testSelector-test.tsx create mode 100644 server/sonar-web/src/main/js/sonar-aligned/helpers/mocks/branch.ts rename server/sonar-web/src/main/js/{ => sonar-aligned}/helpers/testSelector.ts (100%) diff --git a/server/sonar-web/src/main/js/app/components/__tests__/AdminContainer-test.tsx b/server/sonar-web/src/main/js/app/components/__tests__/AdminContainer-test.tsx index 97efd22ca4b..eca5c6fba67 100644 --- a/server/sonar-web/src/main/js/app/components/__tests__/AdminContainer-test.tsx +++ b/server/sonar-web/src/main/js/app/components/__tests__/AdminContainer-test.tsx @@ -20,10 +20,10 @@ import userEvent from '@testing-library/user-event'; import * as React from 'react'; import { Route, useOutletContext } from 'react-router-dom'; +import { byLabelText, byRole, byText } from '~sonar-aligned/helpers/testSelector'; import { getSystemStatus, waitSystemUPStatus } from '../../../api/system'; import { mockAppState } from '../../../helpers/testMocks'; import { renderAppRoutes } from '../../../helpers/testReactTestingUtils'; -import { byLabelText, byRole, byText } from '../../../helpers/testSelector'; import { AdminPagesContext } from '../../../types/admin'; import { AdminContainer, AdminContainerProps } from '../AdminContainer'; import AdminContext from '../AdminContext'; diff --git a/server/sonar-web/src/main/js/app/components/__tests__/ComponentContainer-test.tsx b/server/sonar-web/src/main/js/app/components/__tests__/ComponentContainer-test.tsx index afd433e03e1..8a87dad61c3 100644 --- a/server/sonar-web/src/main/js/app/components/__tests__/ComponentContainer-test.tsx +++ b/server/sonar-web/src/main/js/app/components/__tests__/ComponentContainer-test.tsx @@ -22,6 +22,7 @@ import userEvent from '@testing-library/user-event'; import React, { useContext } from 'react'; import { Route } from 'react-router-dom'; import * as withRouter from '~sonar-aligned/components/hoc/withRouter'; +import { byRole, byText } from '~sonar-aligned/helpers/testSelector'; import { ComponentQualifier, Visibility } from '~sonar-aligned/types/component'; import { validateProjectAlmBinding } from '../../../api/alm-settings'; import { getTasksForComponent } from '../../../api/ce'; @@ -33,7 +34,6 @@ import { mockComponent } from '../../../helpers/mocks/component'; import { mockTask } from '../../../helpers/mocks/tasks'; import { HttpStatus } from '../../../helpers/request'; import { renderAppRoutes, renderComponent } from '../../../helpers/testReactTestingUtils'; -import { byRole, byText } from '../../../helpers/testSelector'; import { getProjectUrl, getPullRequestUrl } from '../../../helpers/urls'; import { TaskStatuses, TaskTypes } from '../../../types/tasks'; import handleRequiredAuthorization from '../../utils/handleRequiredAuthorization'; diff --git a/server/sonar-web/src/main/js/app/components/__tests__/FormattingHelp-test.tsx b/server/sonar-web/src/main/js/app/components/__tests__/FormattingHelp-test.tsx index 7fbfd0cb023..a12c4435ef7 100644 --- a/server/sonar-web/src/main/js/app/components/__tests__/FormattingHelp-test.tsx +++ b/server/sonar-web/src/main/js/app/components/__tests__/FormattingHelp-test.tsx @@ -18,8 +18,8 @@ * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ import * as React from 'react'; +import { byRole } from '~sonar-aligned/helpers/testSelector'; import { renderComponent } from '../../../helpers/testReactTestingUtils'; -import { byRole } from '../../../helpers/testSelector'; import FormattingHelp from '../FormattingHelp'; it('should render correctly', () => { diff --git a/server/sonar-web/src/main/js/app/components/__tests__/GlobalFooter-test.tsx b/server/sonar-web/src/main/js/app/components/__tests__/GlobalFooter-test.tsx index ce965fcd3cd..f6dd26a1e96 100644 --- a/server/sonar-web/src/main/js/app/components/__tests__/GlobalFooter-test.tsx +++ b/server/sonar-web/src/main/js/app/components/__tests__/GlobalFooter-test.tsx @@ -19,10 +19,10 @@ */ import { addDays, subDays } from 'date-fns'; import * as React from 'react'; +import { byRole, byText } from '~sonar-aligned/helpers/testSelector'; import SystemServiceMock from '../../../api/mocks/SystemServiceMock'; import { mockAppState } from '../../../helpers/testMocks'; import { renderComponent } from '../../../helpers/testReactTestingUtils'; -import { byRole, byText } from '../../../helpers/testSelector'; import { AppState } from '../../../types/appstate'; import { EditionKey } from '../../../types/editions'; import { FCProps } from '../../../types/misc'; diff --git a/server/sonar-web/src/main/js/app/components/__tests__/KeyboardShortcutsModal-test.tsx b/server/sonar-web/src/main/js/app/components/__tests__/KeyboardShortcutsModal-test.tsx index 56b562d92c5..a70df884cf8 100644 --- a/server/sonar-web/src/main/js/app/components/__tests__/KeyboardShortcutsModal-test.tsx +++ b/server/sonar-web/src/main/js/app/components/__tests__/KeyboardShortcutsModal-test.tsx @@ -19,8 +19,8 @@ */ import userEvent from '@testing-library/user-event'; import React from 'react'; +import { byRole } from '~sonar-aligned/helpers/testSelector'; import { renderComponent } from '../../../helpers/testReactTestingUtils'; -import { byRole } from '../../../helpers/testSelector'; import KeyboardShortcutsModal from '../KeyboardShortcutsModal'; it('should render correctly', async () => { diff --git a/server/sonar-web/src/main/js/app/components/__tests__/Landing-test.tsx b/server/sonar-web/src/main/js/app/components/__tests__/Landing-test.tsx index 3434950b1d5..63c6350abc8 100644 --- a/server/sonar-web/src/main/js/app/components/__tests__/Landing-test.tsx +++ b/server/sonar-web/src/main/js/app/components/__tests__/Landing-test.tsx @@ -18,9 +18,9 @@ * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ import * as React from 'react'; +import { byText } from '~sonar-aligned/helpers/testSelector'; import { mockCurrentUser, mockLoggedInUser } from '../../../helpers/testMocks'; import { renderApp } from '../../../helpers/testReactTestingUtils'; -import { byText } from '../../../helpers/testSelector'; import { CurrentUser } from '../../../types/users'; import { Landing, LandingProps } from '../Landing'; diff --git a/server/sonar-web/src/main/js/app/components/__tests__/MigrationContainer-test.tsx b/server/sonar-web/src/main/js/app/components/__tests__/MigrationContainer-test.tsx index 60ce5eb16fc..d9266f10e24 100644 --- a/server/sonar-web/src/main/js/app/components/__tests__/MigrationContainer-test.tsx +++ b/server/sonar-web/src/main/js/app/components/__tests__/MigrationContainer-test.tsx @@ -19,9 +19,9 @@ */ import * as React from 'react'; import { Route } from 'react-router-dom'; +import { byText } from '~sonar-aligned/helpers/testSelector'; import { getSystemStatus } from '../../../helpers/system'; import { renderAppRoutes } from '../../../helpers/testReactTestingUtils'; -import { byText } from '../../../helpers/testSelector'; import MigrationContainer from '../MigrationContainer'; jest.mock('../../../helpers/system', () => ({ diff --git a/server/sonar-web/src/main/js/app/components/__tests__/PageTracker-test.tsx b/server/sonar-web/src/main/js/app/components/__tests__/PageTracker-test.tsx index 38ce0912971..4c5325159c2 100644 --- a/server/sonar-web/src/main/js/app/components/__tests__/PageTracker-test.tsx +++ b/server/sonar-web/src/main/js/app/components/__tests__/PageTracker-test.tsx @@ -20,11 +20,11 @@ import userEvent from '@testing-library/user-event'; import * as React from 'react'; import { Link } from 'react-router-dom'; +import { byRole } from '~sonar-aligned/helpers/testSelector'; import { installScript } from '../../../helpers/extensions'; import { getWebAnalyticsPageHandlerFromCache } from '../../../helpers/extensionsHandler'; import { mockAppState } from '../../../helpers/testMocks'; import { renderComponent } from '../../../helpers/testReactTestingUtils'; -import { byRole } from '../../../helpers/testSelector'; import PageTracker from '../PageTracker'; jest.mock('../../../helpers/extensions', () => ({ diff --git a/server/sonar-web/src/main/js/app/components/__tests__/PluginRiskConsent-test.tsx b/server/sonar-web/src/main/js/app/components/__tests__/PluginRiskConsent-test.tsx index 546c3e16ddc..dcf81c8b8d8 100644 --- a/server/sonar-web/src/main/js/app/components/__tests__/PluginRiskConsent-test.tsx +++ b/server/sonar-web/src/main/js/app/components/__tests__/PluginRiskConsent-test.tsx @@ -19,10 +19,10 @@ */ import userEvent from '@testing-library/user-event'; import * as React from 'react'; +import { byRole } from '~sonar-aligned/helpers/testSelector'; import { setSimpleSettingValue } from '../../../api/settings'; import { mockLoggedInUser, mockRouter } from '../../../helpers/testMocks'; import { renderComponent } from '../../../helpers/testReactTestingUtils'; -import { byRole } from '../../../helpers/testSelector'; import { PluginRiskConsent, PluginRiskConsentProps } from '../PluginRiskConsent'; jest.mock('../../../api/settings', () => ({ diff --git a/server/sonar-web/src/main/js/app/components/__tests__/ProjectAdminContainer-test.tsx b/server/sonar-web/src/main/js/app/components/__tests__/ProjectAdminContainer-test.tsx index 996a1827127..048d615b186 100644 --- a/server/sonar-web/src/main/js/app/components/__tests__/ProjectAdminContainer-test.tsx +++ b/server/sonar-web/src/main/js/app/components/__tests__/ProjectAdminContainer-test.tsx @@ -19,10 +19,10 @@ */ import * as React from 'react'; import { Route } from 'react-router-dom'; +import { byText } from '~sonar-aligned/helpers/testSelector'; import handleRequiredAuthorization from '../../../app/utils/handleRequiredAuthorization'; import { mockComponent } from '../../../helpers/mocks/component'; import { renderAppRoutes } from '../../../helpers/testReactTestingUtils'; -import { byText } from '../../../helpers/testSelector'; import { ProjectAdminContainer } from '../ProjectAdminContainer'; jest.mock('../../utils/handleRequiredAuthorization', () => { diff --git a/server/sonar-web/src/main/js/app/components/__tests__/ResetPassword-test.tsx b/server/sonar-web/src/main/js/app/components/__tests__/ResetPassword-test.tsx index 1fca6e84140..49383d1dbb3 100644 --- a/server/sonar-web/src/main/js/app/components/__tests__/ResetPassword-test.tsx +++ b/server/sonar-web/src/main/js/app/components/__tests__/ResetPassword-test.tsx @@ -19,9 +19,9 @@ */ import userEvent from '@testing-library/user-event'; import * as React from 'react'; +import { byLabelText, byRole } from '~sonar-aligned/helpers/testSelector'; import { mockLoggedInUser } from '../../../helpers/testMocks'; import { renderComponent } from '../../../helpers/testReactTestingUtils'; -import { byLabelText, byRole } from '../../../helpers/testSelector'; import { ResetPassword, ResetPasswordProps } from '../ResetPassword'; jest.mock('../../../helpers/system', () => ({ diff --git a/server/sonar-web/src/main/js/app/components/__tests__/StartupModal-test.tsx b/server/sonar-web/src/main/js/app/components/__tests__/StartupModal-test.tsx index 835c9c51211..cbfc693f4fb 100644 --- a/server/sonar-web/src/main/js/app/components/__tests__/StartupModal-test.tsx +++ b/server/sonar-web/src/main/js/app/components/__tests__/StartupModal-test.tsx @@ -19,11 +19,11 @@ */ import userEvent from '@testing-library/user-event'; import * as React from 'react'; +import { byRole, byText } from '~sonar-aligned/helpers/testSelector'; import { showLicense } from '../../../api/editions'; import { save } from '../../../helpers/storage'; import { mockAppState, mockCurrentUser } from '../../../helpers/testMocks'; import { renderApp } from '../../../helpers/testReactTestingUtils'; -import { byRole, byText } from '../../../helpers/testSelector'; import { EditionKey } from '../../../types/editions'; import { LoggedInUser } from '../../../types/users'; import { StartupModal } from '../StartupModal'; diff --git a/server/sonar-web/src/main/js/app/components/__tests__/UpdateNotification-it.tsx b/server/sonar-web/src/main/js/app/components/__tests__/UpdateNotification-it.tsx index 9673352c29d..95edfabe6fa 100644 --- a/server/sonar-web/src/main/js/app/components/__tests__/UpdateNotification-it.tsx +++ b/server/sonar-web/src/main/js/app/components/__tests__/UpdateNotification-it.tsx @@ -20,11 +20,11 @@ import userEvent from '@testing-library/user-event'; import { addDays, formatISO, subDays } from 'date-fns'; import * as React from 'react'; +import { byRole } from '~sonar-aligned/helpers/testSelector'; import { getSystemUpgrades } from '../../../api/system'; import { UpdateUseCase } from '../../../components/upgrade/utils'; import { mockAppState, mockCurrentUser } from '../../../helpers/testMocks'; import { renderComponent } from '../../../helpers/testReactTestingUtils'; -import { byRole } from '../../../helpers/testSelector'; import { AppState } from '../../../types/appstate'; import { Permissions } from '../../../types/permissions'; import { CurrentUser } from '../../../types/users'; diff --git a/server/sonar-web/src/main/js/app/components/global-search/__tests__/GlobalSearch-it.tsx b/server/sonar-web/src/main/js/app/components/global-search/__tests__/GlobalSearch-it.tsx index 5e7a4b4a9ee..7c9f244d28e 100644 --- a/server/sonar-web/src/main/js/app/components/global-search/__tests__/GlobalSearch-it.tsx +++ b/server/sonar-web/src/main/js/app/components/global-search/__tests__/GlobalSearch-it.tsx @@ -19,10 +19,10 @@ */ import userEvent from '@testing-library/user-event'; import React from 'react'; +import { byRole, byText } from '~sonar-aligned/helpers/testSelector'; import { getSuggestions } from '../../../../api/components'; import { mockRouter } from '../../../../helpers/testMocks'; import { renderComponent } from '../../../../helpers/testReactTestingUtils'; -import { byRole, byText } from '../../../../helpers/testSelector'; import GlobalSearch, { GlobalSearch as GlobalSearchWithoutRouter } from '../GlobalSearch'; jest.mock('../../../../api/components', () => ({ diff --git a/server/sonar-web/src/main/js/app/components/indexation/__tests__/IndexationContextProvider-test.tsx b/server/sonar-web/src/main/js/app/components/indexation/__tests__/IndexationContextProvider-test.tsx index c78d6ffddc1..a5053335212 100644 --- a/server/sonar-web/src/main/js/app/components/indexation/__tests__/IndexationContextProvider-test.tsx +++ b/server/sonar-web/src/main/js/app/components/indexation/__tests__/IndexationContextProvider-test.tsx @@ -20,9 +20,9 @@ import { waitFor } from '@testing-library/react'; import * as React from 'react'; import { useContext } from 'react'; +import { byText } from '~sonar-aligned/helpers/testSelector'; import { mockAppState } from '../../../../helpers/testMocks'; import { renderComponent } from '../../../../helpers/testReactTestingUtils'; -import { byText } from '../../../../helpers/testSelector'; import { IndexationStatus } from '../../../../types/indexation'; import { IndexationContext } from '../IndexationContext'; import { diff --git a/server/sonar-web/src/main/js/app/components/indexation/__tests__/IndexationNotification-test.tsx b/server/sonar-web/src/main/js/app/components/indexation/__tests__/IndexationNotification-test.tsx index ce3683330c1..bca696b1e32 100644 --- a/server/sonar-web/src/main/js/app/components/indexation/__tests__/IndexationNotification-test.tsx +++ b/server/sonar-web/src/main/js/app/components/indexation/__tests__/IndexationNotification-test.tsx @@ -19,9 +19,9 @@ */ import { act } from '@testing-library/react'; import * as React from 'react'; +import { byText } from '~sonar-aligned/helpers/testSelector'; import { mockCurrentUser, mockLoggedInUser } from '../../../../helpers/testMocks'; import { renderComponent } from '../../../../helpers/testReactTestingUtils'; -import { byText } from '../../../../helpers/testSelector'; import { Permissions } from '../../../../types/permissions'; import { IndexationNotification } from '../IndexationNotification'; import IndexationNotificationHelper from '../IndexationNotificationHelper'; diff --git a/server/sonar-web/src/main/js/app/components/indexation/__tests__/IndexationNotificationRenderer-test.tsx b/server/sonar-web/src/main/js/app/components/indexation/__tests__/IndexationNotificationRenderer-test.tsx index 58a71897f0b..a9f4e0ca1e1 100644 --- a/server/sonar-web/src/main/js/app/components/indexation/__tests__/IndexationNotificationRenderer-test.tsx +++ b/server/sonar-web/src/main/js/app/components/indexation/__tests__/IndexationNotificationRenderer-test.tsx @@ -18,8 +18,8 @@ * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ import * as React from 'react'; +import { byRole, byText } from '~sonar-aligned/helpers/testSelector'; import { renderComponent } from '../../../../helpers/testReactTestingUtils'; -import { byRole, byText } from '../../../../helpers/testSelector'; import { IndexationNotificationType } from '../../../../types/indexation'; import IndexationNotificationRenderer from '../IndexationNotificationRenderer'; diff --git a/server/sonar-web/src/main/js/app/components/indexation/__tests__/PageUnavailableDueToIndexation-test.tsx b/server/sonar-web/src/main/js/app/components/indexation/__tests__/PageUnavailableDueToIndexation-test.tsx index f6ad1e649e1..e62a141b79e 100644 --- a/server/sonar-web/src/main/js/app/components/indexation/__tests__/PageUnavailableDueToIndexation-test.tsx +++ b/server/sonar-web/src/main/js/app/components/indexation/__tests__/PageUnavailableDueToIndexation-test.tsx @@ -18,8 +18,8 @@ * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ import * as React from 'react'; +import { byRole } from '~sonar-aligned/helpers/testSelector'; import { renderComponent } from '../../../../helpers/testReactTestingUtils'; -import { byRole } from '../../../../helpers/testSelector'; import { PageUnavailableDueToIndexation } from '../PageUnavailableDueToIndexation'; it('should render correctly', () => { diff --git a/server/sonar-web/src/main/js/app/components/languages/__tests__/LanguagesContextProvider-test.tsx b/server/sonar-web/src/main/js/app/components/languages/__tests__/LanguagesContextProvider-test.tsx index 7ae7fe17911..b8b93105f48 100644 --- a/server/sonar-web/src/main/js/app/components/languages/__tests__/LanguagesContextProvider-test.tsx +++ b/server/sonar-web/src/main/js/app/components/languages/__tests__/LanguagesContextProvider-test.tsx @@ -18,9 +18,9 @@ * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ import * as React from 'react'; +import { byRole } from '~sonar-aligned/helpers/testSelector'; import { getLanguages } from '../../../../api/languages'; import { renderComponent } from '../../../../helpers/testReactTestingUtils'; -import { byRole } from '../../../../helpers/testSelector'; import { Language } from '../../../../types/languages'; import { LanguagesContext } from '../LanguagesContext'; import LanguagesContextProvider from '../LanguagesContextProvider'; diff --git a/server/sonar-web/src/main/js/app/components/metrics/__tests__/MetricsContextProvider-test.tsx b/server/sonar-web/src/main/js/app/components/metrics/__tests__/MetricsContextProvider-test.tsx index b5e34cece78..9e2ced6baff 100644 --- a/server/sonar-web/src/main/js/app/components/metrics/__tests__/MetricsContextProvider-test.tsx +++ b/server/sonar-web/src/main/js/app/components/metrics/__tests__/MetricsContextProvider-test.tsx @@ -18,11 +18,11 @@ * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ import * as React from 'react'; +import { byRole } from '~sonar-aligned/helpers/testSelector'; import { MetricKey } from '~sonar-aligned/types/metrics'; import { getAllMetrics } from '../../../../api/metrics'; import { mockMetric } from '../../../../helpers/testMocks'; import { renderComponent } from '../../../../helpers/testReactTestingUtils'; -import { byRole } from '../../../../helpers/testSelector'; import { MetricsContext } from '../MetricsContext'; import MetricsContextProvider from '../MetricsContextProvider'; diff --git a/server/sonar-web/src/main/js/app/components/promotion-notification/__tests__/PromotionNotification-test.tsx b/server/sonar-web/src/main/js/app/components/promotion-notification/__tests__/PromotionNotification-test.tsx index 723c55e6659..547ed35b153 100644 --- a/server/sonar-web/src/main/js/app/components/promotion-notification/__tests__/PromotionNotification-test.tsx +++ b/server/sonar-web/src/main/js/app/components/promotion-notification/__tests__/PromotionNotification-test.tsx @@ -19,10 +19,10 @@ */ import userEvent from '@testing-library/user-event'; import * as React from 'react'; +import { byRole, byText } from '~sonar-aligned/helpers/testSelector'; import { dismissNotice } from '../../../../api/users'; import { mockCurrentUser, mockLoggedInUser } from '../../../../helpers/testMocks'; import { renderComponent } from '../../../../helpers/testReactTestingUtils'; -import { byRole, byText } from '../../../../helpers/testSelector'; import { CurrentUser, NoticeType } from '../../../../types/users'; import PromotionNotification from '../PromotionNotification'; diff --git a/server/sonar-web/src/main/js/apps/account/__tests__/Account-it.tsx b/server/sonar-web/src/main/js/apps/account/__tests__/Account-it.tsx index e4835da67f5..6b24fdf711f 100644 --- a/server/sonar-web/src/main/js/apps/account/__tests__/Account-it.tsx +++ b/server/sonar-web/src/main/js/apps/account/__tests__/Account-it.tsx @@ -23,6 +23,7 @@ import { UserEvent } from '@testing-library/user-event/dist/types/setup/setup'; import React from 'react'; import { Outlet, Route } from 'react-router-dom'; import selectEvent from 'react-select-event'; +import { byRole, byText } from '~sonar-aligned/helpers/testSelector'; import { getMyProjects, getScannableProjects } from '../../../api/components'; import NotificationsMock from '../../../api/mocks/NotificationsMock'; import UserTokensMock from '../../../api/mocks/UserTokensMock'; @@ -30,7 +31,6 @@ import { mockUserToken } from '../../../helpers/mocks/token'; import { setKeyboardShortcutEnabled } from '../../../helpers/preferences'; import { mockCurrentUser, mockLoggedInUser } from '../../../helpers/testMocks'; import { renderAppRoutes } from '../../../helpers/testReactTestingUtils'; -import { byRole, byText } from '../../../helpers/testSelector'; import { NotificationGlobalType, NotificationProjectType } from '../../../types/notifications'; import { Permissions } from '../../../types/permissions'; import { TokenType } from '../../../types/token'; diff --git a/server/sonar-web/src/main/js/apps/audit-logs/components/__tests__/AuditApp-it.tsx b/server/sonar-web/src/main/js/apps/audit-logs/components/__tests__/AuditApp-it.tsx index 31bd0f534ac..bc12f0e5a6e 100644 --- a/server/sonar-web/src/main/js/apps/audit-logs/components/__tests__/AuditApp-it.tsx +++ b/server/sonar-web/src/main/js/apps/audit-logs/components/__tests__/AuditApp-it.tsx @@ -19,11 +19,11 @@ */ import userEvent from '@testing-library/user-event'; import { getDate, getMonth, getYear, subDays } from 'date-fns'; +import { byPlaceholderText, byRole, byTestId, byText } from '~sonar-aligned/helpers/testSelector'; import SettingsServiceMock from '../../../../api/mocks/SettingsServiceMock'; import { now } from '../../../../helpers/dates'; import { getShortMonthName } from '../../../../helpers/l10n'; import { renderAppWithAdminContext } from '../../../../helpers/testReactTestingUtils'; -import { byPlaceholderText, byRole, byTestId, byText } from '../../../../helpers/testSelector'; import { AdminPageExtension } from '../../../../types/extension'; import { SettingsKey } from '../../../../types/settings'; import routes from '../../routes'; diff --git a/server/sonar-web/src/main/js/apps/background-tasks/__tests__/BackgroundTasks-it.tsx b/server/sonar-web/src/main/js/apps/background-tasks/__tests__/BackgroundTasks-it.tsx index 8d849cd1f4b..c984c2a9b74 100644 --- a/server/sonar-web/src/main/js/apps/background-tasks/__tests__/BackgroundTasks-it.tsx +++ b/server/sonar-web/src/main/js/apps/background-tasks/__tests__/BackgroundTasks-it.tsx @@ -20,17 +20,17 @@ import { screen, waitFor, within } from '@testing-library/react'; import userEvent from '@testing-library/user-event'; import selectEvent from 'react-select-event'; -import ComputeEngineServiceMock from '../../../api/mocks/ComputeEngineServiceMock'; -import { parseDate } from '../../../helpers/dates'; -import { mockAppState } from '../../../helpers/testMocks'; -import { RenderContext, renderAppWithAdminContext } from '../../../helpers/testReactTestingUtils'; import { byLabelText, byPlaceholderText, byRole, byTestId, byText, -} from '../../../helpers/testSelector'; +} from '~sonar-aligned/helpers/testSelector'; +import ComputeEngineServiceMock from '../../../api/mocks/ComputeEngineServiceMock'; +import { parseDate } from '../../../helpers/dates'; +import { mockAppState } from '../../../helpers/testMocks'; +import { RenderContext, renderAppWithAdminContext } from '../../../helpers/testReactTestingUtils'; import { EditionKey } from '../../../types/editions'; import { TaskStatuses, TaskTypes } from '../../../types/tasks'; import { PAGE_SIZE } from '../constants'; diff --git a/server/sonar-web/src/main/js/apps/change-admin-password/__tests__/ChangeAdminPasswordApp-it.tsx b/server/sonar-web/src/main/js/apps/change-admin-password/__tests__/ChangeAdminPasswordApp-it.tsx index 793876e74e1..5b1c966e92f 100644 --- a/server/sonar-web/src/main/js/apps/change-admin-password/__tests__/ChangeAdminPasswordApp-it.tsx +++ b/server/sonar-web/src/main/js/apps/change-admin-password/__tests__/ChangeAdminPasswordApp-it.tsx @@ -19,10 +19,10 @@ */ import userEvent from '@testing-library/user-event'; import * as React from 'react'; +import { byLabelText, byRole, byText } from '~sonar-aligned/helpers/testSelector'; import { changePassword } from '../../../api/users'; import { mockAppState } from '../../../helpers/testMocks'; import { renderApp } from '../../../helpers/testReactTestingUtils'; -import { byLabelText, byRole, byText } from '../../../helpers/testSelector'; import { AppState } from '../../../types/appstate'; import ChangeAdminPasswordApp from '../ChangeAdminPasswordApp'; import { DEFAULT_ADMIN_PASSWORD } from '../constants'; diff --git a/server/sonar-web/src/main/js/apps/code/__tests__/Code-it.ts b/server/sonar-web/src/main/js/apps/code/__tests__/Code-it.ts index 69f25326f11..5ad77477c21 100644 --- a/server/sonar-web/src/main/js/apps/code/__tests__/Code-it.ts +++ b/server/sonar-web/src/main/js/apps/code/__tests__/Code-it.ts @@ -21,6 +21,7 @@ import { screen, waitFor, within } from '@testing-library/react'; import userEvent from '@testing-library/user-event'; import { UserEvent } from '@testing-library/user-event/dist/types/setup/setup'; import { keyBy, omit, times } from 'lodash'; +import { QuerySelector, byLabelText, byRole, byText } from '~sonar-aligned/helpers/testSelector'; import { ComponentQualifier } from '~sonar-aligned/types/component'; import { MetricKey } from '~sonar-aligned/types/metrics'; import BranchesServiceMock from '../../../api/mocks/BranchesServiceMock'; @@ -31,7 +32,6 @@ import { isDiffMetric } from '../../../helpers/measures'; import { mockComponent } from '../../../helpers/mocks/component'; import { mockMeasure } from '../../../helpers/testMocks'; import { renderAppWithComponentContext } from '../../../helpers/testReactTestingUtils'; -import { QuerySelector, byLabelText, byRole, byText } from '../../../helpers/testSelector'; import { Component } from '../../../types/types'; import routes from '../routes'; diff --git a/server/sonar-web/src/main/js/apps/coding-rules/__tests__/CustomRule-it.ts b/server/sonar-web/src/main/js/apps/coding-rules/__tests__/CustomRule-it.ts index ccc57d80980..8a89d79ea62 100644 --- a/server/sonar-web/src/main/js/apps/coding-rules/__tests__/CustomRule-it.ts +++ b/server/sonar-web/src/main/js/apps/coding-rules/__tests__/CustomRule-it.ts @@ -18,10 +18,10 @@ * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ import selectEvent from 'react-select-event'; +import { byText } from '~sonar-aligned/helpers/testSelector'; import CodingRulesServiceMock from '../../../api/mocks/CodingRulesServiceMock'; import SettingsServiceMock from '../../../api/mocks/SettingsServiceMock'; import { mockLoggedInUser } from '../../../helpers/testMocks'; -import { byText } from '../../../helpers/testSelector'; import { SoftwareQuality } from '../../../types/clean-code-taxonomy'; import { getPageObjects, renderCodingRulesApp } from '../utils-tests'; diff --git a/server/sonar-web/src/main/js/apps/coding-rules/utils-tests.tsx b/server/sonar-web/src/main/js/apps/coding-rules/utils-tests.tsx index e475443cf27..c81db6ff094 100644 --- a/server/sonar-web/src/main/js/apps/coding-rules/utils-tests.tsx +++ b/server/sonar-web/src/main/js/apps/coding-rules/utils-tests.tsx @@ -19,15 +19,15 @@ */ import { waitFor } from '@testing-library/react'; import userEvent from '@testing-library/user-event'; -import { Profile } from '../../api/quality-profiles'; -import { renderAppRoutes } from '../../helpers/testReactTestingUtils'; import { byLabelText, byPlaceholderText, byRole, byTestId, byText, -} from '../../helpers/testSelector'; +} from '~sonar-aligned/helpers/testSelector'; +import { Profile } from '../../api/quality-profiles'; +import { renderAppRoutes } from '../../helpers/testReactTestingUtils'; import { CleanCodeAttribute, CleanCodeAttributeCategory, diff --git a/server/sonar-web/src/main/js/apps/component-measures/__tests__/ComponentMeasures-it.tsx b/server/sonar-web/src/main/js/apps/component-measures/__tests__/ComponentMeasures-it.tsx index 622cdbe9b28..38faea59790 100644 --- a/server/sonar-web/src/main/js/apps/component-measures/__tests__/ComponentMeasures-it.tsx +++ b/server/sonar-web/src/main/js/apps/component-measures/__tests__/ComponentMeasures-it.tsx @@ -21,6 +21,7 @@ import { screen, waitFor, within } from '@testing-library/react'; import userEvent from '@testing-library/user-event'; import { times } from 'lodash'; import selectEvent from 'react-select-event'; +import { byLabelText, byRole, byTestId, byText } from '~sonar-aligned/helpers/testSelector'; import { ComponentQualifier } from '~sonar-aligned/types/component'; import { MetricKey } from '~sonar-aligned/types/metrics'; import BranchesServiceMock from '../../../api/mocks/BranchesServiceMock'; @@ -30,7 +31,6 @@ import { MeasuresServiceMock } from '../../../api/mocks/MeasuresServiceMock'; import { mockComponent } from '../../../helpers/mocks/component'; import { mockMeasure, mockMetric } from '../../../helpers/testMocks'; import { renderAppWithComponentContext } from '../../../helpers/testReactTestingUtils'; -import { byLabelText, byRole, byTestId, byText } from '../../../helpers/testSelector'; import { ComponentContextShape } from '../../../types/component'; import { Feature } from '../../../types/features'; import routes from '../routes'; diff --git a/server/sonar-web/src/main/js/apps/create/project/__tests__/Azure-it.tsx b/server/sonar-web/src/main/js/apps/create/project/__tests__/Azure-it.tsx index c235dce4330..af0547a00da 100644 --- a/server/sonar-web/src/main/js/apps/create/project/__tests__/Azure-it.tsx +++ b/server/sonar-web/src/main/js/apps/create/project/__tests__/Azure-it.tsx @@ -22,12 +22,12 @@ import { screen, waitFor } from '@testing-library/react'; import userEvent from '@testing-library/user-event'; import * as React from 'react'; import selectEvent from 'react-select-event'; +import { byLabelText, byRole, byText } from '~sonar-aligned/helpers/testSelector'; import { searchAzureRepositories } from '../../../../api/alm-integrations'; import AlmIntegrationsServiceMock from '../../../../api/mocks/AlmIntegrationsServiceMock'; import DopTranslationServiceMock from '../../../../api/mocks/DopTranslationServiceMock'; import NewCodeDefinitionServiceMock from '../../../../api/mocks/NewCodeDefinitionServiceMock'; import { renderApp } from '../../../../helpers/testReactTestingUtils'; -import { byLabelText, byRole, byText } from '../../../../helpers/testSelector'; import { Feature } from '../../../../types/features'; import CreateProjectPage from '../CreateProjectPage'; import { CreateProjectModes } from '../types'; diff --git a/server/sonar-web/src/main/js/apps/create/project/__tests__/Bitbucket-it.tsx b/server/sonar-web/src/main/js/apps/create/project/__tests__/Bitbucket-it.tsx index 8c372759e8d..72bf92af621 100644 --- a/server/sonar-web/src/main/js/apps/create/project/__tests__/Bitbucket-it.tsx +++ b/server/sonar-web/src/main/js/apps/create/project/__tests__/Bitbucket-it.tsx @@ -22,12 +22,12 @@ import { screen, waitFor, within } from '@testing-library/react'; import userEvent from '@testing-library/user-event'; import * as React from 'react'; import selectEvent from 'react-select-event'; +import { byLabelText, byRole, byText } from '~sonar-aligned/helpers/testSelector'; import { searchForBitbucketServerRepositories } from '../../../../api/alm-integrations'; import AlmIntegrationsServiceMock from '../../../../api/mocks/AlmIntegrationsServiceMock'; import DopTranslationServiceMock from '../../../../api/mocks/DopTranslationServiceMock'; import NewCodeDefinitionServiceMock from '../../../../api/mocks/NewCodeDefinitionServiceMock'; import { renderApp } from '../../../../helpers/testReactTestingUtils'; -import { byLabelText, byRole, byText } from '../../../../helpers/testSelector'; import { Feature } from '../../../../types/features'; import CreateProjectPage from '../CreateProjectPage'; import { CreateProjectModes } from '../types'; diff --git a/server/sonar-web/src/main/js/apps/create/project/__tests__/BitbucketCloud-it.tsx b/server/sonar-web/src/main/js/apps/create/project/__tests__/BitbucketCloud-it.tsx index d9a2b7e8a40..e900b099e07 100644 --- a/server/sonar-web/src/main/js/apps/create/project/__tests__/BitbucketCloud-it.tsx +++ b/server/sonar-web/src/main/js/apps/create/project/__tests__/BitbucketCloud-it.tsx @@ -22,12 +22,12 @@ import { screen, waitFor, within } from '@testing-library/react'; import userEvent from '@testing-library/user-event'; import * as React from 'react'; import selectEvent from 'react-select-event'; +import { byLabelText, byRole, byText } from '~sonar-aligned/helpers/testSelector'; import { searchForBitbucketCloudRepositories } from '../../../../api/alm-integrations'; import AlmIntegrationsServiceMock from '../../../../api/mocks/AlmIntegrationsServiceMock'; import DopTranslationServiceMock from '../../../../api/mocks/DopTranslationServiceMock'; import NewCodeDefinitionServiceMock from '../../../../api/mocks/NewCodeDefinitionServiceMock'; import { renderApp } from '../../../../helpers/testReactTestingUtils'; -import { byLabelText, byRole, byText } from '../../../../helpers/testSelector'; import { Feature } from '../../../../types/features'; import CreateProjectPage from '../CreateProjectPage'; import { REPOSITORY_PAGE_SIZE } from '../constants'; diff --git a/server/sonar-web/src/main/js/apps/create/project/__tests__/GitHub-it.tsx b/server/sonar-web/src/main/js/apps/create/project/__tests__/GitHub-it.tsx index b01f72702bf..e231ed99b3c 100644 --- a/server/sonar-web/src/main/js/apps/create/project/__tests__/GitHub-it.tsx +++ b/server/sonar-web/src/main/js/apps/create/project/__tests__/GitHub-it.tsx @@ -22,13 +22,13 @@ import { screen, waitFor } from '@testing-library/react'; import userEvent from '@testing-library/user-event'; import * as React from 'react'; import selectEvent from 'react-select-event'; +import { byLabelText, byRole, byText } from '~sonar-aligned/helpers/testSelector'; import { getGithubRepositories } from '../../../../api/alm-integrations'; import AlmIntegrationsServiceMock from '../../../../api/mocks/AlmIntegrationsServiceMock'; import DopTranslationServiceMock from '../../../../api/mocks/DopTranslationServiceMock'; import NewCodeDefinitionServiceMock from '../../../../api/mocks/NewCodeDefinitionServiceMock'; import { mockGitHubRepository } from '../../../../helpers/mocks/alm-integrations'; import { renderApp } from '../../../../helpers/testReactTestingUtils'; -import { byLabelText, byRole, byText } from '../../../../helpers/testSelector'; import CreateProjectPage from '../CreateProjectPage'; jest.mock('../../../../api/alm-integrations'); diff --git a/server/sonar-web/src/main/js/apps/create/project/__tests__/GitLab-it.tsx b/server/sonar-web/src/main/js/apps/create/project/__tests__/GitLab-it.tsx index d255c9a1ad7..b6d08bb85a1 100644 --- a/server/sonar-web/src/main/js/apps/create/project/__tests__/GitLab-it.tsx +++ b/server/sonar-web/src/main/js/apps/create/project/__tests__/GitLab-it.tsx @@ -21,13 +21,13 @@ import { screen, waitFor } from '@testing-library/react'; import userEvent from '@testing-library/user-event'; import * as React from 'react'; import selectEvent from 'react-select-event'; +import { byLabelText, byRole, byText } from '~sonar-aligned/helpers/testSelector'; import { getGitlabProjects } from '../../../../api/alm-integrations'; import AlmIntegrationsServiceMock from '../../../../api/mocks/AlmIntegrationsServiceMock'; import DopTranslationServiceMock from '../../../../api/mocks/DopTranslationServiceMock'; import NewCodeDefinitionServiceMock from '../../../../api/mocks/NewCodeDefinitionServiceMock'; import { mockGitlabProject } from '../../../../helpers/mocks/alm-integrations'; import { renderApp } from '../../../../helpers/testReactTestingUtils'; -import { byLabelText, byRole, byText } from '../../../../helpers/testSelector'; import { Feature } from '../../../../types/features'; import CreateProjectPage from '../CreateProjectPage'; import { CreateProjectModes } from '../types'; diff --git a/server/sonar-web/src/main/js/apps/create/project/__tests__/Manual-it.tsx b/server/sonar-web/src/main/js/apps/create/project/__tests__/Manual-it.tsx index ebdbc3c1c7d..5ebbbc90b78 100644 --- a/server/sonar-web/src/main/js/apps/create/project/__tests__/Manual-it.tsx +++ b/server/sonar-web/src/main/js/apps/create/project/__tests__/Manual-it.tsx @@ -20,6 +20,7 @@ import { waitFor } from '@testing-library/react'; import userEvent from '@testing-library/user-event'; import { UserEvent } from '@testing-library/user-event/dist/types/setup/setup'; +import { byRole, byText } from '~sonar-aligned/helpers/testSelector'; import AlmSettingsServiceMock from '../../../../api/mocks/AlmSettingsServiceMock'; import DopTranslationServiceMock from '../../../../api/mocks/DopTranslationServiceMock'; import NewCodeDefinitionServiceMock from '../../../../api/mocks/NewCodeDefinitionServiceMock'; @@ -28,7 +29,6 @@ import { getNewCodeDefinition } from '../../../../api/newCodeDefinition'; import { mockProject } from '../../../../helpers/mocks/projects'; import { mockAppState, mockCurrentUser } from '../../../../helpers/testMocks'; import { renderAppRoutes } from '../../../../helpers/testReactTestingUtils'; -import { byRole, byText } from '../../../../helpers/testSelector'; import { NewCodeDefinitionType } from '../../../../types/new-code-definition'; import { Permissions } from '../../../../types/permissions'; import routes from '../../../projects/routes'; diff --git a/server/sonar-web/src/main/js/apps/create/project/__tests__/ManualProjectCreate-test.tsx b/server/sonar-web/src/main/js/apps/create/project/__tests__/ManualProjectCreate-test.tsx index 2e2e033ef76..5c5d13ea5b1 100644 --- a/server/sonar-web/src/main/js/apps/create/project/__tests__/ManualProjectCreate-test.tsx +++ b/server/sonar-web/src/main/js/apps/create/project/__tests__/ManualProjectCreate-test.tsx @@ -20,9 +20,9 @@ import { screen } from '@testing-library/react'; import userEvent from '@testing-library/user-event'; import * as React from 'react'; +import { byRole } from '~sonar-aligned/helpers/testSelector'; import { doesComponentExists } from '../../../../api/components'; import { renderComponent } from '../../../../helpers/testReactTestingUtils'; -import { byRole } from '../../../../helpers/testSelector'; import ManualProjectCreate from '../manual/ManualProjectCreate'; const ui = { diff --git a/server/sonar-web/src/main/js/apps/create/project/__tests__/MonorepoProjectCreate-it.tsx b/server/sonar-web/src/main/js/apps/create/project/__tests__/MonorepoProjectCreate-it.tsx index a16e30f7e9a..2fdd09661d3 100644 --- a/server/sonar-web/src/main/js/apps/create/project/__tests__/MonorepoProjectCreate-it.tsx +++ b/server/sonar-web/src/main/js/apps/create/project/__tests__/MonorepoProjectCreate-it.tsx @@ -21,6 +21,7 @@ import { waitFor } from '@testing-library/react'; import userEvent from '@testing-library/user-event'; import React from 'react'; import selectEvent from 'react-select-event'; +import { byRole, byText } from '~sonar-aligned/helpers/testSelector'; import AlmIntegrationsServiceMock from '../../../../api/mocks/AlmIntegrationsServiceMock'; import AlmSettingsServiceMock from '../../../../api/mocks/AlmSettingsServiceMock'; import ComponentsServiceMock from '../../../../api/mocks/ComponentsServiceMock'; @@ -30,7 +31,6 @@ import ProjectManagementServiceMock from '../../../../api/mocks/ProjectsManageme import SettingsServiceMock from '../../../../api/mocks/SettingsServiceMock'; import { mockProject } from '../../../../helpers/mocks/projects'; import { renderApp } from '../../../../helpers/testReactTestingUtils'; -import { byRole, byText } from '../../../../helpers/testSelector'; import { AlmKeys } from '../../../../types/alm-settings'; import { Feature } from '../../../../types/features'; import CreateProjectPage from '../CreateProjectPage'; diff --git a/server/sonar-web/src/main/js/apps/groups/__tests__/GroupsApp-it.tsx b/server/sonar-web/src/main/js/apps/groups/__tests__/GroupsApp-it.tsx index 4ef85a29f56..874b681b58c 100644 --- a/server/sonar-web/src/main/js/apps/groups/__tests__/GroupsApp-it.tsx +++ b/server/sonar-web/src/main/js/apps/groups/__tests__/GroupsApp-it.tsx @@ -20,6 +20,7 @@ import { screen, waitFor, within } from '@testing-library/react'; import userEvent from '@testing-library/user-event'; import * as React from 'react'; +import { byRole, byText } from '~sonar-aligned/helpers/testSelector'; import GithubProvisioningServiceMock from '../../../api/mocks/GithubProvisioningServiceMock'; import GroupMembershipsServiceMock from '../../../api/mocks/GroupMembersipsServiceMock'; import GroupsServiceMock from '../../../api/mocks/GroupsServiceMock'; @@ -27,7 +28,6 @@ import SystemServiceMock from '../../../api/mocks/SystemServiceMock'; import UsersServiceMock from '../../../api/mocks/UsersServiceMock'; import { mockGroup, mockGroupMembership, mockRestUser } from '../../../helpers/testMocks'; import { renderApp } from '../../../helpers/testReactTestingUtils'; -import { byRole, byText } from '../../../helpers/testSelector'; import { Feature } from '../../../types/features'; import { TaskStatuses } from '../../../types/tasks'; import { Provider } from '../../../types/types'; diff --git a/server/sonar-web/src/main/js/apps/issues/__tests__/IssueApp-it.tsx b/server/sonar-web/src/main/js/apps/issues/__tests__/IssueApp-it.tsx index 2f44ce20b8f..58a0a22d0dd 100644 --- a/server/sonar-web/src/main/js/apps/issues/__tests__/IssueApp-it.tsx +++ b/server/sonar-web/src/main/js/apps/issues/__tests__/IssueApp-it.tsx @@ -20,9 +20,9 @@ import { screen, within } from '@testing-library/react'; import userEvent from '@testing-library/user-event'; import React from 'react'; +import { byRole, byText } from '~sonar-aligned/helpers/testSelector'; import { TabKeys } from '../../../components/rules/RuleTabViewer'; import { mockLoggedInUser } from '../../../helpers/testMocks'; -import { byRole, byText } from '../../../helpers/testSelector'; import { RestUserDetailed } from '../../../types/users'; import { branchHandler, diff --git a/server/sonar-web/src/main/js/apps/issues/__tests__/IssueHeader-it.tsx b/server/sonar-web/src/main/js/apps/issues/__tests__/IssueHeader-it.tsx index ab1c1e628cf..b1edb27376b 100644 --- a/server/sonar-web/src/main/js/apps/issues/__tests__/IssueHeader-it.tsx +++ b/server/sonar-web/src/main/js/apps/issues/__tests__/IssueHeader-it.tsx @@ -18,10 +18,10 @@ * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ import * as React from 'react'; +import { byRole, byText } from '~sonar-aligned/helpers/testSelector'; import { WorkspaceContext } from '../../../components/workspace/context'; import { mockIssue, mockRuleDetails } from '../../../helpers/testMocks'; import { renderComponent } from '../../../helpers/testReactTestingUtils'; -import { byRole, byText } from '../../../helpers/testSelector'; import { Dict } from '../../../types/types'; import IssueHeader from '../components/IssueHeader'; diff --git a/server/sonar-web/src/main/js/apps/issues/__tests__/IssuesSourceViewer-it.tsx b/server/sonar-web/src/main/js/apps/issues/__tests__/IssuesSourceViewer-it.tsx index 59e2a997b66..4617899d3b1 100644 --- a/server/sonar-web/src/main/js/apps/issues/__tests__/IssuesSourceViewer-it.tsx +++ b/server/sonar-web/src/main/js/apps/issues/__tests__/IssuesSourceViewer-it.tsx @@ -19,7 +19,7 @@ */ import { screen } from '@testing-library/react'; import userEvent from '@testing-library/user-event'; -import { byLabelText, byRole } from '../../../helpers/testSelector'; +import { byLabelText, byRole } from '~sonar-aligned/helpers/testSelector'; import { componentsHandler, issuesHandler, diff --git a/server/sonar-web/src/main/js/apps/issues/components/__tests__/AssigneeSelect-test.tsx b/server/sonar-web/src/main/js/apps/issues/components/__tests__/AssigneeSelect-test.tsx index 9e8ffbcb0bd..5779552e809 100644 --- a/server/sonar-web/src/main/js/apps/issues/components/__tests__/AssigneeSelect-test.tsx +++ b/server/sonar-web/src/main/js/apps/issues/components/__tests__/AssigneeSelect-test.tsx @@ -20,11 +20,11 @@ import { screen } from '@testing-library/react'; import userEvent from '@testing-library/user-event'; import * as React from 'react'; +import { byLabelText } from '~sonar-aligned/helpers/testSelector'; import CurrentUserContextProvider from '../../../../app/components/current-user/CurrentUserContextProvider'; import { mockUserBase } from '../../../../helpers/mocks/users'; import { mockCurrentUser, mockIssue, mockLoggedInUser } from '../../../../helpers/testMocks'; import { renderComponent } from '../../../../helpers/testReactTestingUtils'; -import { byLabelText } from '../../../../helpers/testSelector'; import { CurrentUser } from '../../../../types/users'; import AssigneeSelect, { AssigneeSelectProps, MIN_QUERY_LENGTH } from '../AssigneeSelect'; diff --git a/server/sonar-web/src/main/js/apps/issues/crossComponentSourceViewer/__tests__/IssueSourceViewerHeader-test.tsx b/server/sonar-web/src/main/js/apps/issues/crossComponentSourceViewer/__tests__/IssueSourceViewerHeader-test.tsx index d5dab9bdc5d..b034c810cd0 100644 --- a/server/sonar-web/src/main/js/apps/issues/crossComponentSourceViewer/__tests__/IssueSourceViewerHeader-test.tsx +++ b/server/sonar-web/src/main/js/apps/issues/crossComponentSourceViewer/__tests__/IssueSourceViewerHeader-test.tsx @@ -19,13 +19,13 @@ */ import { screen, waitForElementToBeRemoved } from '@testing-library/react'; import * as React from 'react'; +import { byRole, byText } from '~sonar-aligned/helpers/testSelector'; import BranchesServiceMock from '../../../../api/mocks/BranchesServiceMock'; import { AvailableFeaturesContext } from '../../../../app/components/available-features/AvailableFeaturesContext'; import { ComponentContext } from '../../../../app/components/componentContext/ComponentContext'; import { mockComponent } from '../../../../helpers/mocks/component'; import { mockSourceViewerFile } from '../../../../helpers/mocks/sources'; import { renderComponent } from '../../../../helpers/testReactTestingUtils'; -import { byRole, byText } from '../../../../helpers/testSelector'; import { Feature } from '../../../../types/features'; import { IssueSourceViewerHeader, Props } from '../IssueSourceViewerHeader'; diff --git a/server/sonar-web/src/main/js/apps/issues/crossComponentSourceViewer/__tests__/SnippetViewer-test.tsx b/server/sonar-web/src/main/js/apps/issues/crossComponentSourceViewer/__tests__/SnippetViewer-test.tsx index 5d5bbc81bfe..7666a785d68 100644 --- a/server/sonar-web/src/main/js/apps/issues/crossComponentSourceViewer/__tests__/SnippetViewer-test.tsx +++ b/server/sonar-web/src/main/js/apps/issues/crossComponentSourceViewer/__tests__/SnippetViewer-test.tsx @@ -20,9 +20,9 @@ import { screen } from '@testing-library/react'; import { range } from 'lodash'; import * as React from 'react'; +import { byRole } from '~sonar-aligned/helpers/testSelector'; import { mockSourceLine, mockSourceViewerFile } from '../../../../helpers/mocks/sources'; import { renderComponent } from '../../../../helpers/testReactTestingUtils'; -import { byRole } from '../../../../helpers/testSelector'; import SnippetViewer, { SnippetViewerProps } from '../SnippetViewer'; beforeEach(() => { diff --git a/server/sonar-web/src/main/js/apps/issues/issues-subnavigation/__tests__/SubnavigationIssues-it.tsx b/server/sonar-web/src/main/js/apps/issues/issues-subnavigation/__tests__/SubnavigationIssues-it.tsx index 39374606908..50ae8bd376c 100644 --- a/server/sonar-web/src/main/js/apps/issues/issues-subnavigation/__tests__/SubnavigationIssues-it.tsx +++ b/server/sonar-web/src/main/js/apps/issues/issues-subnavigation/__tests__/SubnavigationIssues-it.tsx @@ -20,9 +20,9 @@ import { screen } from '@testing-library/react'; import userEvent from '@testing-library/user-event'; import * as React from 'react'; +import { byRole } from '~sonar-aligned/helpers/testSelector'; import { mockFlowLocation, mockIssue, mockPaging } from '../../../../helpers/testMocks'; import { renderComponent } from '../../../../helpers/testReactTestingUtils'; -import { byRole } from '../../../../helpers/testSelector'; import { ComponentPropsType } from '../../../../helpers/testUtils'; import { FlowType, Issue } from '../../../../types/types'; import { VISIBLE_LOCATIONS_COLLAPSE } from '../IssueLocationsCrossFile'; diff --git a/server/sonar-web/src/main/js/apps/issues/sidebar/__tests__/SimpleListStyleFacet-test.tsx b/server/sonar-web/src/main/js/apps/issues/sidebar/__tests__/SimpleListStyleFacet-test.tsx index 9077957e759..94cd19a939c 100644 --- a/server/sonar-web/src/main/js/apps/issues/sidebar/__tests__/SimpleListStyleFacet-test.tsx +++ b/server/sonar-web/src/main/js/apps/issues/sidebar/__tests__/SimpleListStyleFacet-test.tsx @@ -19,8 +19,8 @@ */ import userEvent from '@testing-library/user-event'; import * as React from 'react'; +import { byRole } from '~sonar-aligned/helpers/testSelector'; import { renderComponent } from '../../../../helpers/testReactTestingUtils'; -import { byRole } from '../../../../helpers/testSelector'; import { FCProps } from '../../../../types/misc'; import { SimpleListStyleFacet } from '../SimpleListStyleFacet'; diff --git a/server/sonar-web/src/main/js/apps/issues/test-utils.tsx b/server/sonar-web/src/main/js/apps/issues/test-utils.tsx index 45711516bdd..1df5118c91c 100644 --- a/server/sonar-web/src/main/js/apps/issues/test-utils.tsx +++ b/server/sonar-web/src/main/js/apps/issues/test-utils.tsx @@ -20,6 +20,7 @@ import { waitFor } from '@testing-library/react'; import React from 'react'; import { Outlet, Route } from 'react-router-dom'; +import { byPlaceholderText, byRole, byTestId, byText } from '~sonar-aligned/helpers/testSelector'; import BranchesServiceMock from '../../api/mocks/BranchesServiceMock'; import ComponentsServiceMock from '../../api/mocks/ComponentsServiceMock'; import IssuesServiceMock from '../../api/mocks/IssuesServiceMock'; @@ -27,7 +28,6 @@ import UsersServiceMock from '../../api/mocks/UsersServiceMock'; import { mockComponent } from '../../helpers/mocks/component'; import { mockCurrentUser } from '../../helpers/testMocks'; import { renderApp, renderAppWithComponentContext } from '../../helpers/testReactTestingUtils'; -import { byPlaceholderText, byRole, byTestId, byText } from '../../helpers/testSelector'; import { CleanCodeAttributeCategory, SoftwareImpactSeverity, diff --git a/server/sonar-web/src/main/js/apps/marketplace/__tests__/MarketplaceApp-it.tsx b/server/sonar-web/src/main/js/apps/marketplace/__tests__/MarketplaceApp-it.tsx index 26a952d8927..dbcea4e86c9 100644 --- a/server/sonar-web/src/main/js/apps/marketplace/__tests__/MarketplaceApp-it.tsx +++ b/server/sonar-web/src/main/js/apps/marketplace/__tests__/MarketplaceApp-it.tsx @@ -19,13 +19,13 @@ */ import userEvent from '@testing-library/user-event'; import React, { useState } from 'react'; +import { byRole, byText } from '~sonar-aligned/helpers/testSelector'; import { NavigationServiceMock } from '../../../api/mocks/NavigationServiceMock'; import PluginsServiceMock from '../../../api/mocks/PluginsServiceMock'; import SettingsServiceMock from '../../../api/mocks/SettingsServiceMock'; import AdminContext from '../../../app/components/AdminContext'; import { mockAppState } from '../../../helpers/testMocks'; import { renderApp } from '../../../helpers/testReactTestingUtils'; -import { byRole, byText } from '../../../helpers/testSelector'; import { AppState } from '../../../types/appstate'; import { EditionKey } from '../../../types/editions'; import { PendingPluginResult } from '../../../types/plugins'; diff --git a/server/sonar-web/src/main/js/apps/overview/branches/__tests__/BranchOverview-it.tsx b/server/sonar-web/src/main/js/apps/overview/branches/__tests__/BranchOverview-it.tsx index 12a11855460..8c996f697c9 100644 --- a/server/sonar-web/src/main/js/apps/overview/branches/__tests__/BranchOverview-it.tsx +++ b/server/sonar-web/src/main/js/apps/overview/branches/__tests__/BranchOverview-it.tsx @@ -19,6 +19,7 @@ */ import { screen, waitFor } from '@testing-library/react'; import * as React from 'react'; +import { byRole, byText } from '~sonar-aligned/helpers/testSelector'; import { ComponentQualifier } from '~sonar-aligned/types/component'; import { MetricKey } from '~sonar-aligned/types/metrics'; import AlmSettingsServiceMock from '../../../../api/mocks/AlmSettingsServiceMock'; @@ -39,7 +40,6 @@ import { mockAnalysis, mockAnalysisEvent } from '../../../../helpers/mocks/proje import { mockQualityGateProjectStatus } from '../../../../helpers/mocks/quality-gates'; import { mockLoggedInUser, mockMeasure, mockPaging } from '../../../../helpers/testMocks'; import { renderComponent } from '../../../../helpers/testReactTestingUtils'; -import { byRole, byText } from '../../../../helpers/testSelector'; import { SoftwareImpactSeverity, SoftwareQuality } from '../../../../types/clean-code-taxonomy'; import { ProjectAnalysisEventCategory } from '../../../../types/project-activity'; import { CaycStatus } from '../../../../types/types'; diff --git a/server/sonar-web/src/main/js/apps/overview/branches/__tests__/QualityGatePanelSection-test.tsx b/server/sonar-web/src/main/js/apps/overview/branches/__tests__/QualityGatePanelSection-test.tsx index 7363d813328..d0820d64bb6 100644 --- a/server/sonar-web/src/main/js/apps/overview/branches/__tests__/QualityGatePanelSection-test.tsx +++ b/server/sonar-web/src/main/js/apps/overview/branches/__tests__/QualityGatePanelSection-test.tsx @@ -19,13 +19,13 @@ */ import { screen } from '@testing-library/react'; import * as React from 'react'; +import { byRole } from '~sonar-aligned/helpers/testSelector'; import { Status } from '~sonar-aligned/types/common'; import { MetricKey } from '~sonar-aligned/types/metrics'; import CurrentUserContextProvider from '../../../../app/components/current-user/CurrentUserContextProvider'; import { mockQualityGate, mockQualityGateStatus } from '../../../../helpers/mocks/quality-gates'; import { mockLoggedInUser } from '../../../../helpers/testMocks'; import { renderComponent } from '../../../../helpers/testReactTestingUtils'; -import { byRole } from '../../../../helpers/testSelector'; import { CaycStatus } from '../../../../types/types'; import { CurrentUser, NoticeType } from '../../../../types/users'; import QualityGatePanelSection, { QualityGatePanelSectionProps } from '../QualityGatePanelSection'; diff --git a/server/sonar-web/src/main/js/apps/overview/branches/test-utils.ts b/server/sonar-web/src/main/js/apps/overview/branches/test-utils.ts index 95ff924cc0d..d9832064480 100644 --- a/server/sonar-web/src/main/js/apps/overview/branches/test-utils.ts +++ b/server/sonar-web/src/main/js/apps/overview/branches/test-utils.ts @@ -18,7 +18,7 @@ * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ import userEvent from '@testing-library/user-event'; -import { byLabelText, byRole, byTestId, byText } from '../../../helpers/testSelector'; +import { byLabelText, byRole, byTestId, byText } from '~sonar-aligned/helpers/testSelector'; import { SoftwareImpactMeasureData, SoftwareImpactSeverity, diff --git a/server/sonar-web/src/main/js/apps/overview/pullRequests/__tests__/BranchQualityGate-it.tsx b/server/sonar-web/src/main/js/apps/overview/pullRequests/__tests__/BranchQualityGate-it.tsx index ecde065a0a0..76ab1f2ddd3 100644 --- a/server/sonar-web/src/main/js/apps/overview/pullRequests/__tests__/BranchQualityGate-it.tsx +++ b/server/sonar-web/src/main/js/apps/overview/pullRequests/__tests__/BranchQualityGate-it.tsx @@ -18,13 +18,13 @@ * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ import * as React from 'react'; +import { byLabelText, byRole } from '~sonar-aligned/helpers/testSelector'; import { MetricKey, MetricType } from '~sonar-aligned/types/metrics'; import { mockPullRequest } from '../../../../helpers/mocks/branch-like'; import { mockComponent } from '../../../../helpers/mocks/component'; import { mockQualityGateStatusConditionEnhanced } from '../../../../helpers/mocks/quality-gates'; import { mockMeasureEnhanced, mockMetric } from '../../../../helpers/testMocks'; import { renderComponent } from '../../../../helpers/testReactTestingUtils'; -import { byLabelText, byRole } from '../../../../helpers/testSelector'; import { FCProps } from '../../../../types/misc'; import { Status } from '../../utils'; import BranchQualityGate from '../BranchQualityGate'; diff --git a/server/sonar-web/src/main/js/apps/overview/pullRequests/__tests__/PullRequestOverview-it.tsx b/server/sonar-web/src/main/js/apps/overview/pullRequests/__tests__/PullRequestOverview-it.tsx index 959e5d274aa..44478340b69 100644 --- a/server/sonar-web/src/main/js/apps/overview/pullRequests/__tests__/PullRequestOverview-it.tsx +++ b/server/sonar-web/src/main/js/apps/overview/pullRequests/__tests__/PullRequestOverview-it.tsx @@ -20,6 +20,7 @@ import { screen, waitFor } from '@testing-library/react'; import userEvent from '@testing-library/user-event'; import * as React from 'react'; +import { byLabelText, byRole } from '~sonar-aligned/helpers/testSelector'; import { ComponentQualifier } from '~sonar-aligned/types/component'; import { MetricKey, MetricType } from '~sonar-aligned/types/metrics'; import BranchesServiceMock from '../../../../api/mocks/BranchesServiceMock'; @@ -33,7 +34,6 @@ import { } from '../../../../helpers/mocks/quality-gates'; import { mockLoggedInUser, mockMeasure, mockMetric } from '../../../../helpers/testMocks'; import { renderComponent } from '../../../../helpers/testReactTestingUtils'; -import { byLabelText, byRole } from '../../../../helpers/testSelector'; import { ComponentPropsType } from '../../../../helpers/testUtils'; import { CaycStatus } from '../../../../types/types'; import { NoticeType } from '../../../../types/users'; diff --git a/server/sonar-web/src/main/js/apps/permission-templates/components/__tests__/PermissionTemplatesApp-it.tsx b/server/sonar-web/src/main/js/apps/permission-templates/components/__tests__/PermissionTemplatesApp-it.tsx index 2b16b970fb2..deddf695f5b 100644 --- a/server/sonar-web/src/main/js/apps/permission-templates/components/__tests__/PermissionTemplatesApp-it.tsx +++ b/server/sonar-web/src/main/js/apps/permission-templates/components/__tests__/PermissionTemplatesApp-it.tsx @@ -21,6 +21,7 @@ import { screen, waitFor, within } from '@testing-library/react'; import userEvent from '@testing-library/user-event'; import { UserEvent } from '@testing-library/user-event/dist/types/setup/setup'; import { uniq } from 'lodash'; +import { byRole, byText } from '~sonar-aligned/helpers/testSelector'; import { ComponentQualifier } from '~sonar-aligned/types/component'; import GithubProvisioningServiceMock from '../../../../api/mocks/GithubProvisioningServiceMock'; import PermissionsServiceMock from '../../../../api/mocks/PermissionsServiceMock'; @@ -28,7 +29,6 @@ import { mockPermissionGroup, mockPermissionUser } from '../../../../helpers/moc import { PERMISSIONS_ORDER_FOR_PROJECT_TEMPLATE } from '../../../../helpers/permissions'; import { mockAppState } from '../../../../helpers/testMocks'; import { renderAppWithAdminContext } from '../../../../helpers/testReactTestingUtils'; -import { byRole, byText } from '../../../../helpers/testSelector'; import { Feature } from '../../../../types/features'; import { Permissions } from '../../../../types/permissions'; import { PermissionGroup, PermissionUser } from '../../../../types/types'; diff --git a/server/sonar-web/src/main/js/apps/permissions/test-utils.ts b/server/sonar-web/src/main/js/apps/permissions/test-utils.ts index d382ec9e14d..f2adfc57989 100644 --- a/server/sonar-web/src/main/js/apps/permissions/test-utils.ts +++ b/server/sonar-web/src/main/js/apps/permissions/test-utils.ts @@ -20,8 +20,8 @@ import { waitFor } from '@testing-library/react'; import { UserEvent } from '@testing-library/user-event/dist/types/setup/setup'; import selectEvent from 'react-select-event'; +import { byRole, byText } from '~sonar-aligned/helpers/testSelector'; import { Visibility } from '~sonar-aligned/types/component'; -import { byRole, byText } from '../../helpers/testSelector'; import { Permissions } from '../../types/permissions'; export function getPageObject(user: UserEvent) { diff --git a/server/sonar-web/src/main/js/apps/projectActivity/components/__tests__/ProjectActivityApp-it.tsx b/server/sonar-web/src/main/js/apps/projectActivity/components/__tests__/ProjectActivityApp-it.tsx index c9201c16af2..431f9553c24 100644 --- a/server/sonar-web/src/main/js/apps/projectActivity/components/__tests__/ProjectActivityApp-it.tsx +++ b/server/sonar-web/src/main/js/apps/projectActivity/components/__tests__/ProjectActivityApp-it.tsx @@ -22,6 +22,7 @@ import userEvent from '@testing-library/user-event'; import { keyBy, times } from 'lodash'; import React from 'react'; import { Route } from 'react-router-dom'; +import { byLabelText, byRole, byTestId, byText } from '~sonar-aligned/helpers/testSelector'; import { ComponentQualifier } from '~sonar-aligned/types/component'; import { MetricKey, MetricType } from '~sonar-aligned/types/metrics'; import ApplicationServiceMock from '../../../../api/mocks/ApplicationServiceMock'; @@ -39,7 +40,6 @@ import { import { get } from '../../../../helpers/storage'; import { mockMetric } from '../../../../helpers/testMocks'; import { renderAppWithComponentContext } from '../../../../helpers/testReactTestingUtils'; -import { byLabelText, byRole, byTestId, byText } from '../../../../helpers/testSelector'; import { ApplicationAnalysisEventCategory, GraphType, diff --git a/server/sonar-web/src/main/js/apps/projectBranches/__tests__/ProjectBranchesApp-it.tsx b/server/sonar-web/src/main/js/apps/projectBranches/__tests__/ProjectBranchesApp-it.tsx index 61de3c6ad07..48d55b4acdf 100644 --- a/server/sonar-web/src/main/js/apps/projectBranches/__tests__/ProjectBranchesApp-it.tsx +++ b/server/sonar-web/src/main/js/apps/projectBranches/__tests__/ProjectBranchesApp-it.tsx @@ -20,13 +20,13 @@ import { within } from '@testing-library/react'; import userEvent from '@testing-library/user-event'; import React from 'react'; +import { byLabelText, byRole } from '~sonar-aligned/helpers/testSelector'; import BranchesServiceMock from '../../../api/mocks/BranchesServiceMock'; import SettingsServiceMock from '../../../api/mocks/SettingsServiceMock'; import { ComponentContext } from '../../../app/components/componentContext/ComponentContext'; import { mockComponent } from '../../../helpers/mocks/component'; import { mockAppState } from '../../../helpers/testMocks'; import { renderComponent } from '../../../helpers/testReactTestingUtils'; -import { byLabelText, byRole } from '../../../helpers/testSelector'; import { AppState } from '../../../types/appstate'; import { Feature } from '../../../types/features'; import { SettingsKey } from '../../../types/settings'; diff --git a/server/sonar-web/src/main/js/apps/projectDeletion/__tests__/ProjectDeletionApp-it.tsx b/server/sonar-web/src/main/js/apps/projectDeletion/__tests__/ProjectDeletionApp-it.tsx index d783ed1ea2c..4b0bc4294b4 100644 --- a/server/sonar-web/src/main/js/apps/projectDeletion/__tests__/ProjectDeletionApp-it.tsx +++ b/server/sonar-web/src/main/js/apps/projectDeletion/__tests__/ProjectDeletionApp-it.tsx @@ -19,13 +19,13 @@ */ import userEvent from '@testing-library/user-event'; import * as React from 'react'; +import { byRole, byText } from '~sonar-aligned/helpers/testSelector'; import { ComponentQualifier } from '~sonar-aligned/types/component'; import { deleteApplication } from '../../../api/application'; import { deletePortfolio, deleteProject } from '../../../api/project-management'; import { ComponentContext } from '../../../app/components/componentContext/ComponentContext'; import { mockComponent } from '../../../helpers/mocks/component'; import { renderApp } from '../../../helpers/testReactTestingUtils'; -import { byRole, byText } from '../../../helpers/testSelector'; import { ComponentContextShape } from '../../../types/component'; import { Component } from '../../../types/types'; import App from '../App'; diff --git a/server/sonar-web/src/main/js/apps/projectDump/__tests__/ProjectDumpApp-it.tsx b/server/sonar-web/src/main/js/apps/projectDump/__tests__/ProjectDumpApp-it.tsx index c5cd470108b..f289cbbb866 100644 --- a/server/sonar-web/src/main/js/apps/projectDump/__tests__/ProjectDumpApp-it.tsx +++ b/server/sonar-web/src/main/js/apps/projectDump/__tests__/ProjectDumpApp-it.tsx @@ -19,11 +19,11 @@ */ import { act, screen } from '@testing-library/react'; import userEvent from '@testing-library/user-event'; +import { byRole, byText } from '~sonar-aligned/helpers/testSelector'; import ComputeEngineServiceMock from '../../../api/mocks/ComputeEngineServiceMock'; import { ProjectDumpServiceMock } from '../../../api/mocks/ProjectDumpServiceMock'; import { mockComponent } from '../../../helpers/mocks/component'; import { renderAppWithComponentContext } from '../../../helpers/testReactTestingUtils'; -import { byRole, byText } from '../../../helpers/testSelector'; import { Feature } from '../../../types/features'; import { TaskStatuses, TaskTypes } from '../../../types/tasks'; import routes from '../routes'; diff --git a/server/sonar-web/src/main/js/apps/projectInformation/__tests__/ProjectInformationApp-it.tsx b/server/sonar-web/src/main/js/apps/projectInformation/__tests__/ProjectInformationApp-it.tsx index 7349466c79a..14c59da187d 100644 --- a/server/sonar-web/src/main/js/apps/projectInformation/__tests__/ProjectInformationApp-it.tsx +++ b/server/sonar-web/src/main/js/apps/projectInformation/__tests__/ProjectInformationApp-it.tsx @@ -18,6 +18,7 @@ * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ import { screen } from '@testing-library/react'; +import { byRole } from '~sonar-aligned/helpers/testSelector'; import { ComponentQualifier, Visibility } from '~sonar-aligned/types/component'; import { MetricKey } from '~sonar-aligned/types/metrics'; import BranchesServiceMock from '../../../api/mocks/BranchesServiceMock'; @@ -30,7 +31,6 @@ import ProjectLinksServiceMock from '../../../api/mocks/ProjectLinksServiceMock' import { mockComponent } from '../../../helpers/mocks/component'; import { mockCurrentUser, mockLoggedInUser, mockMeasure } from '../../../helpers/testMocks'; import { renderAppWithComponentContext } from '../../../helpers/testReactTestingUtils'; -import { byRole } from '../../../helpers/testSelector'; import { Component } from '../../../types/types'; import { CurrentUser } from '../../../types/users'; import routes from '../routes'; diff --git a/server/sonar-web/src/main/js/apps/projectInformation/projectRegulatoryReport/__tests__/RegulatoryReport-it.tsx b/server/sonar-web/src/main/js/apps/projectInformation/projectRegulatoryReport/__tests__/RegulatoryReport-it.tsx index c21631e8c35..6384b2547bc 100644 --- a/server/sonar-web/src/main/js/apps/projectInformation/projectRegulatoryReport/__tests__/RegulatoryReport-it.tsx +++ b/server/sonar-web/src/main/js/apps/projectInformation/projectRegulatoryReport/__tests__/RegulatoryReport-it.tsx @@ -20,10 +20,10 @@ import { screen } from '@testing-library/react'; import userEvent from '@testing-library/user-event'; import * as React from 'react'; +import { byRole, byText } from '~sonar-aligned/helpers/testSelector'; import BranchesServiceMock from '../../../../api/mocks/BranchesServiceMock'; import { mockBranch, mockMainBranch } from '../../../../helpers/mocks/branch-like'; import { renderComponent } from '../../../../helpers/testReactTestingUtils'; -import { byRole, byText } from '../../../../helpers/testSelector'; import { BranchLike } from '../../../../types/branch-like'; import RegulatoryReport from '../RegulatoryReport'; diff --git a/server/sonar-web/src/main/js/apps/projectKey/__tests__/ProjectKeyApp-it.tsx b/server/sonar-web/src/main/js/apps/projectKey/__tests__/ProjectKeyApp-it.tsx index 5cc1cf22da5..a3b25328532 100644 --- a/server/sonar-web/src/main/js/apps/projectKey/__tests__/ProjectKeyApp-it.tsx +++ b/server/sonar-web/src/main/js/apps/projectKey/__tests__/ProjectKeyApp-it.tsx @@ -22,9 +22,9 @@ import userEvent from '@testing-library/user-event'; import { last } from 'lodash'; import React from 'react'; import { Route } from 'react-router-dom'; +import { byRole } from '~sonar-aligned/helpers/testSelector'; import ComponentsServiceMock from '../../../api/mocks/ComponentsServiceMock'; import { renderAppWithComponentContext } from '../../../helpers/testReactTestingUtils'; -import { byRole } from '../../../helpers/testSelector'; import ProjectKeyApp from '../ProjectKeyApp'; const componentsMock = new ComponentsServiceMock(); diff --git a/server/sonar-web/src/main/js/apps/projectLinks/__tests__/ProjectLinksApp-it.tsx b/server/sonar-web/src/main/js/apps/projectLinks/__tests__/ProjectLinksApp-it.tsx index 1569a9aeac7..2faf16836ee 100644 --- a/server/sonar-web/src/main/js/apps/projectLinks/__tests__/ProjectLinksApp-it.tsx +++ b/server/sonar-web/src/main/js/apps/projectLinks/__tests__/ProjectLinksApp-it.tsx @@ -21,10 +21,10 @@ import userEvent from '@testing-library/user-event'; import { last } from 'lodash'; import React from 'react'; import { Route } from 'react-router-dom'; +import { byRole, byText } from '~sonar-aligned/helpers/testSelector'; import ProjectLinksServiceMock from '../../../api/mocks/ProjectLinksServiceMock'; import { mockComponent } from '../../../helpers/mocks/component'; import { renderAppWithComponentContext } from '../../../helpers/testReactTestingUtils'; -import { byRole, byText } from '../../../helpers/testSelector'; import ProjectLinksApp from '../ProjectLinksApp'; const componentsMock = new ProjectLinksServiceMock(); diff --git a/server/sonar-web/src/main/js/apps/projectNewCode/components/__tests__/ProjectNewCodeDefinitionApp-it.tsx b/server/sonar-web/src/main/js/apps/projectNewCode/components/__tests__/ProjectNewCodeDefinitionApp-it.tsx index 9e38c437191..0e5888963cd 100644 --- a/server/sonar-web/src/main/js/apps/projectNewCode/components/__tests__/ProjectNewCodeDefinitionApp-it.tsx +++ b/server/sonar-web/src/main/js/apps/projectNewCode/components/__tests__/ProjectNewCodeDefinitionApp-it.tsx @@ -20,6 +20,7 @@ import userEvent from '@testing-library/user-event'; import { last } from 'lodash'; import selectEvent from 'react-select-event'; +import { byLabelText, byRole, byText } from '~sonar-aligned/helpers/testSelector'; import { MessageTypes } from '../../../../api/messages'; import BranchesServiceMock from '../../../../api/mocks/BranchesServiceMock'; import MessagesServiceMock from '../../../../api/mocks/MessagesServiceMock'; @@ -33,7 +34,6 @@ import { RenderContext, renderAppWithComponentContext, } from '../../../../helpers/testReactTestingUtils'; -import { byLabelText, byRole, byText } from '../../../../helpers/testSelector'; import { Feature } from '../../../../types/features'; import { NewCodeDefinitionType } from '../../../../types/new-code-definition'; import routes from '../../routes'; diff --git a/server/sonar-web/src/main/js/apps/projectQualityGate/__tests__/ProjectQualityGateApp-it.tsx b/server/sonar-web/src/main/js/apps/projectQualityGate/__tests__/ProjectQualityGateApp-it.tsx index dadd712217e..1daad90bad2 100644 --- a/server/sonar-web/src/main/js/apps/projectQualityGate/__tests__/ProjectQualityGateApp-it.tsx +++ b/server/sonar-web/src/main/js/apps/projectQualityGate/__tests__/ProjectQualityGateApp-it.tsx @@ -22,6 +22,7 @@ import { waitFor } from '@testing-library/react'; import userEvent from '@testing-library/user-event'; import { addGlobalErrorMessage, addGlobalSuccessMessage } from 'design-system'; import selectEvent from 'react-select-event'; +import { byRole, byText } from '~sonar-aligned/helpers/testSelector'; import { QualityGatesServiceMock } from '../../../api/mocks/QualityGatesServiceMock'; import handleRequiredAuthorization from '../../../app/utils/handleRequiredAuthorization'; import { mockComponent } from '../../../helpers/mocks/component'; @@ -29,7 +30,6 @@ import { RenderContext, renderAppWithComponentContext, } from '../../../helpers/testReactTestingUtils'; -import { byRole, byText } from '../../../helpers/testSelector'; import { Component } from '../../../types/types'; import routes from '../routes'; diff --git a/server/sonar-web/src/main/js/apps/projectQualityProfiles/__tests__/projectQualityProfilesApp-it.tsx b/server/sonar-web/src/main/js/apps/projectQualityProfiles/__tests__/projectQualityProfilesApp-it.tsx index 4e8d7d7bf8a..778d5ed87df 100644 --- a/server/sonar-web/src/main/js/apps/projectQualityProfiles/__tests__/projectQualityProfilesApp-it.tsx +++ b/server/sonar-web/src/main/js/apps/projectQualityProfiles/__tests__/projectQualityProfilesApp-it.tsx @@ -20,6 +20,7 @@ import userEvent from '@testing-library/user-event'; import { addGlobalSuccessMessage } from 'design-system'; import selectEvent from 'react-select-event'; +import { byLabelText, byRole, byText } from '~sonar-aligned/helpers/testSelector'; import { ProfileProject, associateProject, @@ -32,7 +33,6 @@ import { RenderContext, renderAppWithComponentContext, } from '../../../helpers/testReactTestingUtils'; -import { byLabelText, byRole, byText } from '../../../helpers/testSelector'; import { Component } from '../../../types/types'; import routes from '../routes'; diff --git a/server/sonar-web/src/main/js/apps/projects/components/__tests__/AllProjects-test.tsx b/server/sonar-web/src/main/js/apps/projects/components/__tests__/AllProjects-test.tsx index a9c64c430b2..7f9ad6e44d1 100644 --- a/server/sonar-web/src/main/js/apps/projects/components/__tests__/AllProjects-test.tsx +++ b/server/sonar-web/src/main/js/apps/projects/components/__tests__/AllProjects-test.tsx @@ -21,13 +21,13 @@ import { screen, within } from '@testing-library/react'; import userEvent from '@testing-library/user-event'; import * as React from 'react'; import { AutoSizerProps } from 'react-virtualized'; +import { byLabelText, byRole, byText } from '~sonar-aligned/helpers/testSelector'; import { ComponentQualifier } from '~sonar-aligned/types/component'; import { MetricKey } from '~sonar-aligned/types/metrics'; import { ProjectsServiceMock } from '../../../../api/mocks/ProjectsServiceMock'; import { save } from '../../../../helpers/storage'; import { mockAppState, mockLoggedInUser } from '../../../../helpers/testMocks'; import { renderAppRoutes } from '../../../../helpers/testReactTestingUtils'; -import { byLabelText, byRole, byText } from '../../../../helpers/testSelector'; import { Dict } from '../../../../types/types'; import projectRoutes from '../../routes'; import { LS_PROJECTS_SORT, LS_PROJECTS_VIEW } from '../AllProjects'; diff --git a/server/sonar-web/src/main/js/apps/projects/components/__tests__/CreateApplication-test.tsx b/server/sonar-web/src/main/js/apps/projects/components/__tests__/CreateApplication-test.tsx index a55e30a8593..033c6e6e33d 100644 --- a/server/sonar-web/src/main/js/apps/projects/components/__tests__/CreateApplication-test.tsx +++ b/server/sonar-web/src/main/js/apps/projects/components/__tests__/CreateApplication-test.tsx @@ -19,13 +19,13 @@ */ import userEvent from '@testing-library/user-event'; import * as React from 'react'; +import { byRole, byText } from '~sonar-aligned/helpers/testSelector'; import { queryToSearchString } from '~sonar-aligned/helpers/urls'; import { ComponentQualifier, Visibility } from '~sonar-aligned/types/component'; import { createApplication } from '../../../../api/application'; import { getComponentNavigation } from '../../../../api/navigation'; import { mockAppState, mockLoggedInUser, mockRouter } from '../../../../helpers/testMocks'; import { renderComponent } from '../../../../helpers/testReactTestingUtils'; -import { byRole, byText } from '../../../../helpers/testSelector'; import { FCProps } from '../../../../types/misc'; import { LoggedInUser } from '../../../../types/users'; import { ApplicationCreation } from '../ApplicationCreation'; diff --git a/server/sonar-web/src/main/js/apps/projects/components/__tests__/PageHeader-test.tsx b/server/sonar-web/src/main/js/apps/projects/components/__tests__/PageHeader-test.tsx index 9913d211aea..627e9be8c7a 100644 --- a/server/sonar-web/src/main/js/apps/projects/components/__tests__/PageHeader-test.tsx +++ b/server/sonar-web/src/main/js/apps/projects/components/__tests__/PageHeader-test.tsx @@ -19,12 +19,12 @@ */ import userEvent from '@testing-library/user-event'; import * as React from 'react'; +import { byLabelText, byRole, byText } from '~sonar-aligned/helpers/testSelector'; import { ComponentQualifier } from '~sonar-aligned/types/component'; import { getAlmSettings } from '../../../../api/alm-settings'; import CurrentUserContextProvider from '../../../../app/components/current-user/CurrentUserContextProvider'; import { mockAppState, mockCurrentUser, mockLoggedInUser } from '../../../../helpers/testMocks'; import { renderComponent } from '../../../../helpers/testReactTestingUtils'; -import { byLabelText, byRole, byText } from '../../../../helpers/testSelector'; import { AlmKeys } from '../../../../types/alm-settings'; import { FCProps } from '../../../../types/misc'; import { CurrentUser } from '../../../../types/users'; diff --git a/server/sonar-web/src/main/js/apps/projectsManagement/__tests__/ProjectManagementApp-it.tsx b/server/sonar-web/src/main/js/apps/projectsManagement/__tests__/ProjectManagementApp-it.tsx index cbf80bc1704..a891201ba51 100644 --- a/server/sonar-web/src/main/js/apps/projectsManagement/__tests__/ProjectManagementApp-it.tsx +++ b/server/sonar-web/src/main/js/apps/projectsManagement/__tests__/ProjectManagementApp-it.tsx @@ -20,6 +20,7 @@ import { screen, waitFor, within } from '@testing-library/react'; import userEvent from '@testing-library/user-event'; import selectEvent from 'react-select-event'; +import { byPlaceholderText, byRole, byText } from '~sonar-aligned/helpers/testSelector'; import { ComponentQualifier } from '~sonar-aligned/types/component'; import GithubProvisioningServiceMock from '../../../api/mocks/GithubProvisioningServiceMock'; import PermissionsServiceMock from '../../../api/mocks/PermissionsServiceMock'; @@ -29,7 +30,6 @@ import { mockComponent } from '../../../helpers/mocks/component'; import { mockProject } from '../../../helpers/mocks/projects'; import { mockAppState, mockCurrentUser } from '../../../helpers/testMocks'; import { RenderContext, renderAppWithAdminContext } from '../../../helpers/testReactTestingUtils'; -import { byPlaceholderText, byRole, byText } from '../../../helpers/testSelector'; import { AppState } from '../../../types/appstate'; import { Feature } from '../../../types/features'; import { Permissions } from '../../../types/permissions'; diff --git a/server/sonar-web/src/main/js/apps/quality-gates/components/__tests__/QualityGate-it.tsx b/server/sonar-web/src/main/js/apps/quality-gates/components/__tests__/QualityGate-it.tsx index 70486601dc6..2c5e6a5e0d9 100644 --- a/server/sonar-web/src/main/js/apps/quality-gates/components/__tests__/QualityGate-it.tsx +++ b/server/sonar-web/src/main/js/apps/quality-gates/components/__tests__/QualityGate-it.tsx @@ -20,13 +20,13 @@ import { screen, waitFor, within } from '@testing-library/react'; import userEvent from '@testing-library/user-event'; import selectEvent from 'react-select-event'; +import { byRole, byTestId } from '~sonar-aligned/helpers/testSelector'; import { QualityGatesServiceMock } from '../../../../api/mocks/QualityGatesServiceMock'; import UsersServiceMock from '../../../../api/mocks/UsersServiceMock'; import { searchProjects, searchUsers } from '../../../../api/quality-gates'; import { dismissNotice } from '../../../../api/users'; import { mockLoggedInUser } from '../../../../helpers/testMocks'; import { RenderContext, renderAppRoutes } from '../../../../helpers/testReactTestingUtils'; -import { byRole, byTestId } from '../../../../helpers/testSelector'; import { Feature } from '../../../../types/features'; import { CaycStatus } from '../../../../types/types'; import { NoticeType } from '../../../../types/users'; diff --git a/server/sonar-web/src/main/js/apps/quality-profiles/__tests__/QualityProfileApp-it.tsx b/server/sonar-web/src/main/js/apps/quality-profiles/__tests__/QualityProfileApp-it.tsx index b0370f8a7ed..886c95b6fde 100644 --- a/server/sonar-web/src/main/js/apps/quality-profiles/__tests__/QualityProfileApp-it.tsx +++ b/server/sonar-web/src/main/js/apps/quality-profiles/__tests__/QualityProfileApp-it.tsx @@ -20,9 +20,9 @@ import { screen, waitFor } from '@testing-library/react'; import userEvent from '@testing-library/user-event'; import selectEvent from 'react-select-event'; +import { byRole, byText } from '~sonar-aligned/helpers/testSelector'; import QualityProfilesServiceMock from '../../../api/mocks/QualityProfilesServiceMock'; import { renderAppRoutes } from '../../../helpers/testReactTestingUtils'; -import { byRole, byText } from '../../../helpers/testSelector'; import routes from '../routes'; jest.mock('../../../api/quality-profiles'); diff --git a/server/sonar-web/src/main/js/apps/quality-profiles/__tests__/QualityProfilesApp-it.tsx b/server/sonar-web/src/main/js/apps/quality-profiles/__tests__/QualityProfilesApp-it.tsx index 891a21ecfe3..13a165a85af 100644 --- a/server/sonar-web/src/main/js/apps/quality-profiles/__tests__/QualityProfilesApp-it.tsx +++ b/server/sonar-web/src/main/js/apps/quality-profiles/__tests__/QualityProfilesApp-it.tsx @@ -20,11 +20,11 @@ import { getByText, screen } from '@testing-library/react'; import userEvent from '@testing-library/user-event'; import selectEvent from 'react-select-event'; +import { byRole, byText } from '~sonar-aligned/helpers/testSelector'; import QualityProfilesServiceMock from '../../../api/mocks/QualityProfilesServiceMock'; import SettingsServiceMock from '../../../api/mocks/SettingsServiceMock'; import { mockPaging, mockRule } from '../../../helpers/testMocks'; import { renderAppRoutes } from '../../../helpers/testReactTestingUtils'; -import { byRole, byText } from '../../../helpers/testSelector'; import routes from '../routes'; jest.mock('../../../api/quality-profiles'); diff --git a/server/sonar-web/src/main/js/apps/quality-profiles/changelog/__tests__/ChangelogContainer-it.tsx b/server/sonar-web/src/main/js/apps/quality-profiles/changelog/__tests__/ChangelogContainer-it.tsx index b3acb5f8e6e..761685cb9f7 100644 --- a/server/sonar-web/src/main/js/apps/quality-profiles/changelog/__tests__/ChangelogContainer-it.tsx +++ b/server/sonar-web/src/main/js/apps/quality-profiles/changelog/__tests__/ChangelogContainer-it.tsx @@ -19,10 +19,10 @@ */ import { screen } from '@testing-library/react'; import userEvent from '@testing-library/user-event'; +import { byRole, byText } from '~sonar-aligned/helpers/testSelector'; import QualityProfilesServiceMock from '../../../../api/mocks/QualityProfilesServiceMock'; import { mockQualityProfileChangelogEvent } from '../../../../helpers/testMocks'; import { renderAppRoutes } from '../../../../helpers/testReactTestingUtils'; -import { byRole, byText } from '../../../../helpers/testSelector'; import routes from '../../routes'; jest.mock('../../../../api/quality-profiles'); diff --git a/server/sonar-web/src/main/js/apps/security-hotspots/__tests__/SecurityHotspotsApp-it.tsx b/server/sonar-web/src/main/js/apps/security-hotspots/__tests__/SecurityHotspotsApp-it.tsx index 1db2b03ae9c..29ef9cc5855 100644 --- a/server/sonar-web/src/main/js/apps/security-hotspots/__tests__/SecurityHotspotsApp-it.tsx +++ b/server/sonar-web/src/main/js/apps/security-hotspots/__tests__/SecurityHotspotsApp-it.tsx @@ -21,6 +21,7 @@ import { screen, waitFor } from '@testing-library/react'; import userEvent from '@testing-library/user-event'; import React from 'react'; import { Route } from 'react-router-dom'; +import { byDisplayValue, byRole, byTestId, byText } from '~sonar-aligned/helpers/testSelector'; import { MetricKey } from '~sonar-aligned/types/metrics'; import BranchesServiceMock from '../../../api/mocks/BranchesServiceMock'; import CodingRulesServiceMock from '../../../api/mocks/CodingRulesServiceMock'; @@ -32,7 +33,6 @@ import { openHotspot, probeSonarLintServers } from '../../../helpers/sonarlint'; import { get, save } from '../../../helpers/storage'; import { mockLoggedInUser } from '../../../helpers/testMocks'; import { renderAppWithComponentContext } from '../../../helpers/testReactTestingUtils'; -import { byDisplayValue, byRole, byTestId, byText } from '../../../helpers/testSelector'; import { ComponentContextShape } from '../../../types/component'; import SecurityHotspotsApp from '../SecurityHotspotsApp'; import useStickyDetection from '../hooks/useStickyDetection'; diff --git a/server/sonar-web/src/main/js/apps/security-hotspots/hooks/__tests__/useStickyDetection-test.tsx b/server/sonar-web/src/main/js/apps/security-hotspots/hooks/__tests__/useStickyDetection-test.tsx index 13b00a09325..01b606f3a1b 100644 --- a/server/sonar-web/src/main/js/apps/security-hotspots/hooks/__tests__/useStickyDetection-test.tsx +++ b/server/sonar-web/src/main/js/apps/security-hotspots/hooks/__tests__/useStickyDetection-test.tsx @@ -19,8 +19,8 @@ */ import { act } from '@testing-library/react'; import React from 'react'; +import { byRole } from '~sonar-aligned/helpers/testSelector'; import { renderComponent } from '../../../../helpers/testReactTestingUtils'; -import { byRole } from '../../../../helpers/testSelector'; import { mockIntersectionObserver } from '../../../../helpers/testUtils'; import useStickyDetection from '../useStickyDetection'; diff --git a/server/sonar-web/src/main/js/apps/sessions/components/__tests__/Login-it.tsx b/server/sonar-web/src/main/js/apps/sessions/components/__tests__/Login-it.tsx index cf883832d32..8a2c2a8d187 100644 --- a/server/sonar-web/src/main/js/apps/sessions/components/__tests__/Login-it.tsx +++ b/server/sonar-web/src/main/js/apps/sessions/components/__tests__/Login-it.tsx @@ -22,12 +22,12 @@ import { waitFor } from '@testing-library/react'; import userEvent from '@testing-library/user-event'; import { addGlobalErrorMessage } from 'design-system'; import * as React from 'react'; +import { byLabelText, byRole, byText } from '~sonar-aligned/helpers/testSelector'; import { getLoginMessage } from '../../../../api/settings'; import { getIdentityProviders } from '../../../../api/users'; import { getBaseUrl } from '../../../../helpers/system'; import { mockLocation } from '../../../../helpers/testMocks'; import { renderComponent } from '../../../../helpers/testReactTestingUtils'; -import { byLabelText, byRole, byText } from '../../../../helpers/testSelector'; import { LoginContainer } from '../LoginContainer'; jest.mock('../../../../helpers/system', () => ({ diff --git a/server/sonar-web/src/main/js/apps/settings/components/__tests__/AnalysisScope-test.tsx b/server/sonar-web/src/main/js/apps/settings/components/__tests__/AnalysisScope-test.tsx index 1f7111011d9..81c54d72b62 100644 --- a/server/sonar-web/src/main/js/apps/settings/components/__tests__/AnalysisScope-test.tsx +++ b/server/sonar-web/src/main/js/apps/settings/components/__tests__/AnalysisScope-test.tsx @@ -19,12 +19,12 @@ */ import { uniq } from 'lodash'; import * as React from 'react'; +import { byRole, byText } from '~sonar-aligned/helpers/testSelector'; import SettingsServiceMock, { DEFAULT_DEFINITIONS_MOCK, } from '../../../../api/mocks/SettingsServiceMock'; import { mockComponent } from '../../../../helpers/mocks/component'; import { renderComponent } from '../../../../helpers/testReactTestingUtils'; -import { byRole, byText } from '../../../../helpers/testSelector'; import { AdditionalCategoryComponentProps } from '../AdditionalCategories'; import { AnalysisScope } from '../AnalysisScope'; diff --git a/server/sonar-web/src/main/js/apps/settings/components/__tests__/Definition-it.tsx b/server/sonar-web/src/main/js/apps/settings/components/__tests__/Definition-it.tsx index 37b3a159b5b..6ed6ce16f33 100644 --- a/server/sonar-web/src/main/js/apps/settings/components/__tests__/Definition-it.tsx +++ b/server/sonar-web/src/main/js/apps/settings/components/__tests__/Definition-it.tsx @@ -22,13 +22,13 @@ import userEvent from '@testing-library/user-event'; import { last } from 'lodash'; import React from 'react'; import selectEvent from 'react-select-event'; +import { byLabelText, byRole, byText } from '~sonar-aligned/helpers/testSelector'; import SettingsServiceMock, { DEFAULT_DEFINITIONS_MOCK, } from '../../../../api/mocks/SettingsServiceMock'; import { mockComponent } from '../../../../helpers/mocks/component'; import { mockDefinition } from '../../../../helpers/mocks/settings'; import { renderComponent } from '../../../../helpers/testReactTestingUtils'; -import { byLabelText, byRole, byText } from '../../../../helpers/testSelector'; import { ExtendedSettingDefinition, SettingType, SettingValue } from '../../../../types/settings'; import { Component } from '../../../../types/types'; import Definition from '../Definition'; diff --git a/server/sonar-web/src/main/js/apps/settings/components/__tests__/Languages-it.tsx b/server/sonar-web/src/main/js/apps/settings/components/__tests__/Languages-it.tsx index 4a662781d81..80e02f2f0af 100644 --- a/server/sonar-web/src/main/js/apps/settings/components/__tests__/Languages-it.tsx +++ b/server/sonar-web/src/main/js/apps/settings/components/__tests__/Languages-it.tsx @@ -21,12 +21,12 @@ import { screen } from '@testing-library/react'; import userEvent from '@testing-library/user-event'; import { last } from 'lodash'; import React from 'react'; +import { byRole, byText } from '~sonar-aligned/helpers/testSelector'; import SettingsServiceMock, { DEFAULT_DEFINITIONS_MOCK, } from '../../../../api/mocks/SettingsServiceMock'; import { mockComponent } from '../../../../helpers/mocks/component'; import { renderApp } from '../../../../helpers/testReactTestingUtils'; -import { byRole, byText } from '../../../../helpers/testSelector'; import { AdditionalCategoryComponentProps } from '../AdditionalCategories'; import Languages from '../Languages'; diff --git a/server/sonar-web/src/main/js/apps/settings/components/__tests__/NewCodeDefinition-it.tsx b/server/sonar-web/src/main/js/apps/settings/components/__tests__/NewCodeDefinition-it.tsx index 0b390c18361..e57acdfe1d8 100644 --- a/server/sonar-web/src/main/js/apps/settings/components/__tests__/NewCodeDefinition-it.tsx +++ b/server/sonar-web/src/main/js/apps/settings/components/__tests__/NewCodeDefinition-it.tsx @@ -19,11 +19,11 @@ */ import userEvent from '@testing-library/user-event'; import * as React from 'react'; +import { byRole, byText } from '~sonar-aligned/helpers/testSelector'; import { MessageTypes } from '../../../../api/messages'; import MessagesServiceMock from '../../../../api/mocks/MessagesServiceMock'; import NewCodeDefinitionServiceMock from '../../../../api/mocks/NewCodeDefinitionServiceMock'; import { renderComponent } from '../../../../helpers/testReactTestingUtils'; -import { byRole, byText } from '../../../../helpers/testSelector'; import { NewCodeDefinitionType } from '../../../../types/new-code-definition'; import NewCodeDefinition from '../NewCodeDefinition'; diff --git a/server/sonar-web/src/main/js/apps/settings/components/__tests__/SettingsApp-it.tsx b/server/sonar-web/src/main/js/apps/settings/components/__tests__/SettingsApp-it.tsx index c666234f5a7..74dfe306819 100644 --- a/server/sonar-web/src/main/js/apps/settings/components/__tests__/SettingsApp-it.tsx +++ b/server/sonar-web/src/main/js/apps/settings/components/__tests__/SettingsApp-it.tsx @@ -22,6 +22,7 @@ import userEvent from '@testing-library/user-event'; import React from 'react'; import { Route } from 'react-router-dom'; import selectEvent from 'react-select-event'; +import { byRole } from '~sonar-aligned/helpers/testSelector'; import SettingsServiceMock from '../../../../api/mocks/SettingsServiceMock'; import { KeyboardKeys } from '../../../../helpers/keycodes'; import { mockComponent } from '../../../../helpers/mocks/component'; @@ -30,7 +31,6 @@ import { renderAppWithComponentContext, RenderContext, } from '../../../../helpers/testReactTestingUtils'; -import { byRole } from '../../../../helpers/testSelector'; import { Feature } from '../../../../types/features'; import { Component } from '../../../../types/types'; import routes from '../../routes'; diff --git a/server/sonar-web/src/main/js/apps/settings/components/almIntegration/__tests__/AlmBindingDefinitionForm-test.tsx b/server/sonar-web/src/main/js/apps/settings/components/almIntegration/__tests__/AlmBindingDefinitionForm-test.tsx index abd32a414a6..04a868fb9c7 100644 --- a/server/sonar-web/src/main/js/apps/settings/components/almIntegration/__tests__/AlmBindingDefinitionForm-test.tsx +++ b/server/sonar-web/src/main/js/apps/settings/components/almIntegration/__tests__/AlmBindingDefinitionForm-test.tsx @@ -19,9 +19,9 @@ */ import userEvent from '@testing-library/user-event'; import React from 'react'; +import { byLabelText, byRole, byText } from '~sonar-aligned/helpers/testSelector'; import AlmSettingsServiceMock from '../../../../../api/mocks/AlmSettingsServiceMock'; import { renderComponent } from '../../../../../helpers/testReactTestingUtils'; -import { byLabelText, byRole, byText } from '../../../../../helpers/testSelector'; import { AlmKeys } from '../../../../../types/alm-settings'; import AlmBindingDefinitionForm, { AlmBindingDefinitionFormProps, diff --git a/server/sonar-web/src/main/js/apps/settings/components/almIntegration/__tests__/AlmIntegration-it.tsx b/server/sonar-web/src/main/js/apps/settings/components/almIntegration/__tests__/AlmIntegration-it.tsx index 69a1a625434..3278608a84c 100644 --- a/server/sonar-web/src/main/js/apps/settings/components/almIntegration/__tests__/AlmIntegration-it.tsx +++ b/server/sonar-web/src/main/js/apps/settings/components/almIntegration/__tests__/AlmIntegration-it.tsx @@ -20,11 +20,11 @@ import { screen } from '@testing-library/react'; import userEvent from '@testing-library/user-event'; import React from 'react'; +import { byRole, byText } from '~sonar-aligned/helpers/testSelector'; import AlmSettingsServiceMock from '../../../../../api/mocks/AlmSettingsServiceMock'; import SettingsServiceMock from '../../../../../api/mocks/SettingsServiceMock'; import { AvailableFeaturesContext } from '../../../../../app/components/available-features/AvailableFeaturesContext'; import { renderComponent } from '../../../../../helpers/testReactTestingUtils'; -import { byRole, byText } from '../../../../../helpers/testSelector'; import { AlmKeys } from '../../../../../types/alm-settings'; import { Feature } from '../../../../../types/features'; import { SettingsKey } from '../../../../../types/settings'; diff --git a/server/sonar-web/src/main/js/apps/settings/components/authentication/__tests__/Authentication-Bitbucket-it.tsx b/server/sonar-web/src/main/js/apps/settings/components/authentication/__tests__/Authentication-Bitbucket-it.tsx index 8ce6a40fbcf..b6cf04e6fc4 100644 --- a/server/sonar-web/src/main/js/apps/settings/components/authentication/__tests__/Authentication-Bitbucket-it.tsx +++ b/server/sonar-web/src/main/js/apps/settings/components/authentication/__tests__/Authentication-Bitbucket-it.tsx @@ -19,11 +19,11 @@ */ import userEvent from '@testing-library/user-event'; import React from 'react'; +import { byRole, byTestId, byText } from '~sonar-aligned/helpers/testSelector'; import SettingsServiceMock from '../../../../../api/mocks/SettingsServiceMock'; import { AvailableFeaturesContext } from '../../../../../app/components/available-features/AvailableFeaturesContext'; import { definitions } from '../../../../../helpers/mocks/definitions-list'; import { renderComponent } from '../../../../../helpers/testReactTestingUtils'; -import { byRole, byTestId, byText } from '../../../../../helpers/testSelector'; import { AlmKeys } from '../../../../../types/alm-settings'; import { Feature } from '../../../../../types/features'; import Authentication from '../Authentication'; diff --git a/server/sonar-web/src/main/js/apps/settings/components/authentication/__tests__/Authentication-Github-it.tsx b/server/sonar-web/src/main/js/apps/settings/components/authentication/__tests__/Authentication-Github-it.tsx index e1c0df615e3..6a67ef6fe21 100644 --- a/server/sonar-web/src/main/js/apps/settings/components/authentication/__tests__/Authentication-Github-it.tsx +++ b/server/sonar-web/src/main/js/apps/settings/components/authentication/__tests__/Authentication-Github-it.tsx @@ -21,6 +21,7 @@ import { screen, waitFor, within } from '@testing-library/react'; import userEvent from '@testing-library/user-event'; import { UserEvent } from '@testing-library/user-event/dist/types/setup/setup'; import React from 'react'; +import { byLabelText, byRole, byText } from '~sonar-aligned/helpers/testSelector'; import ComputeEngineServiceMock from '../../../../../api/mocks/ComputeEngineServiceMock'; import GithubProvisioningServiceMock from '../../../../../api/mocks/GithubProvisioningServiceMock'; import SettingsServiceMock from '../../../../../api/mocks/SettingsServiceMock'; @@ -28,7 +29,6 @@ import SystemServiceMock from '../../../../../api/mocks/SystemServiceMock'; import { AvailableFeaturesContext } from '../../../../../app/components/available-features/AvailableFeaturesContext'; import { definitions } from '../../../../../helpers/mocks/definitions-list'; import { renderComponent } from '../../../../../helpers/testReactTestingUtils'; -import { byLabelText, byRole, byText } from '../../../../../helpers/testSelector'; import { AlmKeys } from '../../../../../types/alm-settings'; import { Feature } from '../../../../../types/features'; import { GitHubProvisioningStatus } from '../../../../../types/provisioning'; diff --git a/server/sonar-web/src/main/js/apps/settings/components/authentication/__tests__/Authentication-Gitlab-it.tsx b/server/sonar-web/src/main/js/apps/settings/components/authentication/__tests__/Authentication-Gitlab-it.tsx index 0f7cbe05794..8207cf989c6 100644 --- a/server/sonar-web/src/main/js/apps/settings/components/authentication/__tests__/Authentication-Gitlab-it.tsx +++ b/server/sonar-web/src/main/js/apps/settings/components/authentication/__tests__/Authentication-Gitlab-it.tsx @@ -19,6 +19,7 @@ */ import userEvent from '@testing-library/user-event'; import React from 'react'; +import { byRole } from '~sonar-aligned/helpers/testSelector'; import ComputeEngineServiceMock from '../../../../../api/mocks/ComputeEngineServiceMock'; import GitlabProvisioningServiceMock from '../../../../../api/mocks/GitlabProvisioningServiceMock'; import SettingsServiceMock from '../../../../../api/mocks/SettingsServiceMock'; @@ -27,7 +28,6 @@ import { AvailableFeaturesContext } from '../../../../../app/components/availabl import { mockGitlabConfiguration } from '../../../../../helpers/mocks/alm-integrations'; import { definitions } from '../../../../../helpers/mocks/definitions-list'; import { renderComponent } from '../../../../../helpers/testReactTestingUtils'; -import { byRole } from '../../../../../helpers/testSelector'; import { AlmKeys } from '../../../../../types/alm-settings'; import { Feature } from '../../../../../types/features'; import { ProvisioningType } from '../../../../../types/provisioning'; diff --git a/server/sonar-web/src/main/js/apps/settings/components/authentication/__tests__/Authentication-Scim-it.tsx b/server/sonar-web/src/main/js/apps/settings/components/authentication/__tests__/Authentication-Scim-it.tsx index d2b8376f266..5d449067ba7 100644 --- a/server/sonar-web/src/main/js/apps/settings/components/authentication/__tests__/Authentication-Scim-it.tsx +++ b/server/sonar-web/src/main/js/apps/settings/components/authentication/__tests__/Authentication-Scim-it.tsx @@ -21,13 +21,13 @@ import { waitFor } from '@testing-library/react'; import userEvent from '@testing-library/user-event'; import { UserEvent } from '@testing-library/user-event/dist/types/setup/setup'; import React from 'react'; +import { byRole, byText } from '~sonar-aligned/helpers/testSelector'; import ScimProvisioningServiceMock from '../../../../../api/mocks/ScimProvisioningServiceMock'; import SettingsServiceMock from '../../../../../api/mocks/SettingsServiceMock'; import SystemServiceMock from '../../../../../api/mocks/SystemServiceMock'; import { AvailableFeaturesContext } from '../../../../../app/components/available-features/AvailableFeaturesContext'; import { definitions } from '../../../../../helpers/mocks/definitions-list'; import { renderComponent } from '../../../../../helpers/testReactTestingUtils'; -import { byRole, byText } from '../../../../../helpers/testSelector'; import { Feature } from '../../../../../types/features'; import Authentication from '../Authentication'; diff --git a/server/sonar-web/src/main/js/apps/settings/components/authentication/__tests__/Authentication-it.tsx b/server/sonar-web/src/main/js/apps/settings/components/authentication/__tests__/Authentication-it.tsx index bf2345a6c0e..1fd292e87df 100644 --- a/server/sonar-web/src/main/js/apps/settings/components/authentication/__tests__/Authentication-it.tsx +++ b/server/sonar-web/src/main/js/apps/settings/components/authentication/__tests__/Authentication-it.tsx @@ -20,6 +20,7 @@ import { screen } from '@testing-library/react'; import userEvent from '@testing-library/user-event'; import React from 'react'; +import { byRole, byText } from '~sonar-aligned/helpers/testSelector'; import GithubProvisioningServiceMock from '../../../../../api/mocks/GithubProvisioningServiceMock'; import GitlabProvisioningServiceMock from '../../../../../api/mocks/GitlabProvisioningServiceMock'; import ScimProvisioningServiceMock from '../../../../../api/mocks/ScimProvisioningServiceMock'; @@ -28,7 +29,6 @@ import SystemServiceMock from '../../../../../api/mocks/SystemServiceMock'; import { AvailableFeaturesContext } from '../../../../../app/components/available-features/AvailableFeaturesContext'; import { definitions } from '../../../../../helpers/mocks/definitions-list'; import { renderComponent } from '../../../../../helpers/testReactTestingUtils'; -import { byRole, byText } from '../../../../../helpers/testSelector'; import { Feature } from '../../../../../types/features'; import Authentication from '../Authentication'; diff --git a/server/sonar-web/src/main/js/apps/settings/components/pullRequestDecorationBinding/__tests__/PRDecorationBinding-it.tsx b/server/sonar-web/src/main/js/apps/settings/components/pullRequestDecorationBinding/__tests__/PRDecorationBinding-it.tsx index 0ed191083a1..b698dc4b9cc 100644 --- a/server/sonar-web/src/main/js/apps/settings/components/pullRequestDecorationBinding/__tests__/PRDecorationBinding-it.tsx +++ b/server/sonar-web/src/main/js/apps/settings/components/pullRequestDecorationBinding/__tests__/PRDecorationBinding-it.tsx @@ -20,12 +20,12 @@ import userEvent from '@testing-library/user-event'; import React from 'react'; import selectEvent from 'react-select-event'; +import { byRole, byText } from '~sonar-aligned/helpers/testSelector'; import AlmSettingsServiceMock from '../../../../../api/mocks/AlmSettingsServiceMock'; import CurrentUserContextProvider from '../../../../../app/components/current-user/CurrentUserContextProvider'; import { mockComponent } from '../../../../../helpers/mocks/component'; import { mockCurrentUser } from '../../../../../helpers/testMocks'; import { renderComponent } from '../../../../../helpers/testReactTestingUtils'; -import { byRole, byText } from '../../../../../helpers/testSelector'; import { AlmKeys, ProjectAlmBindingConfigurationErrorScope, diff --git a/server/sonar-web/src/main/js/apps/settings/encryption/__tests__/EncryptionApp-it.tsx b/server/sonar-web/src/main/js/apps/settings/encryption/__tests__/EncryptionApp-it.tsx index d6faa2a993b..fca8c5f30a1 100644 --- a/server/sonar-web/src/main/js/apps/settings/encryption/__tests__/EncryptionApp-it.tsx +++ b/server/sonar-web/src/main/js/apps/settings/encryption/__tests__/EncryptionApp-it.tsx @@ -19,9 +19,9 @@ */ import userEvent from '@testing-library/user-event'; import React from 'react'; +import { byRole } from '~sonar-aligned/helpers/testSelector'; import SettingsServiceMock from '../../../../api/mocks/SettingsServiceMock'; import { renderComponent } from '../../../../helpers/testReactTestingUtils'; -import { byRole } from '../../../../helpers/testSelector'; import EncryptionApp from '../EncryptionApp'; let settingsMock: SettingsServiceMock; diff --git a/server/sonar-web/src/main/js/apps/system/components/__tests__/SystemApp-it.tsx b/server/sonar-web/src/main/js/apps/system/components/__tests__/SystemApp-it.tsx index 38e281122b1..20baab75062 100644 --- a/server/sonar-web/src/main/js/apps/system/components/__tests__/SystemApp-it.tsx +++ b/server/sonar-web/src/main/js/apps/system/components/__tests__/SystemApp-it.tsx @@ -20,9 +20,9 @@ import { screen } from '@testing-library/react'; import userEvent from '@testing-library/user-event'; import { first } from 'lodash'; +import { byRole, byText } from '~sonar-aligned/helpers/testSelector'; import SystemServiceMock from '../../../../api/mocks/SystemServiceMock'; import { renderAppRoutes } from '../../../../helpers/testReactTestingUtils'; -import { byRole, byText } from '../../../../helpers/testSelector'; import { AppState } from '../../../../types/appstate'; import routes from '../../routes'; import { LogsLevels } from '../../utils'; diff --git a/server/sonar-web/src/main/js/apps/tutorials/components/__tests__/TutorialsApp-test.tsx b/server/sonar-web/src/main/js/apps/tutorials/components/__tests__/TutorialsApp-test.tsx index d8730fc71ec..b52dddc41c0 100644 --- a/server/sonar-web/src/main/js/apps/tutorials/components/__tests__/TutorialsApp-test.tsx +++ b/server/sonar-web/src/main/js/apps/tutorials/components/__tests__/TutorialsApp-test.tsx @@ -17,12 +17,12 @@ * along with this program; if not, write to the Free Software Foundation, * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ +import { byRole, byText } from '~sonar-aligned/helpers/testSelector'; import SettingsServiceMock from '../../../../api/mocks/SettingsServiceMock'; import UserTokensMock from '../../../../api/mocks/UserTokensMock'; import handleRequiredAuthentication from '../../../../helpers/handleRequiredAuthentication'; import { mockCurrentUser, mockLoggedInUser } from '../../../../helpers/testMocks'; import { renderAppWithComponentContext } from '../../../../helpers/testReactTestingUtils'; -import { byRole, byText } from '../../../../helpers/testSelector'; import { Permissions } from '../../../../types/permissions'; import routes from '../../routes'; diff --git a/server/sonar-web/src/main/js/apps/users/__tests__/UsersApp-it.tsx b/server/sonar-web/src/main/js/apps/users/__tests__/UsersApp-it.tsx index c257fd290a8..d3d10f43edd 100644 --- a/server/sonar-web/src/main/js/apps/users/__tests__/UsersApp-it.tsx +++ b/server/sonar-web/src/main/js/apps/users/__tests__/UsersApp-it.tsx @@ -21,6 +21,7 @@ import { screen, waitFor } from '@testing-library/react'; import userEvent from '@testing-library/user-event'; import * as React from 'react'; import selectEvent from 'react-select-event'; +import { byLabelText, byRole, byText } from '~sonar-aligned/helpers/testSelector'; import ComponentsServiceMock from '../../../api/mocks/ComponentsServiceMock'; import GithubProvisioningServiceMock from '../../../api/mocks/GithubProvisioningServiceMock'; import GroupMembershipsServiceMock from '../../../api/mocks/GroupMembersipsServiceMock'; @@ -37,7 +38,6 @@ import { mockRestUser, } from '../../../helpers/testMocks'; import { renderApp } from '../../../helpers/testReactTestingUtils'; -import { byLabelText, byRole, byText } from '../../../helpers/testSelector'; import { Feature } from '../../../types/features'; import { TaskStatuses } from '../../../types/tasks'; import { Provider } from '../../../types/types'; diff --git a/server/sonar-web/src/main/js/apps/web-api-v2/__tests__/WebApiApp-it.tsx b/server/sonar-web/src/main/js/apps/web-api-v2/__tests__/WebApiApp-it.tsx index 6fc42721e65..85dbd68aae8 100644 --- a/server/sonar-web/src/main/js/apps/web-api-v2/__tests__/WebApiApp-it.tsx +++ b/server/sonar-web/src/main/js/apps/web-api-v2/__tests__/WebApiApp-it.tsx @@ -20,9 +20,9 @@ import { screen, waitFor } from '@testing-library/react'; import userEvent from '@testing-library/user-event'; import * as React from 'react'; +import { byRole, byTestId, byText } from '~sonar-aligned/helpers/testSelector'; import WebApiServiceMock from '../../../api/mocks/WebApiServiceMock'; import { renderApp } from '../../../helpers/testReactTestingUtils'; -import { byRole, byTestId, byText } from '../../../helpers/testSelector'; import WebApiApp from '../WebApiApp'; const handler = new WebApiServiceMock(); diff --git a/server/sonar-web/src/main/js/apps/web-api/__tests__/WebApi-it.tsx b/server/sonar-web/src/main/js/apps/web-api/__tests__/WebApi-it.tsx index efee505814b..17a921d2ed0 100644 --- a/server/sonar-web/src/main/js/apps/web-api/__tests__/WebApi-it.tsx +++ b/server/sonar-web/src/main/js/apps/web-api/__tests__/WebApi-it.tsx @@ -18,9 +18,9 @@ * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ import userEvent from '@testing-library/user-event'; +import { byLabelText, byRole, byText } from '~sonar-aligned/helpers/testSelector'; import WebApiServiceMock from '../../../api/mocks/WebApiServiceMock'; import { renderAppRoutes } from '../../../helpers/testReactTestingUtils'; -import { byLabelText, byRole, byText } from '../../../helpers/testSelector'; import routes from '../routes'; jest.mock('../../../components/common/ScreenPositionHelper'); diff --git a/server/sonar-web/src/main/js/apps/web-api/components/__tests__/Actions-test.tsx b/server/sonar-web/src/main/js/apps/web-api/components/__tests__/Actions-test.tsx index b4f02541131..289b83c1440 100644 --- a/server/sonar-web/src/main/js/apps/web-api/components/__tests__/Actions-test.tsx +++ b/server/sonar-web/src/main/js/apps/web-api/components/__tests__/Actions-test.tsx @@ -19,9 +19,9 @@ */ import userEvent from '@testing-library/user-event'; import * as React from 'react'; +import { byRole, byText } from '~sonar-aligned/helpers/testSelector'; import { mockAction, mockDomain, mockParam } from '../../../../helpers/mocks/webapi'; import { renderComponent } from '../../../../helpers/testReactTestingUtils'; -import { byRole, byText } from '../../../../helpers/testSelector'; import Action from '../Action'; jest.mock('../../../../api/web-api', () => ({ diff --git a/server/sonar-web/src/main/js/apps/webhooks/components/__tests__/App-it.tsx b/server/sonar-web/src/main/js/apps/webhooks/components/__tests__/App-it.tsx index b99f4cd030d..71e222bb722 100644 --- a/server/sonar-web/src/main/js/apps/webhooks/components/__tests__/App-it.tsx +++ b/server/sonar-web/src/main/js/apps/webhooks/components/__tests__/App-it.tsx @@ -20,11 +20,11 @@ import { screen, waitFor, within } from '@testing-library/react'; import userEvent from '@testing-library/user-event'; import React from 'react'; +import { byLabelText, byRole, byText } from '~sonar-aligned/helpers/testSelector'; import WebhooksMock from '../../../../api/mocks/WebhooksMock'; import { mockComponent } from '../../../../helpers/mocks/component'; import { mockWebhook } from '../../../../helpers/mocks/webhook'; import { renderComponent } from '../../../../helpers/testReactTestingUtils'; -import { byLabelText, byRole, byText } from '../../../../helpers/testSelector'; import { App, AppProps } from '../App'; import { WEBHOOKS_LIMIT } from '../PageActions'; diff --git a/server/sonar-web/src/main/js/components/SourceViewer/__tests__/SourceViewer-it.tsx b/server/sonar-web/src/main/js/components/SourceViewer/__tests__/SourceViewer-it.tsx index aaa6d54b6c8..c649604f45b 100644 --- a/server/sonar-web/src/main/js/components/SourceViewer/__tests__/SourceViewer-it.tsx +++ b/server/sonar-web/src/main/js/components/SourceViewer/__tests__/SourceViewer-it.tsx @@ -20,6 +20,7 @@ import { queryHelpers, screen, within } from '@testing-library/react'; import userEvent from '@testing-library/user-event'; import * as React from 'react'; +import { byLabelText } from '~sonar-aligned/helpers/testSelector'; import { MetricKey } from '~sonar-aligned/types/metrics'; import ComponentsServiceMock from '../../../api/mocks/ComponentsServiceMock'; import IssuesServiceMock from '../../../api/mocks/IssuesServiceMock'; @@ -29,7 +30,6 @@ import { isDiffMetric } from '../../../helpers/measures'; import { HttpStatus } from '../../../helpers/request'; import { mockIssue, mockLoggedInUser, mockMeasure } from '../../../helpers/testMocks'; import { renderComponent } from '../../../helpers/testReactTestingUtils'; -import { byLabelText } from '../../../helpers/testSelector'; import { RestUserDetailed } from '../../../types/users'; import SourceViewer, { Props } from '../SourceViewer'; import loadIssues from '../helpers/loadIssues'; diff --git a/server/sonar-web/src/main/js/components/activity-graph/__tests__/ActivityGraph-it.tsx b/server/sonar-web/src/main/js/components/activity-graph/__tests__/ActivityGraph-it.tsx index 43017bb1a4a..4c75bd42d87 100644 --- a/server/sonar-web/src/main/js/components/activity-graph/__tests__/ActivityGraph-it.tsx +++ b/server/sonar-web/src/main/js/components/activity-graph/__tests__/ActivityGraph-it.tsx @@ -21,13 +21,18 @@ import { screen } from '@testing-library/react'; import userEvent from '@testing-library/user-event'; import { times } from 'lodash'; import * as React from 'react'; +import { + byLabelText, + byPlaceholderText, + byRole, + byText, +} from '~sonar-aligned/helpers/testSelector'; import { MetricKey, MetricType } from '~sonar-aligned/types/metrics'; import { CCT_SOFTWARE_QUALITY_METRICS } from '../../../helpers/constants'; import { parseDate } from '../../../helpers/dates'; import { mockHistoryItem, mockMeasureHistory } from '../../../helpers/mocks/project-activity'; import { mockMetric } from '../../../helpers/testMocks'; import { renderComponent } from '../../../helpers/testReactTestingUtils'; -import { byLabelText, byPlaceholderText, byRole, byText } from '../../../helpers/testSelector'; import { ComponentPropsType } from '../../../helpers/testUtils'; import { GraphType, MeasureHistory } from '../../../types/project-activity'; import { Metric } from '../../../types/types'; diff --git a/server/sonar-web/src/main/js/components/activity-graph/__tests__/EventInner-it.tsx b/server/sonar-web/src/main/js/components/activity-graph/__tests__/EventInner-it.tsx index 984c754957b..0159e1664b2 100644 --- a/server/sonar-web/src/main/js/components/activity-graph/__tests__/EventInner-it.tsx +++ b/server/sonar-web/src/main/js/components/activity-graph/__tests__/EventInner-it.tsx @@ -22,11 +22,11 @@ import userEvent from '@testing-library/user-event'; import * as React from 'react'; import { Route } from 'react-router-dom'; import { isMainBranch } from '~sonar-aligned/helpers/branch-like'; +import { byRole, byText } from '~sonar-aligned/helpers/testSelector'; import BranchesServiceMock from '../../../api/mocks/BranchesServiceMock'; import { mockBranch, mockMainBranch } from '../../../helpers/mocks/branch-like'; import { mockAnalysisEvent } from '../../../helpers/mocks/project-activity'; import { renderAppWithComponentContext } from '../../../helpers/testReactTestingUtils'; -import { byRole, byText } from '../../../helpers/testSelector'; import { Branch, BranchLike } from '../../../types/branch-like'; import { ApplicationAnalysisEventCategory, diff --git a/server/sonar-web/src/main/js/components/controls/__tests__/SelectList-test.tsx b/server/sonar-web/src/main/js/components/controls/__tests__/SelectList-test.tsx index 4c59685c3dc..4d8d0ee3d72 100644 --- a/server/sonar-web/src/main/js/components/controls/__tests__/SelectList-test.tsx +++ b/server/sonar-web/src/main/js/components/controls/__tests__/SelectList-test.tsx @@ -19,8 +19,8 @@ */ import userEvent from '@testing-library/user-event'; import * as React from 'react'; +import { byRole, byText } from '~sonar-aligned/helpers/testSelector'; import { renderComponent } from '../../../helpers/testReactTestingUtils'; -import { byRole, byText } from '../../../helpers/testSelector'; import SelectList, { SelectListFilter } from '../SelectList'; const elements = ['foo', 'bar', 'baz']; diff --git a/server/sonar-web/src/main/js/components/issue/__tests__/Issue-it.tsx b/server/sonar-web/src/main/js/components/issue/__tests__/Issue-it.tsx index ce90ff69537..254b0643153 100644 --- a/server/sonar-web/src/main/js/components/issue/__tests__/Issue-it.tsx +++ b/server/sonar-web/src/main/js/components/issue/__tests__/Issue-it.tsx @@ -22,12 +22,12 @@ import userEvent from '@testing-library/user-event'; import { omit, pick } from 'lodash'; import * as React from 'react'; import { Route } from 'react-router-dom'; +import { byLabelText, byRole, byText } from '~sonar-aligned/helpers/testSelector'; import IssuesServiceMock from '../../../api/mocks/IssuesServiceMock'; import UsersServiceMock from '../../../api/mocks/UsersServiceMock'; import { KeyboardKeys } from '../../../helpers/keycodes'; import { mockIssue, mockLoggedInUser, mockRawIssue } from '../../../helpers/testMocks'; import { renderAppRoutes } from '../../../helpers/testReactTestingUtils'; -import { byLabelText, byRole, byText } from '../../../helpers/testSelector'; import { ComponentPropsType } from '../../../helpers/testUtils'; import { IssueActions, diff --git a/server/sonar-web/src/main/js/components/new-code-definition/__tests__/NCDAutoUpdateMessage-test.tsx b/server/sonar-web/src/main/js/components/new-code-definition/__tests__/NCDAutoUpdateMessage-test.tsx index 82df19582b8..5e74c7d1473 100644 --- a/server/sonar-web/src/main/js/components/new-code-definition/__tests__/NCDAutoUpdateMessage-test.tsx +++ b/server/sonar-web/src/main/js/components/new-code-definition/__tests__/NCDAutoUpdateMessage-test.tsx @@ -20,13 +20,13 @@ import userEvent from '@testing-library/user-event'; import React from 'react'; import { Route } from 'react-router-dom'; +import { byRole, byText } from '~sonar-aligned/helpers/testSelector'; import { MessageTypes } from '../../../api/messages'; import MessagesServiceMock from '../../../api/mocks/MessagesServiceMock'; import NewCodeDefinitionServiceMock from '../../../api/mocks/NewCodeDefinitionServiceMock'; import { mockComponent } from '../../../helpers/mocks/component'; import { mockLoggedInUser } from '../../../helpers/testMocks'; import { renderAppRoutes } from '../../../helpers/testReactTestingUtils'; -import { byRole, byText } from '../../../helpers/testSelector'; import { NewCodeDefinitionType } from '../../../types/new-code-definition'; import { Component } from '../../../types/types'; import NCDAutoUpdateMessage from '../NCDAutoUpdateMessage'; diff --git a/server/sonar-web/src/main/js/components/tutorials/__tests__/TutorialSelection-it.tsx b/server/sonar-web/src/main/js/components/tutorials/__tests__/TutorialSelection-it.tsx index d701224a491..518ed91fc82 100644 --- a/server/sonar-web/src/main/js/components/tutorials/__tests__/TutorialSelection-it.tsx +++ b/server/sonar-web/src/main/js/components/tutorials/__tests__/TutorialSelection-it.tsx @@ -21,6 +21,7 @@ import { screen, waitFor } from '@testing-library/react'; import userEvent from '@testing-library/user-event'; import { UserEvent } from '@testing-library/user-event/dist/types/setup/setup'; import * as React from 'react'; +import { byRole, byText } from '~sonar-aligned/helpers/testSelector'; import { getScannableProjects } from '../../../api/components'; import AlmSettingsServiceMock from '../../../api/mocks/AlmSettingsServiceMock'; import SettingsServiceMock from '../../../api/mocks/SettingsServiceMock'; @@ -28,7 +29,6 @@ import UserTokensMock from '../../../api/mocks/UserTokensMock'; import { mockComponent } from '../../../helpers/mocks/component'; import { mockLoggedInUser } from '../../../helpers/testMocks'; import { renderApp } from '../../../helpers/testReactTestingUtils'; -import { byRole, byText } from '../../../helpers/testSelector'; import { AlmKeys } from '../../../types/alm-settings'; import { Feature } from '../../../types/features'; import { Permissions } from '../../../types/permissions'; diff --git a/server/sonar-web/src/main/js/components/tutorials/components/__tests__/GithubCFamilyExampleRepositories-test.tsx b/server/sonar-web/src/main/js/components/tutorials/components/__tests__/GithubCFamilyExampleRepositories-test.tsx index 2dd940eaffb..9bf422f62c2 100644 --- a/server/sonar-web/src/main/js/components/tutorials/components/__tests__/GithubCFamilyExampleRepositories-test.tsx +++ b/server/sonar-web/src/main/js/components/tutorials/components/__tests__/GithubCFamilyExampleRepositories-test.tsx @@ -18,8 +18,8 @@ * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ import * as React from 'react'; +import { byRole } from '~sonar-aligned/helpers/testSelector'; import { renderComponent } from '../../../../helpers/testReactTestingUtils'; -import { byRole } from '../../../../helpers/testSelector'; import { OSs, TutorialModes } from '../../types'; import GithubCFamilyExampleRepositories, { GithubCFamilyExampleRepositoriesProps, diff --git a/server/sonar-web/src/main/js/components/tutorials/jenkins/__tests__/JenkinsTutorial-it.tsx b/server/sonar-web/src/main/js/components/tutorials/jenkins/__tests__/JenkinsTutorial-it.tsx index 5f8b6b572a9..87574ba0ea4 100644 --- a/server/sonar-web/src/main/js/components/tutorials/jenkins/__tests__/JenkinsTutorial-it.tsx +++ b/server/sonar-web/src/main/js/components/tutorials/jenkins/__tests__/JenkinsTutorial-it.tsx @@ -20,12 +20,12 @@ import { waitFor } from '@testing-library/react'; import userEvent from '@testing-library/user-event'; import React from 'react'; +import { byRole, byText } from '~sonar-aligned/helpers/testSelector'; import AlmSettingsServiceMock from '../../../../api/mocks/AlmSettingsServiceMock'; import UserTokensMock from '../../../../api/mocks/UserTokensMock'; import { mockComponent } from '../../../../helpers/mocks/component'; import { mockLanguage } from '../../../../helpers/testMocks'; import { RenderContext, renderApp } from '../../../../helpers/testReactTestingUtils'; -import { byRole, byText } from '../../../../helpers/testSelector'; import { AlmKeys } from '../../../../types/alm-settings'; import { Feature } from '../../../../types/features'; import { diff --git a/server/sonar-web/src/main/js/components/tutorials/other/__tests__/OtherTutorial-it.tsx b/server/sonar-web/src/main/js/components/tutorials/other/__tests__/OtherTutorial-it.tsx index b5244b0f050..53679e3194d 100644 --- a/server/sonar-web/src/main/js/components/tutorials/other/__tests__/OtherTutorial-it.tsx +++ b/server/sonar-web/src/main/js/components/tutorials/other/__tests__/OtherTutorial-it.tsx @@ -20,11 +20,11 @@ import userEvent from '@testing-library/user-event'; import React from 'react'; import selectEvent from 'react-select-event'; +import { byRole, byText } from '~sonar-aligned/helpers/testSelector'; import UserTokensMock from '../../../../api/mocks/UserTokensMock'; import { mockComponent } from '../../../../helpers/mocks/component'; import { mockLanguage, mockLoggedInUser } from '../../../../helpers/testMocks'; import { RenderContext, renderApp } from '../../../../helpers/testReactTestingUtils'; -import { byRole, byText } from '../../../../helpers/testSelector'; import { getCopyToClipboardValue, getTutorialActionButtons, diff --git a/server/sonar-web/src/main/js/components/tutorials/test-utils.ts b/server/sonar-web/src/main/js/components/tutorials/test-utils.ts index 62ee6baa081..14195ed84c0 100644 --- a/server/sonar-web/src/main/js/components/tutorials/test-utils.ts +++ b/server/sonar-web/src/main/js/components/tutorials/test-utils.ts @@ -18,7 +18,7 @@ * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ import { screen } from '@testing-library/react'; -import { byLabelText, byRole, byText } from '../../helpers/testSelector'; +import { byLabelText, byRole, byText } from '~sonar-aligned/helpers/testSelector'; import { BuildTools, GradleBuildDSL, OSs, TutorialModes } from './types'; const CI_TRANSLATE_MAP: Partial> = { diff --git a/server/sonar-web/src/main/js/components/upgrade/__tests__/SystemUpgrade-test.tsx b/server/sonar-web/src/main/js/components/upgrade/__tests__/SystemUpgrade-test.tsx index 55bd3e211e9..3e9900d1cf6 100644 --- a/server/sonar-web/src/main/js/components/upgrade/__tests__/SystemUpgrade-test.tsx +++ b/server/sonar-web/src/main/js/components/upgrade/__tests__/SystemUpgrade-test.tsx @@ -19,9 +19,9 @@ */ import userEvent from '@testing-library/user-event'; import React from 'react'; +import { byRole, byText } from '~sonar-aligned/helpers/testSelector'; import { mockAppState } from '../../../helpers/testMocks'; import { renderComponent } from '../../../helpers/testReactTestingUtils'; -import { byRole, byText } from '../../../helpers/testSelector'; import SystemUpgradeButton from '../SystemUpgradeButton'; import { UpdateUseCase } from '../utils'; diff --git a/server/sonar-web/src/main/js/components/workspace/__tests__/Workspace-test.tsx b/server/sonar-web/src/main/js/components/workspace/__tests__/Workspace-test.tsx index 87d712c22dd..51fbcdd6601 100644 --- a/server/sonar-web/src/main/js/components/workspace/__tests__/Workspace-test.tsx +++ b/server/sonar-web/src/main/js/components/workspace/__tests__/Workspace-test.tsx @@ -19,11 +19,11 @@ */ import userEvent from '@testing-library/user-event'; import * as React from 'react'; +import { byRole, byText } from '~sonar-aligned/helpers/testSelector'; import { ComponentQualifier } from '~sonar-aligned/types/component'; import { mockBranch } from '../../../helpers/mocks/branch-like'; import { get, save } from '../../../helpers/storage'; import { renderComponent } from '../../../helpers/testReactTestingUtils'; -import { byRole, byText } from '../../../helpers/testSelector'; import { BranchLike } from '../../../types/branch-like'; import Workspace, { TYPE_KEY, WorkspaceTypes } from '../Workspace'; import { WorkspaceContext } from '../context'; diff --git a/server/sonar-web/src/main/js/sonar-aligned/components/a11y/__tests__/A11yLinks-test.tsx b/server/sonar-web/src/main/js/sonar-aligned/components/a11y/__tests__/A11yLinks-test.tsx index 571368c432c..569fe611e64 100644 --- a/server/sonar-web/src/main/js/sonar-aligned/components/a11y/__tests__/A11yLinks-test.tsx +++ b/server/sonar-web/src/main/js/sonar-aligned/components/a11y/__tests__/A11yLinks-test.tsx @@ -20,7 +20,7 @@ import userEvent from '@testing-library/user-event'; import * as React from 'react'; import { renderComponent } from '../../../../helpers/testReactTestingUtils'; -import { byRole } from '../../../../helpers/testSelector'; +import { byRole } from '../../../helpers/testSelector'; import { A11yContext } from '../A11yContext'; import A11yProvider from '../A11yProvider'; import A11ySkipLinks from '../A11ySkipLinks'; diff --git a/server/sonar-web/src/main/js/sonar-aligned/components/controls/__tests__/DocHelpTooltip-test.tsx b/server/sonar-web/src/main/js/sonar-aligned/components/controls/__tests__/DocHelpTooltip-test.tsx index 691d25f2910..1f58f3d7db8 100644 --- a/server/sonar-web/src/main/js/sonar-aligned/components/controls/__tests__/DocHelpTooltip-test.tsx +++ b/server/sonar-web/src/main/js/sonar-aligned/components/controls/__tests__/DocHelpTooltip-test.tsx @@ -19,7 +19,7 @@ */ import userEvent from '@testing-library/user-event'; import * as React from 'react'; -import { byRole, byTestId } from '../../../../helpers/testSelector'; +import { byRole, byTestId } from '../../../helpers/testSelector'; import Link from '../../../../components/common/Link'; import { renderComponent } from '../../../../helpers/testReactTestingUtils'; diff --git a/server/sonar-web/src/main/js/sonar-aligned/helpers/__tests__/testSelector-test.tsx b/server/sonar-web/src/main/js/sonar-aligned/helpers/__tests__/testSelector-test.tsx new file mode 100644 index 00000000000..b0d1006b3f9 --- /dev/null +++ b/server/sonar-web/src/main/js/sonar-aligned/helpers/__tests__/testSelector-test.tsx @@ -0,0 +1,280 @@ +/* + * SonarQube + * Copyright (C) 2009-2024 SonarSource SA + * mailto:info AT sonarsource DOT com + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 3 of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public License + * along with this program; if not, write to the Free Software Foundation, + * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + */ +import { render } from '@testing-library/react'; +import React from 'react'; +import { + byDisplayValue, + byLabelText, + byPlaceholderText, + byRole, + byTestId, + byText, + byTitle, +} from '../testSelector'; + +describe('byText', () => { + it('should find', async () => { + renderByRTL(); + expect(await byText('test').find()).toBeVisible(); + }); + + it('should find all', async () => { + renderByRTL(); + expect(await byText('repeated').findAll()).toHaveLength(2); + }); + + it('should get', () => { + renderByRTL(); + expect(byText('test').get()).toBeVisible(); + }); + + it('should get all', () => { + renderByRTL(); + expect(byText('repeated').getAll()).toHaveLength(2); + }); + + it('should query', () => { + renderByRTL(); + expect(byText('test').query()).toBeVisible(); + }); + + it('should query all', () => { + renderByRTL(); + expect(byText('repeated').queryAll()).toHaveLength(2); + }); +}); + +describe('byRole', () => { + it('should find', async () => { + renderByRTL(); + expect(await byRole('button').find()).toBeVisible(); + }); + + it('should find all', async () => { + renderByRTL(); + expect(await byRole('alert').findAll()).toHaveLength(2); + }); + + it('should get', () => { + renderByRTL(); + expect(byRole('button').get()).toBeVisible(); + }); + + it('should get all', () => { + renderByRTL(); + expect(byRole('alert').getAll()).toHaveLength(2); + }); + + it('should query', () => { + renderByRTL(); + expect(byRole('button').query()).toBeVisible(); + }); + + it('should query all', () => { + renderByRTL(); + expect(byRole('alert').queryAll()).toHaveLength(2); + }); +}); + +describe('byPlaceholderText', () => { + it('should find', async () => { + renderByRTL(); + expect(await byPlaceholderText('placeholder').find()).toBeVisible(); + }); + + it('should find all', async () => { + renderByRTL(); + expect(await byPlaceholderText('repeated').findAll()).toHaveLength(2); + }); + + it('should get', () => { + renderByRTL(); + expect(byPlaceholderText('placeholder').get()).toBeVisible(); + }); + + it('should get all', () => { + renderByRTL(); + expect(byPlaceholderText('repeated').getAll()).toHaveLength(2); + }); + + it('should query', () => { + renderByRTL(); + expect(byPlaceholderText('placeholder').query()).toBeVisible(); + }); + + it('should query all', () => { + renderByRTL(); + expect(byPlaceholderText('repeated').queryAll()).toHaveLength(2); + }); +}); + +describe('byLabelText', () => { + it('should find', async () => { + renderByRTL(); + expect(await byLabelText('test').find()).toBeVisible(); + }); + + it('should find all', async () => { + renderByRTL(); + expect(await byLabelText('alert').findAll()).toHaveLength(2); + }); + + it('should get', () => { + renderByRTL(); + expect(byLabelText('test').get()).toBeVisible(); + }); + + it('should get all', () => { + renderByRTL(); + expect(byLabelText('alert').getAll()).toHaveLength(2); + }); + + it('should query', () => { + renderByRTL(); + expect(byLabelText('test').query()).toBeVisible(); + }); + + it('should query all', () => { + renderByRTL(); + expect(byLabelText('alert').queryAll()).toHaveLength(2); + }); +}); + +describe('byTestId', () => { + it('should find', async () => { + renderByRTL(); + expect(await byTestId('test').find()).toBeVisible(); + }); + + it('should find all', async () => { + renderByRTL(); + expect(await byTestId('alert').findAll()).toHaveLength(2); + }); + + it('should get', () => { + renderByRTL(); + expect(byTestId('test').get()).toBeVisible(); + }); + + it('should get all', () => { + renderByRTL(); + expect(byTestId('alert').getAll()).toHaveLength(2); + }); + + it('should query', () => { + renderByRTL(); + expect(byTestId('test').query()).toBeVisible(); + }); + + it('should query all', () => { + renderByRTL(); + expect(byTestId('alert').queryAll()).toHaveLength(2); + }); +}); + +describe('byDisplayValue', () => { + it('should find', async () => { + renderByRTL(); + expect(await byDisplayValue('one').find()).toBeVisible(); + }); + + it('should find all', async () => { + renderByRTL(); + expect(await byDisplayValue('two').findAll()).toHaveLength(2); + }); + + it('should get', () => { + renderByRTL(); + expect(byDisplayValue('one').get()).toBeVisible(); + }); + + it('should get all', () => { + renderByRTL(); + expect(byDisplayValue('two').getAll()).toHaveLength(2); + }); + + it('should query', () => { + renderByRTL(); + expect(byDisplayValue('one').query()).toBeVisible(); + }); + + it('should query all', () => { + renderByRTL(); + expect(byDisplayValue('two').queryAll()).toHaveLength(2); + }); +}); + +describe('byTitle', () => { + it('should find', async () => { + renderByRTL(); + expect(await byTitle('test').find()).toBeVisible(); + }); + + it('should find all', async () => { + renderByRTL(); + expect(await byTitle('alert').findAll()).toHaveLength(2); + }); + + it('should get', () => { + renderByRTL(); + expect(byTitle('test').get()).toBeVisible(); + }); + + it('should get all', () => { + renderByRTL(); + expect(byTitle('alert').getAll()).toHaveLength(2); + }); + + it('should query', () => { + renderByRTL(); + expect(byTitle('test').query()).toBeVisible(); + }); + + it('should query all', () => { + renderByRTL(); + expect(byTitle('alert').queryAll()).toHaveLength(2); + }); +}); + +function renderByRTL() { + return render( +
+

+ test +

+
+ repeated +
+
+ repeated +
+ + + + + +