]> source.dussan.org Git - sonarqube.git/commitdiff
[NO JIRA] Remove react-testing-selector library and replace it
authorMathieu Suen <mathieu.suen@sonarsource.com>
Wed, 14 Jun 2023 12:51:46 +0000 (14:51 +0200)
committersonartech <sonartech@sonarsource.com>
Thu, 15 Jun 2023 09:41:52 +0000 (09:41 +0000)
62 files changed:
server/sonar-web/build.gradle
server/sonar-web/package.json
server/sonar-web/src/main/js/app/components/global-search/__tests__/GlobalSearch-it.tsx
server/sonar-web/src/main/js/apps/account/__tests__/Account-it.tsx
server/sonar-web/src/main/js/apps/audit-logs/components/__tests__/AuditApp-it.tsx
server/sonar-web/src/main/js/apps/background-tasks/__tests__/BackgroundTasks-it.tsx
server/sonar-web/src/main/js/apps/change-admin-password/__tests__/ChangeAdminPasswordApp-it.tsx
server/sonar-web/src/main/js/apps/code/__tests__/Code-it.ts
server/sonar-web/src/main/js/apps/coding-rules/__tests__/CodingRules-it.ts
server/sonar-web/src/main/js/apps/component-measures/__tests__/ComponentMeasures-it.tsx
server/sonar-web/src/main/js/apps/create/project/__tests__/Azure-it.tsx
server/sonar-web/src/main/js/apps/create/project/__tests__/Bitbucket-it.tsx
server/sonar-web/src/main/js/apps/create/project/__tests__/BitbucketCloud-it.tsx
server/sonar-web/src/main/js/apps/create/project/__tests__/GitHub-it.tsx
server/sonar-web/src/main/js/apps/create/project/__tests__/GitLab-it.tsx
server/sonar-web/src/main/js/apps/create/project/__tests__/Manual-it.tsx
server/sonar-web/src/main/js/apps/create/project/__tests__/ManualProjectCreate-test.tsx
server/sonar-web/src/main/js/apps/groups/__tests__/GroupsApp-it.tsx
server/sonar-web/src/main/js/apps/issues/__tests__/IssuesSourceViewer-it.tsx
server/sonar-web/src/main/js/apps/issues/components/__tests__/AssigneeSelect-test.tsx
server/sonar-web/src/main/js/apps/issues/crossComponentSourceViewer/__tests__/IssueSourceViewerHeader-test.tsx
server/sonar-web/src/main/js/apps/issues/crossComponentSourceViewer/__tests__/SnippetViewer-test.tsx
server/sonar-web/src/main/js/apps/issues/issues-subnavigation/__tests__/SubnavigationIssues-it.tsx
server/sonar-web/src/main/js/apps/issues/test-utils.tsx
server/sonar-web/src/main/js/apps/permission-templates/components/__tests__/PermissionTemplatesApp-it.tsx
server/sonar-web/src/main/js/apps/permissions/test-utils.ts
server/sonar-web/src/main/js/apps/projectActivity/components/__tests__/ProjectActivityApp-it.tsx
server/sonar-web/src/main/js/apps/projectBaseline/components/__tests__/ProjectBaselineApp-it.tsx
server/sonar-web/src/main/js/apps/projectBranches/__tests__/ProjectBranchesApp-it.tsx
server/sonar-web/src/main/js/apps/projectDump/__tests__/ProjectDumpApp-it.tsx
server/sonar-web/src/main/js/apps/projectKey/__tests__/ProjectKeyApp-it.tsx
server/sonar-web/src/main/js/apps/projectLinks/__tests__/ProjectLinksApp-it.tsx
server/sonar-web/src/main/js/apps/projectQualityGate/__tests__/ProjectQualityGateApp-it.tsx
server/sonar-web/src/main/js/apps/quality-profiles/__tests__/QualityProfilesApp-it.tsx
server/sonar-web/src/main/js/apps/security-hotspots/__tests__/SecurityHotspotsApp-it.tsx
server/sonar-web/src/main/js/apps/settings/components/__tests__/AnalysisScope-test.tsx
server/sonar-web/src/main/js/apps/settings/components/__tests__/Definition-it.tsx
server/sonar-web/src/main/js/apps/settings/components/__tests__/Languages-it.tsx
server/sonar-web/src/main/js/apps/settings/components/__tests__/NewCodePeriod-it.tsx
server/sonar-web/src/main/js/apps/settings/components/__tests__/SettingsApp-it.tsx
server/sonar-web/src/main/js/apps/settings/components/almIntegration/__tests__/AlmBindingDefinitionForm-test.tsx
server/sonar-web/src/main/js/apps/settings/components/almIntegration/__tests__/AlmIntegration-it.tsx
server/sonar-web/src/main/js/apps/settings/components/authentication/__tests__/Authentication-it.tsx
server/sonar-web/src/main/js/apps/settings/components/pullRequestDecorationBinding/__tests__/PRDecorationBinding-it.tsx
server/sonar-web/src/main/js/apps/settings/encryption/__tests__/EncryptionApp-it.tsx
server/sonar-web/src/main/js/apps/system/components/__tests__/SystemApp-it.tsx
server/sonar-web/src/main/js/apps/tutorials/components/__tests__/TutorialsApp-test.tsx
server/sonar-web/src/main/js/apps/users/__tests__/UsersApp-it.tsx
server/sonar-web/src/main/js/components/SourceViewer/__tests__/SourceViewer-it.tsx
server/sonar-web/src/main/js/components/activity-graph/__tests__/ActivityGraph-it.tsx
server/sonar-web/src/main/js/components/activity-graph/__tests__/EventInner-it.tsx
server/sonar-web/src/main/js/components/common/__tests__/DocumentationTooltip-test.tsx
server/sonar-web/src/main/js/components/common/__tests__/MultiSelect-test.tsx
server/sonar-web/src/main/js/components/controls/__tests__/Toggler-test.tsx
server/sonar-web/src/main/js/components/issue/__tests__/Issue-it.tsx
server/sonar-web/src/main/js/components/tutorials/__tests__/TutorialSelection-it.tsx
server/sonar-web/src/main/js/components/tutorials/components/__tests__/GithubCFamilyExampleRepositories-test.tsx
server/sonar-web/src/main/js/components/tutorials/jenkins/__tests__/JenkinsTutorial-it.tsx
server/sonar-web/src/main/js/components/tutorials/other/__tests__/OtherTutorial-it.tsx
server/sonar-web/src/main/js/components/tutorials/test-utils.ts
server/sonar-web/src/main/js/helpers/testSelector.ts [new file with mode: 0644]
server/sonar-web/yarn.lock

index 3e552ca8d4501ee935fb1307f5ddb62f923d77e8..cac9ab0dd73ad424d1e9179d6fbfbbf9b76c0256 100644 (file)
@@ -2,7 +2,7 @@ sonar {
   properties {
     property "sonar.projectName", "${projectTitle} :: Web"
     property "sonar.sources", "src/main/js"
-    property "sonar.exclusions", "src/main/js/**/__tests__/**,src/main/js/**/__mocks__/**,src/main/js/@types/**,src/main/js/helpers/mocks/**,src/main/js/api/mocks/**,src/main/js/helpers/testUtils.ts,src/main/js/helpers/testMocks.ts,src/main/js/helpers/testReactTestingUtils.tsx"
+    property "sonar.exclusions", "src/main/js/**/__tests__/**,src/main/js/**/__mocks__/**,src/main/js/@types/**,src/main/js/helpers/mocks/**,src/main/js/api/mocks/**,src/main/js/helpers/testUtils.ts,src/main/js/helpers/testMocks.ts,src/main/js/helpers/testReactTestingUtils.tsx,src/main/js/helpers/testSelector.ts"
     property "sonar.tests", "src/main/js"
     property "sonar.test.inclusions", "src/main/js/**/__tests__/**"
     property "sonar.coverage.exclusions", "src/main/js/api/**,src/main/js/**/routes.ts,src/main/js/app/index.ts,src/main/js/app/utils/startReactApp.tsx,src/main/js/components/icons/**"
index 0ffafc16ab7c85fd53d2ae061eae0adfe4b5c149..8ea7e0a1cbf287faaffb5e5541eb6d0ca2bed609 100644 (file)
     "prettier": "2.8.7",
     "react-select-event": "5.5.1",
     "tailwindcss": "3.3.1",
-    "testing-library-selector": "0.2.1",
     "turbo": "1.8.8",
     "typescript": "5.0.3",
     "whatwg-fetch": "3.6.2"
index 5a71453adabadeb9458817f54d57930f6d9d1d4e..ae3197eb2a7c21eecdede7a2aff5a2eb6a229a3d 100644 (file)
  */
 import userEvent from '@testing-library/user-event';
 import React from 'react';
-import { byRole, byText } from 'testing-library-selector';
 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', () => ({
@@ -117,7 +117,8 @@ it('load more results', async () => {
   await user.keyboard('foo');
   expect(getSuggestions).toHaveBeenLastCalledWith('foo', []);
 
-  (getSuggestions as jest.Mock).mockResolvedValueOnce({
+  jest.mocked(getSuggestions).mockResolvedValueOnce({
+    projects: [],
     results: [
       {
         items: [
@@ -127,7 +128,6 @@ it('load more results', async () => {
             key: 'bar',
             match: '<mark>Bar</mark>',
             name: 'Bar',
-            organization: 'org',
             project: 'bar',
           },
         ],
index dbacff254173cc00c7066359488add4a3b6553c7..173e9fa7723fbb91321c6375afc8ab77e0a24f8b 100644 (file)
@@ -21,7 +21,6 @@ import { screen, within } from '@testing-library/react';
 import userEvent from '@testing-library/user-event';
 import { UserEvent } from '@testing-library/user-event/dist/types/setup/setup';
 import selectEvent from 'react-select-event';
-import { byRole, byText } from 'testing-library-selector';
 import { getMyProjects, getScannableProjects } from '../../../api/components';
 import NotificationsMock from '../../../api/mocks/NotificationsMock';
 import UserTokensMock from '../../../api/mocks/UserTokensMock';
@@ -29,6 +28,7 @@ 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';
index a015819f6d6f67751e36508df2625c1524a78fc2..1eecde710859bf65ee2b09d42f8143e1040aec24 100644 (file)
 import { screen } from '@testing-library/react';
 import userEvent from '@testing-library/user-event';
 import { getDate, getMonth, getYear, subDays } from 'date-fns';
-import { byPlaceholderText, byRole, byText } from 'testing-library-selector';
 import SettingsServiceMock from '../../../../api/mocks/SettingsServiceMock';
 import { now } from '../../../../helpers/dates';
 import { getMonthName } from '../../../../helpers/l10n';
 import { renderAppWithAdminContext } from '../../../../helpers/testReactTestingUtils';
+import { byPlaceholderText, byRole, byText } from '../../../../helpers/testSelector';
 import { AdminPageExtension } from '../../../../types/extension';
 import { SettingsKey } from '../../../../types/settings';
 import routes from '../../routes';
index c13b0281b47091de9521f4a725769680fab4608a..a0ab84e8311f1c66870fc3b01a78f7c0f3d4d6ed 100644 (file)
@@ -19,7 +19,6 @@
  */
 import { screen, waitFor, within } from '@testing-library/react';
 import userEvent from '@testing-library/user-event';
-import { byLabelText, byPlaceholderText, byRole, byText } from 'testing-library-selector';
 import ComputeEngineServiceMock from '../../../api/mocks/ComputeEngineServiceMock';
 import { parseDate } from '../../../helpers/dates';
 import { mockAppState } from '../../../helpers/testMocks';
@@ -28,6 +27,7 @@ import {
   dateInputEvent,
   renderAppWithAdminContext,
 } from '../../../helpers/testReactTestingUtils';
+import { byLabelText, byPlaceholderText, byRole, byText } from '../../../helpers/testSelector';
 import { EditionKey } from '../../../types/editions';
 import { TaskStatuses, TaskTypes } from '../../../types/tasks';
 import routes from '../routes';
@@ -47,7 +47,7 @@ describe('The Global background task page', () => {
     renderGlobalBackgroundTasksApp();
     await ui.appLoaded();
 
-    expect(within(ui.numberOfWorkers.get()).getByText('2')).toBeInTheDocument();
+    expect(ui.numberOfWorkers(2).get()).toBeInTheDocument();
 
     const editWorkersButton = screen.getByRole('button', {
       name: 'background_tasks.change_number_of_workers',
@@ -72,7 +72,7 @@ describe('The Global background task page', () => {
 
     await user.click(within(modal).getByRole('button', { name: 'save' }));
 
-    expect(within(ui.numberOfWorkers.get()).getByText('4')).toBeInTheDocument();
+    expect(ui.numberOfWorkers(4).get()).toBeInTheDocument();
   });
 
   it('should display the list of tasks', async () => {
@@ -311,7 +311,8 @@ function getPageObject() {
   const selectors = {
     loading: byLabelText('loading'),
     pageHeading: byRole('heading', { name: 'background_tasks.page' }),
-    numberOfWorkers: byText('background_tasks.number_of_workers'),
+    numberOfWorkers: (count: number) =>
+      byText('background_tasks.number_of_workers').byText(`${count}`),
     onlyLatestAnalysis: byRole('checkbox', { name: 'yes' }),
     search: byPlaceholderText('background_tasks.search_by_task_or_component'),
     fromDateInput: byRole('textbox', { name: 'start_date' }),
index 01fa22603a431d6349cdf3bea194c44d3d79a899..f764ee14d99415f569d3b1decfb0e6f1e34f5ce3 100644 (file)
  */
 import userEvent from '@testing-library/user-event';
 import * as React from 'react';
-import { byLabelText, byRole, byText } from 'testing-library-selector';
 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';
index 61b202ab4dc599548044e421e34f3d329d2ea8da..3c5d7607135b97563feca80dff14425a14458e27 100644 (file)
@@ -22,13 +22,13 @@ import userEvent from '@testing-library/user-event';
 import { UserEvent } from '@testing-library/user-event/dist/types/setup/setup';
 import { keyBy, times } from 'lodash';
 import { act } from 'react-dom/test-utils';
-import { byRole, byText } from 'testing-library-selector';
 import ComponentsServiceMock from '../../../api/mocks/ComponentsServiceMock';
 import IssuesServiceMock from '../../../api/mocks/IssuesServiceMock';
 import { isDiffMetric } from '../../../helpers/measures';
 import { mockComponent } from '../../../helpers/mocks/component';
 import { mockMeasure } from '../../../helpers/testMocks';
 import { renderAppWithComponentContext } from '../../../helpers/testReactTestingUtils';
+import { ReactTestingQuery, byRole, byText } from '../../../helpers/testSelector';
 import { ComponentQualifier } from '../../../types/component';
 import { MetricKey } from '../../../types/metrics';
 import { Component } from '../../../types/types';
@@ -235,7 +235,7 @@ it('should correctly show measures for a project', async () => {
   await ui.appLoaded(component.name);
 
   // Folder A
-  const folderRow = ui.measureRow(/folderA/).get();
+  const folderRow = ui.measureRow(/folderA/);
   [
     [MetricKey.ncloc, '2'],
     [MetricKey.bugs, '2'],
@@ -249,7 +249,7 @@ it('should correctly show measures for a project', async () => {
   });
 
   // index.tsx
-  const fileRow = ui.measureRow(/index\.tsx/).get();
+  const fileRow = ui.measureRow(/index\.tsx/);
   [
     [MetricKey.ncloc, '—'],
     [MetricKey.bugs, '—'],
@@ -312,7 +312,7 @@ it('should correctly show new VS overall measures for Portfolios', async () => {
   expect(ui.newCodeBtn.get()).toHaveAttribute('aria-current', 'true');
 
   // Child 1
-  let child1Row = ui.measureRow(/^Child 1/).get();
+  let child1Row = ui.measureRow(/^Child 1/);
   [
     ['Releasability', 'OK'],
     ['Reliability', 'C'],
@@ -326,7 +326,7 @@ it('should correctly show new VS overall measures for Portfolios', async () => {
   });
 
   // Child 2
-  let child2Row = ui.measureRow(/^Child 2/).get();
+  let child2Row = ui.measureRow(/^Child 2/);
   [
     ['Releasability', 'ERROR'],
     ['Reliability', '—'],
@@ -343,7 +343,7 @@ it('should correctly show new VS overall measures for Portfolios', async () => {
   await ui.showOverallCode();
 
   // Child 1
-  child1Row = ui.measureRow(/^Child 1/).get();
+  child1Row = ui.measureRow(/^Child 1/);
   [
     ['Releasability', 'OK'],
     ['Reliability', 'B'],
@@ -356,7 +356,7 @@ it('should correctly show new VS overall measures for Portfolios', async () => {
   });
 
   // Child 2
-  child2Row = ui.measureRow(/^Child 2/).get();
+  child2Row = ui.measureRow(/^Child 2/);
   [
     ['Releasability', 'ERROR'],
     ['Reliability', '—'],
@@ -384,7 +384,7 @@ function getPageObject(user: UserEvent) {
     newCodeBtn: byRole('radio', { name: 'projects.view.new_code' }),
     overallCodeBtn: byRole('radio', { name: 'projects.view.overall_code' }),
     measureRow: (name: string | RegExp) => byRole('row', { name, exact: false }),
-    measureValueCell: (row: HTMLElement, name: string, value: string) => {
+    measureValueCell: (row: ReactTestingQuery, name: string, value: string) => {
       const i = Array.from(screen.getAllByRole('columnheader')).findIndex((c) =>
         c.textContent?.includes(name)
       );
@@ -394,8 +394,7 @@ function getPageObject(user: UserEvent) {
         throw new Error(`Couldn't locate column with header ${name}`);
       }
 
-      const { getAllByRole } = within(row);
-      const cell = getAllByRole('cell').at(i);
+      const cell = row.byRole('cell').getAll().at(i);
 
       if (cell === undefined) {
         throw new Error(`Couldn't locate cell with value ${value} for header ${name}`);
index 75ce058a6f9dc258e780c047091261f5805b24b2..098dc46d64c064df8d8d56d8b450c4c9e5c75567 100644 (file)
  */
 import { fireEvent, screen, waitFor, within } from '@testing-library/react';
 import userEvent from '@testing-library/user-event';
-import { byPlaceholderText, byRole } from 'testing-library-selector';
 import CodingRulesServiceMock from '../../../api/mocks/CodingRulesServiceMock';
 import { mockCurrentUser, mockLoggedInUser } from '../../../helpers/testMocks';
 import { renderAppRoutes } from '../../../helpers/testReactTestingUtils';
+import { byPlaceholderText, byRole } from '../../../helpers/testSelector';
 import { CurrentUser } from '../../../types/users';
 import routes from '../routes';
 
index afa8beb7fd168f366465fbc81eadf9867c420a62..86d197d88bbacf8c860dd14dcf7e14cbc732a9bb 100644 (file)
@@ -21,7 +21,6 @@ import { act, 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 'testing-library-selector';
 import ComponentsServiceMock from '../../../api/mocks/ComponentsServiceMock';
 import IssuesServiceMock from '../../../api/mocks/IssuesServiceMock';
 import { MeasuresServiceMock } from '../../../api/mocks/MeasuresServiceMock';
@@ -29,6 +28,7 @@ import { mockPullRequest } from '../../../helpers/mocks/branch-like';
 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, ComponentQualifier } from '../../../types/component';
 import { MetricKey } from '../../../types/metrics';
 import routes from '../routes';
index db729469f4874b8baa37d0b03c63617e9cb50af9..a22e6d6b32f6735089031cf674a9823054dbe6e8 100644 (file)
@@ -22,12 +22,12 @@ import { act, screen } 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 'testing-library-selector';
 import { searchAzureRepositories } from '../../../../api/alm-integrations';
 import AlmIntegrationsServiceMock from '../../../../api/mocks/AlmIntegrationsServiceMock';
 import AlmSettingsServiceMock from '../../../../api/mocks/AlmSettingsServiceMock';
 import NewCodePeriodsServiceMock from '../../../../api/mocks/NewCodePeriodsServiceMock';
 import { renderApp } from '../../../../helpers/testReactTestingUtils';
+import { byLabelText, byRole, byText } from '../../../../helpers/testSelector';
 import CreateProjectPage, { CreateProjectPageProps } from '../CreateProjectPage';
 
 jest.mock('../../../../api/alm-integrations');
index d980905f2e9c4092a0036eced53e98eabcbc2a95..17d513bfb5d9d81c31ad3f779441230a30892300 100644 (file)
@@ -22,12 +22,12 @@ import { act, screen, 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 'testing-library-selector';
 import { searchForBitbucketServerRepositories } from '../../../../api/alm-integrations';
 import AlmIntegrationsServiceMock from '../../../../api/mocks/AlmIntegrationsServiceMock';
 import AlmSettingsServiceMock from '../../../../api/mocks/AlmSettingsServiceMock';
 import NewCodePeriodsServiceMock from '../../../../api/mocks/NewCodePeriodsServiceMock';
 import { renderApp } from '../../../../helpers/testReactTestingUtils';
+import { byLabelText, byRole, byText } from '../../../../helpers/testSelector';
 import CreateProjectPage, { CreateProjectPageProps } from '../CreateProjectPage';
 
 jest.mock('../../../../api/alm-integrations');
index 376024a2e447b3f96cb743ec427110154edff739..58796cf522d2cf62ecfbe860d13341a4706474dc 100644 (file)
@@ -22,12 +22,12 @@ import { act, screen, 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 'testing-library-selector';
 import { searchForBitbucketCloudRepositories } from '../../../../api/alm-integrations';
 import AlmIntegrationsServiceMock from '../../../../api/mocks/AlmIntegrationsServiceMock';
 import AlmSettingsServiceMock from '../../../../api/mocks/AlmSettingsServiceMock';
 import NewCodePeriodsServiceMock from '../../../../api/mocks/NewCodePeriodsServiceMock';
 import { renderApp } from '../../../../helpers/testReactTestingUtils';
+import { byLabelText, byRole, byText } from '../../../../helpers/testSelector';
 import CreateProjectPage, { CreateProjectPageProps } from '../CreateProjectPage';
 
 jest.mock('../../../../api/alm-integrations');
index 0f2de817cb7a128dd155ebffd5bee9de9713fd43..2662258a07b095d6cd4f3a3ae66df95dae5f43d0 100644 (file)
@@ -22,12 +22,12 @@ import { screen, 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, byText } from 'testing-library-selector';
 import { getGithubRepositories } from '../../../../api/alm-integrations';
 import AlmIntegrationsServiceMock from '../../../../api/mocks/AlmIntegrationsServiceMock';
 import AlmSettingsServiceMock from '../../../../api/mocks/AlmSettingsServiceMock';
 import NewCodePeriodsServiceMock from '../../../../api/mocks/NewCodePeriodsServiceMock';
 import { renderApp } from '../../../../helpers/testReactTestingUtils';
+import { byLabelText, byText } from '../../../../helpers/testSelector';
 import CreateProjectPage from '../CreateProjectPage';
 
 jest.mock('../../../../api/alm-integrations');
index c3e0080516f0b43fee51e6e35a978fa3efecaa3d..f53f2aef51190bc30a27750cfc5ab763e3feacf6 100644 (file)
@@ -21,12 +21,12 @@ import { act, screen, 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 'testing-library-selector';
 import { getGitlabProjects } from '../../../../api/alm-integrations';
 import AlmIntegrationsServiceMock from '../../../../api/mocks/AlmIntegrationsServiceMock';
 import AlmSettingsServiceMock from '../../../../api/mocks/AlmSettingsServiceMock';
 import NewCodePeriodsServiceMock from '../../../../api/mocks/NewCodePeriodsServiceMock';
 import { renderApp } from '../../../../helpers/testReactTestingUtils';
+import { byLabelText, byRole, byText } from '../../../../helpers/testSelector';
 import CreateProjectPage, { CreateProjectPageProps } from '../CreateProjectPage';
 
 jest.mock('../../../../api/alm-integrations');
@@ -94,9 +94,7 @@ it('should show import project feature when PAT is already set', async () => {
   expect(screen.getByText('Gitlab project 1')).toBeInTheDocument();
   expect(screen.getByText('Gitlab project 2')).toBeInTheDocument();
 
-  projectItem = screen.getByRole('row', {
-    name: 'qualifier.TRK Gitlab project 1 Company / Best Projects opens_in_new_window onboarding.create_project.gitlab.link onboarding.create_project.repository_imported',
-  });
+  projectItem = screen.getByRole('row', { name: /Gitlab project 1/ });
   expect(
     within(projectItem).getByText('onboarding.create_project.repository_imported')
   ).toBeInTheDocument();
index 06bb6cb7c3e69052a8f3b370f3a2c53ea50e6900..7fc9af55881fc0e9f526c292c15273482337a269 100644 (file)
 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 'testing-library-selector';
 import AlmSettingsServiceMock from '../../../../api/mocks/AlmSettingsServiceMock';
+import NewCodePeriodsServiceMock from '../../../../api/mocks/NewCodePeriodsServiceMock';
 import { getNewCodePeriod } from '../../../../api/newCodePeriod';
 import { mockProject } from '../../../../helpers/mocks/projects';
 import { mockAppState } from '../../../../helpers/testMocks';
 import { renderApp } from '../../../../helpers/testReactTestingUtils';
+import { byRole, byText } from '../../../../helpers/testSelector';
 import { NewCodePeriodSettingType } from '../../../../types/types';
 import CreateProjectPage, { CreateProjectPageProps } from '../CreateProjectPage';
-import NewCodePeriodsServiceMock from '../../../../api/mocks/NewCodePeriodsServiceMock';
 
 jest.mock('../../../../api/alm-settings');
 jest.mock('../../../../api/newCodePeriod');
index 8bcecd0dd45eeed53243190e78e340d6f7da0585..1bf27b9b4899c6469c294b0c156ebeabc5b5db16 100644 (file)
@@ -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 'testing-library-selector';
 import { doesComponentExists } from '../../../../api/components';
 import { renderComponent } from '../../../../helpers/testReactTestingUtils';
+import { byRole } from '../../../../helpers/testSelector';
 import ManualProjectCreate from '../manual/ManualProjectCreate';
 
 const ui = {
index b18762192b52f90f9fff14c665e4063166923728..3c8e2ef4a1c01be8edc25c557e5c054c4b9de5cc 100644 (file)
@@ -22,11 +22,11 @@ import { screen, within } from '@testing-library/react';
 import userEvent from '@testing-library/user-event';
 import * as React from 'react';
 import { act } from 'react-dom/test-utils';
-import { byRole, byText } from 'testing-library-selector';
 import AuthenticationServiceMock from '../../../api/mocks/AuthenticationServiceMock';
 import GroupsServiceMock from '../../../api/mocks/GroupsServiceMock';
 import { Provider } from '../../../components/hooks/useManageProvider';
 import { renderApp } from '../../../helpers/testReactTestingUtils';
+import { byRole, byText } from '../../../helpers/testSelector';
 import { Feature } from '../../../types/features';
 import { TaskStatuses } from '../../../types/tasks';
 import GroupsApp from '../GroupsApp';
index 59d2f52ade84eac04a2442f3519440c997bdabae..52d0908623eb64ec241546564cbe58de39ee63ee 100644 (file)
@@ -19,7 +19,7 @@
  */
 import { screen } from '@testing-library/react';
 import userEvent from '@testing-library/user-event';
-import { byRole } from 'testing-library-selector';
+import { byRole } from '../../../helpers/testSelector';
 import {
   componentsHandler,
   issuesHandler,
index b471b83dc05febf65aa17c28ab8c0e8f0168db92..a2f9cc0c33a5243b7d7acb5dcda3486c60101619 100644 (file)
@@ -21,11 +21,11 @@ import { screen } from '@testing-library/react';
 import userEvent from '@testing-library/user-event';
 import * as React from 'react';
 import { act } from 'react-dom/test-utils';
-import { byLabelText } from 'testing-library-selector';
 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';
 
index b8c65e22bb4503db1fd74ad761e4e487bea5e401..e758996e1fcff10d14749f044e87f33553a66c74 100644 (file)
  * Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
  */
 import * as React from 'react';
-import { byRole, byText } from 'testing-library-selector';
 import { mockMainBranch } from '../../../../helpers/mocks/branch-like';
 import { mockSourceViewerFile } from '../../../../helpers/mocks/sources';
 import { renderComponent } from '../../../../helpers/testReactTestingUtils';
+import { byRole, byText } from '../../../../helpers/testSelector';
 import IssueSourceViewerHeader, { Props } from '../IssueSourceViewerHeader';
 
 const ui = {
index df138d37b6744530cd9630dae0246aa0c4ca7ca4..ac9da7c0565d17a31b2e276ce4c7195f527769e1 100644 (file)
@@ -20,9 +20,9 @@
 import { screen } from '@testing-library/react';
 import { range } from 'lodash';
 import * as React from 'react';
-import { byRole } from 'testing-library-selector';
 import { mockSourceLine, mockSourceViewerFile } from '../../../../helpers/mocks/sources';
 import { renderComponent } from '../../../../helpers/testReactTestingUtils';
+import { byRole } from '../../../../helpers/testSelector';
 import SnippetViewer, { SnippetViewerProps } from '../SnippetViewer';
 
 beforeEach(() => {
index 17826853c377df80ca92966f282bb3bb3c7b261c..3962f6ba9819a34049b7d8fa6b7f472045b1e29e 100644 (file)
@@ -20,9 +20,9 @@
 import { screen } from '@testing-library/react';
 import userEvent from '@testing-library/user-event';
 import * as React from 'react';
-import { byRole, byText } from 'testing-library-selector';
 import { mockFlowLocation, mockIssue, mockPaging } from '../../../../helpers/testMocks';
 import { renderComponent } from '../../../../helpers/testReactTestingUtils';
+import { byRole, byText } from '../../../../helpers/testSelector';
 import { FCProps } from '../../../../helpers/testUtils';
 import { FlowType, Issue } from '../../../../types/types';
 import { VISIBLE_LOCATIONS_COLLAPSE } from '../IssueLocationsCrossFile';
index ced46d9607c97d633732b4fb1d66a5021298210f..77f8033af10b8d33e1c8aaf35b71943f0f386b3a 100644 (file)
  */
 import { waitFor } from '@testing-library/react';
 import React from 'react';
-import { byLabelText, byPlaceholderText, byRole, byTestId } from 'testing-library-selector';
 import ComponentsServiceMock from '../../api/mocks/ComponentsServiceMock';
 import IssuesServiceMock from '../../api/mocks/IssuesServiceMock';
 import { mockComponent } from '../../helpers/mocks/component';
 import { mockCurrentUser } from '../../helpers/testMocks';
 import { renderApp, renderAppWithComponentContext } from '../../helpers/testReactTestingUtils';
+import { byLabelText, byPlaceholderText, byRole, byTestId } from '../../helpers/testSelector';
 import { Component } from '../../types/types';
 import { CurrentUser } from '../../types/users';
 import IssuesApp from './components/IssuesApp';
index a4d8002edb9a28964a51584d810719f70afbb00a..412d3bd93ff0320cf78264f406d94a59d1b1cd4e 100644 (file)
@@ -21,7 +21,6 @@ import { act, 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 { byLabelText, byRole } from 'testing-library-selector';
 import PermissionsServiceMock from '../../../../api/mocks/PermissionsServiceMock';
 import { mockPermissionGroup, mockPermissionUser } from '../../../../helpers/mocks/permissions';
 import { PERMISSIONS_ORDER_FOR_PROJECT_TEMPLATE } from '../../../../helpers/permissions';
@@ -30,6 +29,7 @@ import {
   findTooltipWithContent,
   renderAppWithAdminContext,
 } from '../../../../helpers/testReactTestingUtils';
+import { byLabelText, byRole } from '../../../../helpers/testSelector';
 import { ComponentQualifier } from '../../../../types/component';
 import { Permissions } from '../../../../types/permissions';
 import { PermissionGroup, PermissionUser } from '../../../../types/types';
index eab1858e81f4aa17f8a9d72b32b45db18ef3711b..9d6cc707c767552bc89a7777f2958381656802b1 100644 (file)
@@ -20,7 +20,7 @@
 import { waitFor } from '@testing-library/react';
 import { UserEvent } from '@testing-library/user-event/dist/types/setup/setup';
 import selectEvent from 'react-select-event';
-import { byLabelText, byRole, byText } from 'testing-library-selector';
+import { byLabelText, byRole, byText } from '../../helpers/testSelector';
 import { Visibility } from '../../types/component';
 import { Permissions } from '../../types/permissions';
 
index 87132b7d8bf63167878fe9cb1744f3e1fae61861..f1c8eeb93114605c792f33edbfce5b5ccb6ab0c5 100644 (file)
@@ -25,7 +25,6 @@ import React from 'react';
 import { act } from 'react-dom/test-utils';
 import { Route } from 'react-router-dom';
 import selectEvent from 'react-select-event';
-import { byLabelText, byRole, byText } from 'testing-library-selector';
 import { ProjectActivityServiceMock } from '../../../../api/mocks/ProjectActivityServiceMock';
 import { TimeMachineServiceMock } from '../../../../api/mocks/TimeMachineServiceMock';
 import { parseDate } from '../../../../helpers/dates';
@@ -42,6 +41,7 @@ import {
   dateInputEvent,
   renderAppWithComponentContext,
 } from '../../../../helpers/testReactTestingUtils';
+import { byLabelText, byRole, byText } from '../../../../helpers/testSelector';
 import { ComponentQualifier } from '../../../../types/component';
 import { MetricKey, MetricType } from '../../../../types/metrics';
 import {
index c51eb64863a518d8ab09d85fa6bfc0b63b07a89e..c26cbc5c972975e17392cbad6b6158e7d78308cd 100644 (file)
@@ -21,7 +21,6 @@ import { within } from '@testing-library/react';
 import userEvent from '@testing-library/user-event';
 import { first, last } from 'lodash';
 import selectEvent from 'react-select-event';
-import { byRole, byText } from 'testing-library-selector';
 import NewCodePeriodsServiceMock from '../../../../api/mocks/NewCodePeriodsServiceMock';
 import { ProjectActivityServiceMock } from '../../../../api/mocks/ProjectActivityServiceMock';
 import { mockBranch } from '../../../../helpers/mocks/branch-like';
@@ -29,9 +28,10 @@ import { mockComponent } from '../../../../helpers/mocks/component';
 import { mockNewCodePeriodBranch } from '../../../../helpers/mocks/new-code-period';
 import { mockAppState } from '../../../../helpers/testMocks';
 import {
-  renderAppWithComponentContext,
   RenderContext,
+  renderAppWithComponentContext,
 } from '../../../../helpers/testReactTestingUtils';
+import { byRole, byText } from '../../../../helpers/testSelector';
 import { Feature } from '../../../../types/features';
 import { NewCodePeriodSettingType } from '../../../../types/types';
 import routes from '../../routes';
index 749c5c8830d288b5fbed45c8ab5e08455fa86672..9c8ebf99afe4004f2fc5a7e1aebcf308d1440146 100644 (file)
@@ -21,7 +21,6 @@
 import { act, within } from '@testing-library/react';
 import userEvent from '@testing-library/user-event';
 import React, { useEffect, useState } from 'react';
-import { byRole } from 'testing-library-selector';
 import BranchesServiceMock from '../../../api/mocks/BranchesServiceMock';
 import SettingsServiceMock from '../../../api/mocks/SettingsServiceMock';
 import BranchStatusContextProvider from '../../../app/components/branch-status/BranchStatusContextProvider';
@@ -30,6 +29,7 @@ import { ComponentContext } from '../../../app/components/componentContext/Compo
 import { mockComponent } from '../../../helpers/mocks/component';
 import { mockAppState } from '../../../helpers/testMocks';
 import { renderComponent } from '../../../helpers/testReactTestingUtils';
+import { byRole } from '../../../helpers/testSelector';
 import { AppState } from '../../../types/appstate';
 import { BranchLike } from '../../../types/branch-like';
 import { SettingsKey } from '../../../types/settings';
index b0ae3c875623a421c80e237c0995882949125e7e..e926d657f91eebd47aa822721075e433d2189984 100644 (file)
  */
 import { screen } from '@testing-library/react';
 import userEvent from '@testing-library/user-event';
-import { byRole, byText } from 'testing-library-selector';
 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';
index c01b73576d8cac630d968f16efba972e40bed361..74ac67a5f49ed4a63f1750c4f8cfe93932e31327 100644 (file)
@@ -23,9 +23,9 @@ import { last } from 'lodash';
 import React from 'react';
 import { act } from 'react-dom/test-utils';
 import { Route } from 'react-router-dom';
-import { byRole } from 'testing-library-selector';
 import ComponentsServiceMock from '../../../api/mocks/ComponentsServiceMock';
 import { renderAppWithComponentContext } from '../../../helpers/testReactTestingUtils';
+import { byRole } from '../../../helpers/testSelector';
 import ProjectKeyApp from '../ProjectKeyApp';
 
 const componentsMock = new ComponentsServiceMock();
index 317ccea3a183a91575634c93ec878ff1d146dd9a..0eb160dbf01314ed72a539a06b3d3a8a2c55cda5 100644 (file)
@@ -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 'testing-library-selector';
 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';
 
 jest.mock('../../../api/projectLinks');
index 2865c4b984af66ae2bd4adc2af4d53d911fca4cc..6fbfac1660a128fa41b559a202a479ca2f7efed5 100644 (file)
@@ -19,7 +19,6 @@
  */
 import userEvent from '@testing-library/user-event';
 import selectEvent from 'react-select-event';
-import { byRole, byText } from 'testing-library-selector';
 import { QualityGatesServiceMock } from '../../../api/mocks/QualityGatesServiceMock';
 import handleRequiredAuthorization from '../../../app/utils/handleRequiredAuthorization';
 import { mockComponent } from '../../../helpers/mocks/component';
@@ -27,6 +26,7 @@ import {
   RenderContext,
   renderAppWithComponentContext,
 } from '../../../helpers/testReactTestingUtils';
+import { byRole, byText } from '../../../helpers/testSelector';
 import { Component } from '../../../types/types';
 import routes from '../routes';
 
index 4ada7aae19b2e7af350d929e4bed6acd864c2d96..a3fa9b46259cee11482e3c29500e666fd67e0c01 100644 (file)
 import { act, getByText } from '@testing-library/react';
 import userEvent from '@testing-library/user-event';
 import selectEvent from 'react-select-event';
-import { byRole } from 'testing-library-selector';
 import QualityProfilesServiceMock from '../../../api/mocks/QualityProfilesServiceMock';
 import { mockPaging, mockRule } from '../../../helpers/testMocks';
 import { renderAppRoutes } from '../../../helpers/testReactTestingUtils';
+import { byRole } from '../../../helpers/testSelector';
 import routes from '../routes';
 
 jest.mock('../../../api/quality-profiles');
index 086527df353321417aa47bb81b27843badf70367..69f8f057701475ef205d7b6d823027a8a02e0137 100644 (file)
@@ -21,7 +21,6 @@ import { act, screen } 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 'testing-library-selector';
 import CodingRulesServiceMock from '../../../api/mocks/CodingRulesServiceMock';
 import SecurityHotspotServiceMock from '../../../api/mocks/SecurityHotspotServiceMock';
 import { getSecurityHotspots, setSecurityHotspotStatus } from '../../../api/security-hotspots';
@@ -32,6 +31,7 @@ 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 useScrollDownCompress from '../hooks/useScrollDownCompress';
index c3ca56437c3df11688cb01608d6885eec7e28dca..a57e0876dbaaa59a566c28b3087f083139d17e46 100644 (file)
  */
 import { uniq } from 'lodash';
 import * as React from 'react';
-import { byRole, byText } from 'testing-library-selector';
 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';
 
index 6abf3403c8a0618bee48f5c2200c3302c5749cde..9e872e76ef3d8c8d31c723bea5d35da2d6515b1a 100644 (file)
@@ -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 'testing-library-selector';
 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';
index a2dbdd092f9e67dc6bf1fb776a29f0c92001f564..b2e09b512634717384573bb3114056e390be901b 100644 (file)
@@ -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 'testing-library-selector';
 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';
 
index 406b219b4706e94deb1510ffcdcab62786b1d42a..f8aba024f2efafeafbcd10ef09f1793919538c2a 100644 (file)
@@ -20,9 +20,9 @@
 import { screen } from '@testing-library/react';
 import userEvent from '@testing-library/user-event';
 import * as React from 'react';
-import { byRole, byText } from 'testing-library-selector';
 import NewCodePeriodsServiceMock from '../../../../api/mocks/NewCodePeriodsServiceMock';
 import { renderComponent } from '../../../../helpers/testReactTestingUtils';
+import { byRole, byText } from '../../../../helpers/testSelector';
 import { NewCodePeriodSettingType } from '../../../../types/types';
 import NewCodePeriod from '../NewCodePeriod';
 
index d86504bdef63b3d5a661b5e538eb300ed2325a1a..cc4622d85d37f981c37eb5dd1ba4b9008aed7895 100644 (file)
@@ -22,7 +22,6 @@ 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 'testing-library-selector';
 import SettingsServiceMock from '../../../../api/mocks/SettingsServiceMock';
 import { KeyboardKeys } from '../../../../helpers/keycodes';
 import { mockComponent } from '../../../../helpers/mocks/component';
@@ -31,6 +30,7 @@ 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';
index bf4bce05fa0029c1f2c7a26643e906ca2e783297..7bd6b1295d91c3efe67e97c02b603594679b1d86 100644 (file)
@@ -19,9 +19,9 @@
  */
 import userEvent from '@testing-library/user-event';
 import React from 'react';
-import { byRole, byText } from 'testing-library-selector';
 import AlmSettingsServiceMock from '../../../../../api/mocks/AlmSettingsServiceMock';
 import { renderComponent } from '../../../../../helpers/testReactTestingUtils';
+import { byRole, byText } from '../../../../../helpers/testSelector';
 import { AlmKeys } from '../../../../../types/alm-settings';
 import AlmBindingDefinitionForm, {
   AlmBindingDefinitionFormProps,
index 5d7308fa44372bae0690435e6abad177b44e2bec..c811df5d98319b83c49e2cfb2af61b0f2a9e6023 100644 (file)
 import { screen } from '@testing-library/react';
 import userEvent from '@testing-library/user-event';
 import React from 'react';
-import { byRole, byText } from 'testing-library-selector';
 import AlmSettingsServiceMock from '../../../../../api/mocks/AlmSettingsServiceMock';
 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 AlmIntegration from '../AlmIntegration';
index a3b51f575eb27c4fd0e31e22485e83553d43d101..445d35ded8ad7ac01027703418045cd97e961d83 100644 (file)
@@ -21,7 +21,6 @@ import { act, 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 { byRole, byText } from 'testing-library-selector';
 import AuthenticationServiceMock from '../../../../../api/mocks/AuthenticationServiceMock';
 import ComputeEngineServiceMock from '../../../../../api/mocks/ComputeEngineServiceMock';
 import SettingsServiceMock from '../../../../../api/mocks/SettingsServiceMock';
@@ -29,6 +28,7 @@ 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 { GitHubProvisioningStatus } from '../../../../../types/provisioning';
 import { TaskStatuses } from '../../../../../types/tasks';
index 76feb1ec980d75982d0c69b10f637d45fca25082..e37aff3ec4790155b21976f49a36266635e452d1 100644 (file)
 import userEvent from '@testing-library/user-event';
 import React from 'react';
 import selectEvent from 'react-select-event';
-import { byRole, byText } from 'testing-library-selector';
 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,
index 8cec5e46fa340b29a03efd050d18fb85e16c2a5e..bc1c67b1d7af44a984db49789bbe29ddc8c3ea0f 100644 (file)
@@ -19,9 +19,9 @@
  */
 import userEvent from '@testing-library/user-event';
 import React from 'react';
-import { byRole } from 'testing-library-selector';
 import SettingsServiceMock from '../../../../api/mocks/SettingsServiceMock';
 import { renderComponent } from '../../../../helpers/testReactTestingUtils';
+import { byRole } from '../../../../helpers/testSelector';
 import EncryptionApp from '../EncryptionApp';
 
 let settingsMock: SettingsServiceMock;
index 79d23690ab770acce753401ee0bd8cd0244deb0a..f1ec48b95f0e6d739e0a0ef7a933fa5e9a7051e1 100644 (file)
@@ -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 'testing-library-selector';
 import SystemServiceMock from '../../../../api/mocks/SystemServiceMock';
 import { renderAppRoutes } from '../../../../helpers/testReactTestingUtils';
+import { byRole, byText } from '../../../../helpers/testSelector';
 import routes from '../../routes';
 import { LogsLevels } from '../../utils';
 
index 2ffddececf84b622a042150b6c6c626784135676..2129f201339a14546df291526b91f4a652a94e82 100644 (file)
  * along with this program; if not, write to the Free Software Foundation,
  * Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
  */
-import { byLabelText, byRole } from 'testing-library-selector';
 import SettingsServiceMock from '../../../../api/mocks/SettingsServiceMock';
 import UserTokensMock from '../../../../api/mocks/UserTokensMock';
 import handleRequiredAuthentication from '../../../../helpers/handleRequiredAuthentication';
 import { mockCurrentUser, mockLoggedInUser } from '../../../../helpers/testMocks';
 import { renderAppRoutes } from '../../../../helpers/testReactTestingUtils';
+import { byLabelText, byRole } from '../../../../helpers/testSelector';
 import { Permissions } from '../../../../types/permissions';
 import routes from '../../routes';
 
index 20043e921b46ff09c6caf3e1ba2d963492a419bd..3ca72375a7388d96d4daf1f15dd3b65df645a899 100644 (file)
@@ -22,7 +22,6 @@ import { act, screen, 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 'testing-library-selector';
 import AuthenticationServiceMock from '../../../api/mocks/AuthenticationServiceMock';
 import ComponentsServiceMock from '../../../api/mocks/ComponentsServiceMock';
 import SettingsServiceMock from '../../../api/mocks/SettingsServiceMock';
@@ -30,6 +29,7 @@ import UserTokensMock from '../../../api/mocks/UserTokensMock';
 import UsersServiceMock from '../../../api/mocks/UsersServiceMock';
 import { mockCurrentUser, mockLoggedInUser } 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 { ChangePasswordResults, CurrentUser } from '../../../types/users';
index 3f11fccd9d1aa79909ee2ccc40aba6ac6524f136..e067668bf1eb7ecdddb467612467a920b0f777ef 100644 (file)
@@ -21,12 +21,12 @@ import { queryHelpers, screen, within } from '@testing-library/react';
 import userEvent from '@testing-library/user-event';
 import * as React from 'react';
 import { act } from 'react-dom/test-utils';
-import { byText } from 'testing-library-selector';
 import ComponentsServiceMock from '../../../api/mocks/ComponentsServiceMock';
 import IssuesServiceMock from '../../../api/mocks/IssuesServiceMock';
 import { HttpStatus } from '../../../helpers/request';
 import { mockIssue } from '../../../helpers/testMocks';
 import { renderComponent } from '../../../helpers/testReactTestingUtils';
+import { byText } from '../../../helpers/testSelector';
 import SourceViewer from '../SourceViewer';
 import loadIssues from '../helpers/loadIssues';
 
index c967173eb9977600e7a10244e633e7d40f9cd7e1..c4256bf96f84a614558c8b45d0c9e152b0a9da5e 100644 (file)
@@ -22,11 +22,11 @@ import userEvent from '@testing-library/user-event';
 import { times } from 'lodash';
 import * as React from 'react';
 import selectEvent from 'react-select-event';
-import { byLabelText, byPlaceholderText, byRole, byText } from 'testing-library-selector';
 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 { MetricKey } from '../../../types/metrics';
 import { GraphType, MeasureHistory } from '../../../types/project-activity';
 import { Metric } from '../../../types/types';
index daa09bcfc8f74f1855113b3044755efa64e34f4b..46540d728c75ab3e786a64efe2eda443cbd9070a 100644 (file)
@@ -21,11 +21,11 @@ import { screen } from '@testing-library/react';
 import userEvent from '@testing-library/user-event';
 import * as React from 'react';
 import { Route } from 'react-router-dom';
-import { byRole, byText } from 'testing-library-selector';
 import { isMainBranch } from '../../../helpers/branch-like';
 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 { BranchLike } from '../../../types/branch-like';
 import { ComponentContextShape } from '../../../types/component';
 import {
index 197fd1c97b468355fcfbae3d66bb2df9f998f617..d0523e9096378028ff9fc3267ccc3e1ace75ad53 100644 (file)
@@ -19,7 +19,7 @@
  */
 import userEvent from '@testing-library/user-event';
 import * as React from 'react';
-import { byRole, byTestId } from 'testing-library-selector';
+import { byRole, byTestId } from '../../../helpers/testSelector';
 
 import { renderComponent } from '../../../helpers/testReactTestingUtils';
 import DocumentationTooltip, { DocumentationTooltipProps } from '../DocumentationTooltip';
index 2c9db394bbd31fbabed8e1b32cf6092cdf3b205f..88b5403f22b2ed2a8263d84a9465765aefda4da4 100644 (file)
@@ -20,7 +20,7 @@
 import { render } from '@testing-library/react';
 import userEvent from '@testing-library/user-event';
 import * as React from 'react';
-import { byRole, byText } from 'testing-library-selector';
+import { byRole, byText } from '../../../helpers/testSelector';
 import MultiSelect from '../MultiSelect';
 
 const ui = {
index 061ce0d6ea89419fd0ffc420e5816219a7a5be32..827d0bb6de2a417b451438ea48a943271ce54931 100644 (file)
@@ -21,7 +21,7 @@ import { act, render } 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 } from 'testing-library-selector';
+import { byRole } from '../../../helpers/testSelector';
 import Toggler from '../Toggler';
 
 beforeAll(() => {
index 96517b9dc685c519494f9bda03da0a94557befda..9c116a3ac7b7cfc7ff295ed073620cafe30f3286 100644 (file)
@@ -22,11 +22,11 @@ import { act, screen } from '@testing-library/react';
 import userEvent from '@testing-library/user-event';
 import { omit, pick } from 'lodash';
 import * as React from 'react';
-import { byLabelText, byRole, byText } from 'testing-library-selector';
 import IssuesServiceMock from '../../../api/mocks/IssuesServiceMock';
 import { KeyboardKeys } from '../../../helpers/keycodes';
 import { mockIssue, mockLoggedInUser, mockRawIssue } from '../../../helpers/testMocks';
 import { findTooltipWithContent, renderApp } from '../../../helpers/testReactTestingUtils';
+import { byLabelText, byRole, byText } from '../../../helpers/testSelector';
 import {
   IssueActions,
   IssueSeverity,
index bc2e9c8b81154611db8c64be7be92bffc22db473..ce925bf94372135f8fab4f1152af63ca2b5e16e8 100644 (file)
@@ -21,7 +21,6 @@ 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 { byLabelText, byRole, byText } from 'testing-library-selector';
 import { getAlmSettingsNoCatch } from '../../../api/alm-settings';
 import { getScannableProjects } from '../../../api/components';
 import SettingsServiceMock from '../../../api/mocks/SettingsServiceMock';
@@ -33,6 +32,7 @@ import {
 import { mockComponent } from '../../../helpers/mocks/component';
 import { mockLoggedInUser } from '../../../helpers/testMocks';
 import { renderApp } from '../../../helpers/testReactTestingUtils';
+import { byLabelText, byRole, byText } from '../../../helpers/testSelector';
 import { AlmKeys } from '../../../types/alm-settings';
 import { Feature } from '../../../types/features';
 import { Permissions } from '../../../types/permissions';
index b42006e882f63fd76ec47141ca29617adac4e513..afd7e458101143a7062820a8931001ac633371d2 100644 (file)
@@ -18,8 +18,8 @@
  * Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
  */
 import * as React from 'react';
-import { byRole } from 'testing-library-selector';
 import { renderComponent } from '../../../../helpers/testReactTestingUtils';
+import { byRole } from '../../../../helpers/testSelector';
 import { OSs, TutorialModes } from '../../types';
 import GithubCFamilyExampleRepositories, {
   GithubCFamilyExampleRepositoriesProps,
index 60c73e541921acdcd61690006371415879d660dd..0031a56f1ddec3d5524345f2b5e41ddd8ca54cab 100644 (file)
 
 import userEvent from '@testing-library/user-event';
 import React from 'react';
-import { byRole, byText } from 'testing-library-selector';
 import UserTokensMock from '../../../../api/mocks/UserTokensMock';
 import { mockComponent } from '../../../../helpers/mocks/component';
 import { mockLanguage } from '../../../../helpers/testMocks';
-import { renderApp, RenderContext } from '../../../../helpers/testReactTestingUtils';
+import { RenderContext, renderApp } from '../../../../helpers/testReactTestingUtils';
+import { byRole, byText } from '../../../../helpers/testSelector';
 import { AlmKeys } from '../../../../types/alm-settings';
 import { Feature } from '../../../../types/features';
 import {
index f91ff4835cef7bd8392bd0a5c928d55534af6101..e0cc60ca7840201bb623acb28e01e71ff97348d5 100644 (file)
 import userEvent from '@testing-library/user-event';
 import React from 'react';
 import selectEvent from 'react-select-event';
-import { byRole, byText } from 'testing-library-selector';
 import UserTokensMock from '../../../../api/mocks/UserTokensMock';
 import { mockComponent } from '../../../../helpers/mocks/component';
 import { mockLanguage, mockLoggedInUser } from '../../../../helpers/testMocks';
-import { renderApp, RenderContext } from '../../../../helpers/testReactTestingUtils';
+import { RenderContext, renderApp } from '../../../../helpers/testReactTestingUtils';
+import { byRole, byText } from '../../../../helpers/testSelector';
 import {
   getCopyToClipboardValue,
   getTutorialActionButtons,
index 4fa5d81d13d9955d442f37d29e8663eed8b0e137..0ccebaa586a82ad8501fb4ccc5470aed6d7d6751 100644 (file)
@@ -18,7 +18,7 @@
  * Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
  */
 import { screen } from '@testing-library/react';
-import { byRole, byText } from 'testing-library-selector';
+import { byRole, byText } from '../../helpers/testSelector';
 import { BuildTools, GradleBuildDSL, OSs, TutorialModes } from './types';
 
 const CI_TRANSLATE_MAP: Partial<Record<TutorialModes, string>> = {
diff --git a/server/sonar-web/src/main/js/helpers/testSelector.ts b/server/sonar-web/src/main/js/helpers/testSelector.ts
new file mode 100644 (file)
index 0000000..e558c9c
--- /dev/null
@@ -0,0 +1,398 @@
+/*
+ * SonarQube
+ * Copyright (C) 2009-2023 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 {
+  BoundFunction,
+  GetByBoundAttribute,
+  GetByRole,
+  GetByText,
+  screen,
+  waitForOptions,
+  within,
+} from '@testing-library/react';
+
+function maybeScreen(container?: HTMLElement) {
+  return container ? within(container) : screen;
+}
+
+export interface ReactTestingQuery {
+  find<T extends HTMLElement = HTMLElement>(
+    container?: HTMLElement,
+    waitForOptions?: waitForOptions
+  ): Promise<T>;
+  findAll<T extends HTMLElement = HTMLElement>(
+    container?: HTMLElement,
+    waitForOptions?: waitForOptions
+  ): Promise<T[]>;
+  get<T extends HTMLElement = HTMLElement>(container?: HTMLElement): T;
+  getAll<T extends HTMLElement = HTMLElement>(container?: HTMLElement): T[];
+  query<T extends HTMLElement = HTMLElement>(container?: HTMLElement): T | null;
+  queryAll<T extends HTMLElement = HTMLElement>(container?: HTMLElement): T[] | null;
+
+  byText(...args: Parameters<BoundFunction<GetByText>>): ReactTestingQuery;
+  byRole(...args: Parameters<BoundFunction<GetByRole>>): ReactTestingQuery;
+  byPlaceholderText(...args: Parameters<BoundFunction<GetByBoundAttribute>>): ReactTestingQuery;
+  byLabelText(...args: Parameters<BoundFunction<GetByText>>): ReactTestingQuery;
+  byTestId(...args: Parameters<BoundFunction<GetByBoundAttribute>>): ReactTestingQuery;
+  byDisplayValue(...args: Parameters<BoundFunction<GetByBoundAttribute>>): ReactTestingQuery;
+}
+
+abstract class ChainingQuery implements ReactTestingQuery {
+  abstract find<T extends HTMLElement = HTMLElement>(
+    container?: HTMLElement,
+    waitForOptions?: waitForOptions
+  ): Promise<T>;
+
+  abstract findAll<T extends HTMLElement = HTMLElement>(
+    container?: HTMLElement,
+    waitForOptions?: waitForOptions
+  ): Promise<T[]>;
+
+  abstract get<T extends HTMLElement = HTMLElement>(container?: HTMLElement): T;
+
+  abstract getAll<T extends HTMLElement = HTMLElement>(container?: HTMLElement): T[];
+
+  abstract query<T extends HTMLElement = HTMLElement>(container?: HTMLElement): T | null;
+
+  abstract queryAll<T extends HTMLElement = HTMLElement>(container?: HTMLElement): T[] | null;
+
+  byText(...args: Parameters<BoundFunction<GetByText>>): ReactTestingQuery {
+    return new ChainDispatch(this, new DispatchByText(args));
+  }
+
+  byRole(...args: Parameters<BoundFunction<GetByRole>>): ReactTestingQuery {
+    return new ChainDispatch(this, new DispatchByRole(args));
+  }
+
+  byPlaceholderText(...args: Parameters<BoundFunction<GetByBoundAttribute>>): ReactTestingQuery {
+    return new ChainDispatch(this, new DispatchByPlaceholderText(args));
+  }
+
+  byLabelText(...args: Parameters<BoundFunction<GetByText>>): ReactTestingQuery {
+    return new ChainDispatch(this, new DispatchByLabelText(args));
+  }
+
+  byTestId(...args: Parameters<BoundFunction<GetByBoundAttribute>>): ReactTestingQuery {
+    return new ChainDispatch(this, new DispatchByTestId(args));
+  }
+
+  byDisplayValue(...args: Parameters<BoundFunction<GetByBoundAttribute>>): ReactTestingQuery {
+    return new ChainDispatch(this, new DispatchByDisplayValue(args));
+  }
+}
+
+class ChainDispatch extends ChainingQuery {
+  insideQuery: ReactTestingQuery;
+  elementQuery: ReactTestingQuery;
+
+  constructor(insideQuery: ReactTestingQuery, elementQuery: ReactTestingQuery) {
+    super();
+    this.insideQuery = insideQuery;
+    this.elementQuery = elementQuery;
+  }
+
+  async find<T extends HTMLElement = HTMLElement>(
+    container?: HTMLElement,
+    waitForOptions?: waitForOptions
+  ) {
+    return this.elementQuery.get<T>(await this.insideQuery.find(container, waitForOptions));
+  }
+
+  async findAll<T extends HTMLElement = HTMLElement>(
+    container?: HTMLElement,
+    waitForOptions?: waitForOptions
+  ) {
+    return this.elementQuery.getAll<T>(await this.insideQuery.find(container, waitForOptions));
+  }
+
+  get<T extends HTMLElement = HTMLElement>(container?: HTMLElement) {
+    return this.elementQuery.get<T>(this.insideQuery.get(container));
+  }
+
+  getAll<T extends HTMLElement = HTMLElement>(container?: HTMLElement) {
+    return this.elementQuery.getAll<T>(this.insideQuery.get(container));
+  }
+
+  query<T extends HTMLElement = HTMLElement>(container?: HTMLElement) {
+    return this.elementQuery.query<T>(this.insideQuery.get(container));
+  }
+
+  queryAll<T extends HTMLElement = HTMLElement>(container?: HTMLElement) {
+    return this.elementQuery.queryAll<T>(this.insideQuery.get(container));
+  }
+}
+
+class DispatchByText extends ChainingQuery {
+  readonly args: Parameters<BoundFunction<GetByText>>;
+
+  constructor(args: Parameters<BoundFunction<GetByText>>) {
+    super();
+    this.args = args;
+  }
+
+  find<T extends HTMLElement = HTMLElement>(
+    container?: HTMLElement,
+    waitForOptions?: waitForOptions
+  ) {
+    return maybeScreen(container).findByText<T>(...this.args, waitForOptions);
+  }
+
+  findAll<T extends HTMLElement = HTMLElement>(
+    container?: HTMLElement,
+    waitForOptions?: waitForOptions
+  ) {
+    return maybeScreen(container).findAllByText<T>(...this.args, waitForOptions);
+  }
+
+  get<T extends HTMLElement = HTMLElement>(container?: HTMLElement) {
+    return maybeScreen(container).getByText<T>(...this.args);
+  }
+
+  getAll<T extends HTMLElement = HTMLElement>(container?: HTMLElement) {
+    return maybeScreen(container).getAllByText<T>(...this.args);
+  }
+
+  query<T extends HTMLElement = HTMLElement>(container?: HTMLElement) {
+    return maybeScreen(container).queryByText<T>(...this.args);
+  }
+
+  queryAll<T extends HTMLElement = HTMLElement>(container?: HTMLElement) {
+    return maybeScreen(container).queryAllByText<T>(...this.args);
+  }
+}
+
+class DispatchByLabelText extends ChainingQuery {
+  readonly args: Parameters<BoundFunction<GetByText>>;
+
+  constructor(args: Parameters<BoundFunction<GetByText>>) {
+    super();
+    this.args = args;
+  }
+
+  find<T extends HTMLElement = HTMLElement>(
+    container?: HTMLElement,
+    waitForOptions?: waitForOptions
+  ) {
+    return maybeScreen(container).findByLabelText<T>(...this.args, waitForOptions);
+  }
+
+  findAll<T extends HTMLElement = HTMLElement>(
+    container?: HTMLElement,
+    waitForOptions?: waitForOptions
+  ) {
+    return maybeScreen(container).findAllByLabelText<T>(...this.args, waitForOptions);
+  }
+
+  get<T extends HTMLElement = HTMLElement>(container?: HTMLElement) {
+    return maybeScreen(container).getByLabelText<T>(...this.args);
+  }
+
+  getAll<T extends HTMLElement = HTMLElement>(container?: HTMLElement) {
+    return maybeScreen(container).getAllByLabelText<T>(...this.args);
+  }
+
+  query<T extends HTMLElement = HTMLElement>(container?: HTMLElement) {
+    return maybeScreen(container).queryByLabelText<T>(...this.args);
+  }
+
+  queryAll<T extends HTMLElement = HTMLElement>(container?: HTMLElement) {
+    return maybeScreen(container).queryAllByLabelText<T>(...this.args);
+  }
+}
+
+class DispatchByRole extends ChainingQuery {
+  readonly args: Parameters<BoundFunction<GetByRole>>;
+
+  constructor(args: Parameters<BoundFunction<GetByRole>>) {
+    super();
+    this.args = args;
+  }
+
+  find<T extends HTMLElement = HTMLElement>(
+    container?: HTMLElement,
+    waitForOptions?: waitForOptions
+  ) {
+    return maybeScreen(container).findByRole<T>(...this.args, waitForOptions);
+  }
+
+  findAll<T extends HTMLElement = HTMLElement>(
+    container?: HTMLElement,
+    waitForOptions?: waitForOptions
+  ) {
+    return maybeScreen(container).findAllByRole<T>(...this.args, waitForOptions);
+  }
+
+  get<T extends HTMLElement = HTMLElement>(container?: HTMLElement) {
+    return maybeScreen(container).getByRole<T>(...this.args);
+  }
+
+  getAll<T extends HTMLElement = HTMLElement>(container?: HTMLElement) {
+    return maybeScreen(container).getAllByRole<T>(...this.args);
+  }
+
+  query<T extends HTMLElement = HTMLElement>(container?: HTMLElement) {
+    return maybeScreen(container).queryByRole<T>(...this.args);
+  }
+
+  queryAll<T extends HTMLElement = HTMLElement>(container?: HTMLElement) {
+    return maybeScreen(container).queryAllByRole<T>(...this.args);
+  }
+}
+
+class DispatchByTestId extends ChainingQuery {
+  readonly args: Parameters<BoundFunction<GetByBoundAttribute>>;
+
+  constructor(args: Parameters<BoundFunction<GetByBoundAttribute>>) {
+    super();
+    this.args = args;
+  }
+
+  find<T extends HTMLElement = HTMLElement>(
+    container?: HTMLElement,
+    waitForOptions?: waitForOptions
+  ) {
+    return maybeScreen(container).findByTestId<T>(...this.args, waitForOptions);
+  }
+
+  findAll<T extends HTMLElement = HTMLElement>(
+    container?: HTMLElement,
+    waitForOptions?: waitForOptions
+  ) {
+    return maybeScreen(container).findAllByTestId<T>(...this.args, waitForOptions);
+  }
+
+  get<T extends HTMLElement = HTMLElement>(container?: HTMLElement) {
+    return maybeScreen(container).getByTestId<T>(...this.args);
+  }
+
+  getAll<T extends HTMLElement = HTMLElement>(container?: HTMLElement) {
+    return maybeScreen(container).getAllByTestId<T>(...this.args);
+  }
+
+  query<T extends HTMLElement = HTMLElement>(container?: HTMLElement) {
+    return maybeScreen(container).queryByTestId<T>(...this.args);
+  }
+
+  queryAll<T extends HTMLElement = HTMLElement>(container?: HTMLElement) {
+    return maybeScreen(container).queryAllByTestId<T>(...this.args);
+  }
+}
+
+class DispatchByDisplayValue extends ChainingQuery {
+  readonly args: Parameters<BoundFunction<GetByBoundAttribute>>;
+
+  constructor(args: Parameters<BoundFunction<GetByBoundAttribute>>) {
+    super();
+    this.args = args;
+  }
+
+  find<T extends HTMLElement = HTMLElement>(
+    container?: HTMLElement,
+    waitForOptions?: waitForOptions
+  ) {
+    return maybeScreen(container).findByDisplayValue<T>(...this.args, waitForOptions);
+  }
+
+  findAll<T extends HTMLElement = HTMLElement>(
+    container?: HTMLElement,
+    waitForOptions?: waitForOptions
+  ) {
+    return maybeScreen(container).findAllByDisplayValue<T>(...this.args, waitForOptions);
+  }
+
+  get<T extends HTMLElement = HTMLElement>(container?: HTMLElement) {
+    return maybeScreen(container).getByDisplayValue<T>(...this.args);
+  }
+
+  getAll<T extends HTMLElement = HTMLElement>(container?: HTMLElement) {
+    return maybeScreen(container).getAllByDisplayValue<T>(...this.args);
+  }
+
+  query<T extends HTMLElement = HTMLElement>(container?: HTMLElement) {
+    return maybeScreen(container).queryByDisplayValue<T>(...this.args);
+  }
+
+  queryAll<T extends HTMLElement = HTMLElement>(container?: HTMLElement) {
+    return maybeScreen(container).queryAllByDisplayValue<T>(...this.args);
+  }
+}
+
+class DispatchByPlaceholderText extends ChainingQuery {
+  readonly args: Parameters<BoundFunction<GetByBoundAttribute>>;
+
+  constructor(args: Parameters<BoundFunction<GetByBoundAttribute>>) {
+    super();
+    this.args = args;
+  }
+
+  find<T extends HTMLElement = HTMLElement>(
+    container?: HTMLElement,
+    waitForOptions?: waitForOptions
+  ) {
+    return maybeScreen(container).findByPlaceholderText<T>(...this.args, waitForOptions);
+  }
+
+  findAll<T extends HTMLElement = HTMLElement>(
+    container?: HTMLElement,
+    waitForOptions?: waitForOptions
+  ) {
+    return maybeScreen(container).findAllByPlaceholderText<T>(...this.args, waitForOptions);
+  }
+
+  get<T extends HTMLElement = HTMLElement>(container?: HTMLElement) {
+    return maybeScreen(container).getByPlaceholderText<T>(...this.args);
+  }
+
+  getAll<T extends HTMLElement = HTMLElement>(container?: HTMLElement) {
+    return maybeScreen(container).getAllByPlaceholderText<T>(...this.args);
+  }
+
+  query<T extends HTMLElement = HTMLElement>(container?: HTMLElement) {
+    return maybeScreen(container).queryByPlaceholderText<T>(...this.args);
+  }
+
+  queryAll<T extends HTMLElement = HTMLElement>(container?: HTMLElement) {
+    return maybeScreen(container).queryAllByPlaceholderText<T>(...this.args);
+  }
+}
+
+export function byText(...args: Parameters<BoundFunction<GetByText>>) {
+  return new DispatchByText(args);
+}
+
+export function byRole(...args: Parameters<BoundFunction<GetByRole>>) {
+  return new DispatchByRole(args);
+}
+
+export function byPlaceholderText(...args: Parameters<BoundFunction<GetByBoundAttribute>>) {
+  return new DispatchByPlaceholderText(args);
+}
+
+export function byLabelText(...args: Parameters<BoundFunction<GetByText>>) {
+  return new DispatchByLabelText(args);
+}
+
+export function byTestId(...args: Parameters<BoundFunction<GetByBoundAttribute>>) {
+  return new DispatchByTestId(args);
+}
+
+export function byDisplayValue(...args: Parameters<BoundFunction<GetByBoundAttribute>>) {
+  return new DispatchByDisplayValue(args);
+}
index 598b2b41906e35fb8ec8c9e69be6564b79cf3bb1..0caa169d4e66a993f133fed0b779f2d2158d3774 100644 (file)
@@ -4620,7 +4620,6 @@ __metadata:
     react-virtualized: 9.22.3
     regenerator-runtime: 0.13.11
     tailwindcss: 3.3.1
-    testing-library-selector: 0.2.1
     turbo: 1.8.8
     typescript: 5.0.3
     valid-url: 1.0.9
@@ -12138,15 +12137,6 @@ __metadata:
   languageName: node
   linkType: hard
 
-"testing-library-selector@npm:0.2.1":
-  version: 0.2.1
-  resolution: "testing-library-selector@npm:0.2.1"
-  peerDependencies:
-    "@testing-library/dom": ^8.2.0
-  checksum: 4bb6d071f20b89f7954b03addd6c97479817e348c5a63f2c40693a5a93010b40418d90e30c0dfd7dc2a05e2f66a880ff4b1fa9004e7def5fbf489130b70b050b
-  languageName: node
-  linkType: hard
-
 "text-table@npm:^0.2.0":
   version: 0.2.0
   resolution: "text-table@npm:0.2.0"