Skip to content
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,6 @@ exports[`AbacEnabledToggle should be disabled when abac license is not installed
<input
checked=""
class="rcx-box rcx-box--full rcx-toggle-switch__input"
data-qa-setting-id="ABAC_Enabled"
disabled=""
id="ABAC_Enabled"
type="checkbox"
Expand Down Expand Up @@ -82,7 +81,6 @@ exports[`AbacEnabledToggle should render the setting toggle when setting exists
>
<button
class="rcx-box rcx-box--full rcx-button--small-square rcx-button--icon-danger rcx-button--square rcx-button--icon rcx-button rcx-css-1rtu0k9"
data-qa-reset-setting-id="ABAC_Enabled"
title="Reset"
type="button"
>
Expand All @@ -99,7 +97,6 @@ exports[`AbacEnabledToggle should render the setting toggle when setting exists
<input
checked=""
class="rcx-box rcx-box--full rcx-toggle-switch__input"
data-qa-setting-id="ABAC_Enabled"
id="ABAC_Enabled"
type="checkbox"
/>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ type ActionSettingInputProps = SettingInputProps & {
sectionChanged: boolean;
};

function ActionSettingInput({ _id, actionText, value, hint, disabled, sectionChanged }: ActionSettingInputProps): ReactElement {
function ActionSettingInput({ actionText, value, hint, disabled, sectionChanged }: ActionSettingInputProps): ReactElement {
const { t } = useTranslation();

const dispatchToastMessage = useToastMessageDispatch();
Expand All @@ -33,7 +33,7 @@ function ActionSettingInput({ _id, actionText, value, hint, disabled, sectionCha
return (
<>
<FieldRow>
<Button data-qa-setting-id={_id} disabled={disabled || sectionChanged} primary onClick={handleClick}>
<Button disabled={disabled || sectionChanged} primary onClick={handleClick}>
{t(actionText)}
</Button>
</FieldRow>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,14 +30,8 @@ function BooleanSettingInput({
{label}
</FieldLabel>
<Box display='flex' alignItems='center'>
{hasResetButton && <ResetSettingButton mie={8} data-qa-reset-setting-id={_id} onClick={onResetButtonClick} />}
<ToggleSwitch
data-qa-setting-id={_id}
id={_id}
checked={value === true}
disabled={disabled || readonly}
onChange={handleChange}
/>
{hasResetButton && <ResetSettingButton mie={8} onClick={onResetButtonClick} />}
<ToggleSwitch id={_id} checked={value === true} disabled={disabled || readonly} onChange={handleChange} />
</Box>
</FieldRow>
{hint && <FieldHint>{hint}</FieldHint>}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,12 +38,11 @@ function CodeSettingInput({
<FieldLabel htmlFor={_id} title={_id} required={required}>
{label}
</FieldLabel>
{hasResetButton && <ResetSettingButton data-qa-reset-setting-id={_id} onClick={onResetButtonClick} />}
{hasResetButton && <ResetSettingButton onClick={onResetButtonClick} />}
</FieldRow>
{hint && <FieldHint>{hint}</FieldHint>}
<CodeMirrorBox label={label}>
<CodeMirror
data-qa-setting-id={_id}
id={_id}
mode={code}
value={value}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -53,15 +53,14 @@ function ColorSettingInput({
<FieldLabel htmlFor={_id} title={_id} required={required}>
{label}
</FieldLabel>
{hasResetButton && <ResetSettingButton data-qa-reset-setting-id={_id} onClick={onResetButtonClick} />}
{hasResetButton && <ResetSettingButton onClick={onResetButtonClick} />}
</FieldRow>
<Margins inline={4}>
<FieldRow>
<Margins inline={4}>
<Flex.Item grow={2}>
{editor === 'color' && (
<InputBox
data-qa-setting-id={_id}
type='color'
id={_id}
value={value}
Expand All @@ -74,7 +73,6 @@ function ColorSettingInput({
)}
{editor === 'expression' && (
<TextInput
data-qa-setting-id={_id}
id={_id}
value={value}
placeholder={placeholder}
Expand All @@ -86,7 +84,6 @@ function ColorSettingInput({
)}
</Flex.Item>
<Select
data-qa-setting-id={`${_id}_editor`}
type='color'
id={`${_id}_editor`}
value={editor}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,11 +32,10 @@ function FontSettingInput({
<FieldLabel htmlFor={_id} title={_id} required={required}>
{label}
</FieldLabel>
{hasResetButton && <ResetSettingButton data-qa-reset-setting-id={_id} onClick={onResetButtonClick} />}
{hasResetButton && <ResetSettingButton onClick={onResetButtonClick} />}
</FieldRow>
<FieldRow>
<TextInput
data-qa-setting-id={_id}
id={_id}
value={value}
placeholder={placeholder}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,11 +32,10 @@ function GenericSettingInput({
<FieldLabel htmlFor={_id} title={_id} required={required}>
{label}
</FieldLabel>
{hasResetButton && <ResetSettingButton data-qa-reset-setting-id={_id} onClick={onResetButtonClick} />}
{hasResetButton && <ResetSettingButton onClick={onResetButtonClick} />}
</FieldRow>
<FieldRow>
<TextInput
data-qa-setting-id={_id}
id={_id}
value={value}
placeholder={placeholder}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,11 +32,10 @@ function IntSettingInput({
<FieldLabel htmlFor={_id} title={_id} required={required}>
{label}
</FieldLabel>
{hasResetButton && <ResetSettingButton data-qa-reset-setting-id={_id} onClick={onResetButtonClick} />}
{hasResetButton && <ResetSettingButton onClick={onResetButtonClick} />}
</FieldRow>
<FieldRow>
<InputBox
data-qa-setting-id={_id}
id={_id}
type='number'
value={value}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,11 +33,10 @@ function LanguageSettingInput({
<FieldLabel htmlFor={_id} title={_id} required={required}>
{label}
</FieldLabel>
{hasResetButton && <ResetSettingButton data-qa-reset-setting-id={_id} onClick={onResetButtonClick} />}
{hasResetButton && <ResetSettingButton onClick={onResetButtonClick} />}
</FieldRow>
<FieldRow>
<Select
data-qa-setting-id={_id}
id={_id}
value={value}
placeholder={placeholder}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -46,11 +46,10 @@ function LookupSettingInput({
<FieldLabel htmlFor={_id} title={_id} required={required}>
{label}
</FieldLabel>
{hasResetButton && <ResetSettingButton data-qa-reset-setting-id={_id} onClick={onResetButtonClick} />}
{hasResetButton && <ResetSettingButton onClick={onResetButtonClick} />}
</FieldRow>
<FieldRow>
<Select
data-qa-setting-id={_id}
id={_id}
value={value}
placeholder={placeholder}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,12 +39,11 @@ function MultiSelectSettingInput({
<FieldLabel htmlFor={_id} title={_id} required={required}>
{label}
</FieldLabel>
{hasResetButton && <ResetSettingButton data-qa-reset-setting-id={_id} onClick={onResetButtonClick} />}
{hasResetButton && <ResetSettingButton onClick={onResetButtonClick} />}
</FieldRow>
<FieldRow>
<Component
max-width='full'
data-qa-setting-id={_id}
id={_id}
value={value}
placeholder={placeholder}
Expand All @@ -53,6 +52,7 @@ function MultiSelectSettingInput({
// autoComplete={autocomplete === false ? 'off' : undefined}
onChange={handleChange}
options={values.map(({ key, i18nLabel }) => [key, t(i18nLabel)])}
aria-label={_id} // FIXME: Multiselect (fuselage) should be associating the FieldLabel automatically. This is a workaround for accessibility and test locators.
/>
</FieldRow>
{hint && <FieldHint>{hint}</FieldHint>}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,11 +30,10 @@ function PasswordSettingInput({
<FieldLabel htmlFor={_id} title={_id} required={required}>
{label}
</FieldLabel>
{hasResetButton && <ResetSettingButton data-qa-reset-setting-id={_id} onClick={onResetButtonClick} />}
{hasResetButton && <ResetSettingButton onClick={onResetButtonClick} />}
</FieldRow>
<FieldRow>
<PasswordInput
data-qa-setting-id={_id}
id={_id}
value={value}
placeholder={placeholder}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ function RangeSettingInput({
<FieldLabel htmlFor={_id} title={_id} required={required}>
{label}
</FieldLabel>
{hasResetButton && <ResetSettingButton data-qa-reset-setting-id={_id} onClick={onResetButtonClick} />}
{hasResetButton && <ResetSettingButton onClick={onResetButtonClick} />}
</FieldRow>
{hint && (
<FieldRow>
Expand All @@ -39,7 +39,6 @@ function RangeSettingInput({
)}
<FieldRow>
<Slider
data-qa-setting-id={_id}
disabled={disabled || readonly}
minValue={minValue}
maxValue={maxValue}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,10 +33,9 @@ function RelativeUrlSettingInput({
<FieldLabel htmlFor={_id} title={_id} required={required}>
{label}
</FieldLabel>
{hasResetButton && <ResetSettingButton data-qa-reset-setting-id={_id} onClick={onResetButtonClick} />}
{hasResetButton && <ResetSettingButton onClick={onResetButtonClick} />}
</FieldRow>
<UrlInput
data-qa-setting-id={_id}
id={_id}
value={getAbsoluteUrl(value || '')}
placeholder={placeholder}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ function RoomPickSettingInput({
<FieldLabel htmlFor={_id} title={_id} required={required}>
{label}
</FieldLabel>
{hasResetButton && <ResetSettingButton data-qa-reset-setting-id={_id} onClick={onResetButtonClick} />}
{hasResetButton && <ResetSettingButton onClick={onResetButtonClick} />}
</FieldRow>
<FieldRow>
<RoomAutoCompleteMultiple
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,11 +37,10 @@ function SelectSettingInput({
<FieldLabel htmlFor={_id} title={_id} required={required}>
{label}
</FieldLabel>
{hasResetButton && <ResetSettingButton data-qa-reset-setting-id={_id} onClick={onResetButtonClick} />}
{hasResetButton && <ResetSettingButton onClick={onResetButtonClick} />}
</FieldRow>
<FieldRow>
<Select
data-qa-setting-id={_id}
id={_id}
value={value}
placeholder={placeholder}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,11 +31,10 @@ function SelectTimezoneSettingInput({
<FieldLabel htmlFor={_id} title={_id} required={required}>
{label}
</FieldLabel>
{hasResetButton && <ResetSettingButton data-qa-reset-setting-id={_id} onClick={onResetButtonClick} />}
{hasResetButton && <ResetSettingButton onClick={onResetButtonClick} />}
</FieldRow>
<FieldRow>
<Select
data-qa-setting-id={_id}
id={_id}
value={value}
placeholder={placeholder}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,12 +37,11 @@ function StringSettingInput({
<FieldLabel htmlFor={_id} title={_id} required={required}>
{label}
</FieldLabel>
{hasResetButton && <ResetSettingButton data-qa-reset-setting-id={_id} onClick={onResetButtonClick} />}
{hasResetButton && <ResetSettingButton onClick={onResetButtonClick} />}
</FieldRow>
<FieldRow>
{multiline ? (
<TextAreaInput
data-qa-setting-id={_id}
id={_id}
name={name}
rows={4}
Expand All @@ -56,7 +55,6 @@ function StringSettingInput({
/>
) : (
<TextInput
data-qa-setting-id={_id}
id={_id}
value={value}
name={name}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -88,11 +88,10 @@ function TimespanSettingInput({
<FieldLabel htmlFor={_id} title={_id} required={required}>
{label}
</FieldLabel>
{hasResetButton && <ResetSettingButton data-qa-reset-setting-id={_id} onClick={handleResetButtonClick} />}
{hasResetButton && <ResetSettingButton onClick={handleResetButtonClick} />}
</FieldRow>
<FieldRow>
<InputBox
data-qa-setting-id={_id}
id={_id}
type='number'
value={internalValue}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -264,7 +264,6 @@ exports[`renders WithResetButton without crashing 1`] = `
</label>
<button
class="rcx-box rcx-box--full rcx-button--small-square rcx-button--icon-danger rcx-button--square rcx-button--icon rcx-button"
data-qa-reset-setting-id="setting_id"
title="Reset"
type="button"
>
Expand Down
2 changes: 1 addition & 1 deletion apps/meteor/tests/e2e/page-objects/admin-settings.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ export class AdminSettings extends Admin {
}

get inputSiteURL(): Locator {
return this.page.locator('[data-qa-setting-id="Site_Url"]');
return this.page.getByRole('textbox', { name: 'Site URL' });
}

get btnResetSiteURL(): Locator {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ export class OmnichannelSettings {
}

get labelHideWatermark(): Locator {
return this.page.locator('label', { has: this.page.locator('[data-qa-setting-id="Livechat_hide_watermark"]') });
return this.page.locator('label').getByText('Hide "powered by Rocket.Chat"');
}

get btnSave(): Locator {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,21 +26,22 @@ test.describe.serial('settings-persistence-on-ui-navigation', () => {
test.afterAll(({ api }) => setSettingValueById(api, 'Hide_System_Messages', []));

test.skip('expect settings to persist in ui when navigating back and forth', async ({ page }) => {
const settingInput = page.locator('[data-qa-setting-id="Hide_System_Messages"] input');
const settingInput = page.getByLabel('Hide_System_Messages').getByRole('textbox');

await settingInput.pressSequentially('User joined');
await settingInput.press('Enter');

const responsePromise = page.waitForResponse(
(response) => response.url().includes('/api/v1/method.call/saveSettings') && response.status() === 200,
);

await page.locator('button:has-text("Save changes")').click();
await page.locator('button[title="Back"]').click();
await page.getByRole('button', { name: 'Save changes' }).click();
await page.getByRole('button', { name: 'Back' }).click();

await responsePromise;

await page.locator('a[href="/admin/settings/Message"] >> text=Open').click();

await expect(page.locator('label[for="Hide_System_Messages"][title="Hide_System_Messages"]')).toBeVisible();
await expect(page.getByLabel('Hide_System_Messages').getByRole('option', { name: 'User joined' })).toBeVisible();
});
});
Loading