Skip to content

Commit

Permalink
AKR(Frontend): Try to fix tests [deploy]
Browse files Browse the repository at this point in the history
  • Loading branch information
pkoivisto committed Oct 23, 2023
1 parent bc71f1e commit 329ce0d
Show file tree
Hide file tree
Showing 5 changed files with 6 additions and 14 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -283,7 +283,6 @@ export const PublicTranslatorFilters = ({
</Caption>
</div>
<Box
data-testid="public-translator-filters__filter__language-pair"
className="public-translator-filters__filter__language-pair"
onClick={showTranslatorsAlreadySelectedToast}
>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,18 +7,8 @@ class PublicTranslatorFilters {
elements = {
fromLangComboBox: () =>
cy.findByTestId('public-translator-filters__from-language-select'),
fromLangNativeSelect: () =>
cy
.findByTestId('public-translator-filters__filter__language-pair')
.findAllByRole('combobox')
.first(),
toLangComboBox: () =>
cy.findByTestId('public-translator-filters__to-language-select'),
toLangNativeSelect: () =>
cy
.findByTestId('public-translator-filters__filter__language-pair')
.findAllByRole('combobox')
.last(),
name: () => cy.findByTestId('public-translator-filters__name-field'),
town: () => cy.findByTestId('public-translator-filters__town-combobox'),
empty: () => cy.findByTestId('public-translator-filters__empty-btn'),
Expand All @@ -32,7 +22,7 @@ class PublicTranslatorFilters {

selectFromLangByName(isPhone: boolean, from: string) {
if (isPhone) {
this.elements.fromLangNativeSelect().select(from);
this.elements.fromLangComboBox().findByRole('option').select(from);
} else {
this.clickFromLang();
this.selectOptionByName(from);
Expand All @@ -41,7 +31,7 @@ class PublicTranslatorFilters {

selectToLangByName(isPhone: boolean, to: string) {
if (isPhone) {
this.elements.toLangNativeSelect().select(to);
this.elements.toLangComboBox().findByRole('option').select(to);
} else {
this.clickToLang();
this.selectOptionByName(to);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,7 @@ export const LanguageSelect = ({
value,
helperText,
showError,
'data-testid': rest['data-testid'],
};
for (const prop in rest) {
if (prop in nativeSelectProps) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ import { ComboBoxOption } from '../../interfaces';
import { Text } from '../Text/Text';

export interface CustomNativeSelectProps extends SelectProps {
'data-testid'?: string;
helperText?: string;
showError?: boolean;
placeholder: string;
Expand Down Expand Up @@ -61,7 +62,7 @@ export const NativeSelectWithLabel: FC<
const errorStyles = showError ? { color: 'error.main' } : {};

return (
<FormControl fullWidth error={showError}>
<FormControl data-testid={rest['data-testid']} fullWidth error={showError}>
<label htmlFor={id}>
<Text sx={errorStyles}>
<b>{label}</b>
Expand Down
1 change: 1 addition & 0 deletions frontend/packages/shared/src/interfaces/comboBox.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import { TextFieldVariant } from '../enums/common';
export type ComboBoxOption = { label: string; value: string };
export type AutocompleteValue = ComboBoxOption | null;
export interface ComboBoxProps {
'data-testid'?: string;
label?: string;
showInputLabel?: boolean;
helperText?: string;
Expand Down

0 comments on commit 329ce0d

Please sign in to comment.