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/**"
"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"
*/
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', () => ({
await user.keyboard('foo');
expect(getSuggestions).toHaveBeenLastCalledWith('foo', []);
- (getSuggestions as jest.Mock).mockResolvedValueOnce({
+ jest.mocked(getSuggestions).mockResolvedValueOnce({
+ projects: [],
results: [
{
items: [
key: 'bar',
match: '<mark>Bar</mark>',
name: 'Bar',
- organization: 'org',
project: 'bar',
},
],
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';
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';
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';
*/
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';
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';
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',
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 () => {
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' }),
*/
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';
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';
await ui.appLoaded(component.name);
// Folder A
- const folderRow = ui.measureRow(/folderA/).get();
+ const folderRow = ui.measureRow(/folderA/);
[
[MetricKey.ncloc, '2'],
[MetricKey.bugs, '2'],
});
// index.tsx
- const fileRow = ui.measureRow(/index\.tsx/).get();
+ const fileRow = ui.measureRow(/index\.tsx/);
[
[MetricKey.ncloc, '—'],
[MetricKey.bugs, '—'],
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'],
});
// Child 2
- let child2Row = ui.measureRow(/^Child 2/).get();
+ let child2Row = ui.measureRow(/^Child 2/);
[
['Releasability', 'ERROR'],
['Reliability', '—'],
await ui.showOverallCode();
// Child 1
- child1Row = ui.measureRow(/^Child 1/).get();
+ child1Row = ui.measureRow(/^Child 1/);
[
['Releasability', 'OK'],
['Reliability', 'B'],
});
// Child 2
- child2Row = ui.measureRow(/^Child 2/).get();
+ child2Row = ui.measureRow(/^Child 2/);
[
['Releasability', 'ERROR'],
['Reliability', '—'],
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)
);
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}`);
*/
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';
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';
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';
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');
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');
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');
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');
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');
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();
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');
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 = {
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';
*/
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,
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';
* 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 = {
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(() => {
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';
*/
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';
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';
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';
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';
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';
dateInputEvent,
renderAppWithComponentContext,
} from '../../../../helpers/testReactTestingUtils';
+import { byLabelText, byRole, byText } from '../../../../helpers/testSelector';
import { ComponentQualifier } from '../../../../types/component';
import { MetricKey, MetricType } from '../../../../types/metrics';
import {
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';
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';
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';
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';
*/
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';
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();
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');
*/
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';
RenderContext,
renderAppWithComponentContext,
} from '../../../helpers/testReactTestingUtils';
+import { byRole, byText } from '../../../helpers/testSelector';
import { Component } from '../../../types/types';
import routes from '../routes';
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');
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';
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';
*/
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';
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';
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';
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';
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';
renderAppWithComponentContext,
RenderContext,
} from '../../../../helpers/testReactTestingUtils';
+import { byRole } from '../../../../helpers/testSelector';
import { Feature } from '../../../../types/features';
import { Component } from '../../../../types/types';
import routes from '../../routes';
*/
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,
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';
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';
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';
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,
*/
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;
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';
* 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';
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';
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';
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';
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';
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 {
*/
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';
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 = {
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(() => {
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,
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';
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';
* 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,
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 {
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,
* 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>> = {
--- /dev/null
+/*
+ * 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);
+}
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
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"