mirror of
https://github.com/portainer/portainer.git
synced 2025-07-26 00:39:41 +02:00
chore(data-cy): require data-cy attributes [EE-6880] (#11453)
Some checks are pending
ci / build_images (map[arch:amd64 platform:linux version:]) (push) Waiting to run
ci / build_images (map[arch:amd64 platform:windows version:1809]) (push) Waiting to run
ci / build_images (map[arch:amd64 platform:windows version:ltsc2022]) (push) Waiting to run
ci / build_images (map[arch:arm platform:linux version:]) (push) Waiting to run
ci / build_images (map[arch:arm64 platform:linux version:]) (push) Waiting to run
ci / build_images (map[arch:ppc64le platform:linux version:]) (push) Waiting to run
ci / build_images (map[arch:s390x platform:linux version:]) (push) Waiting to run
ci / build_manifests (push) Blocked by required conditions
/ triage (push) Waiting to run
Lint / Run linters (push) Waiting to run
Test / test-client (push) Waiting to run
Test / test-server (map[arch:amd64 platform:linux]) (push) Waiting to run
Test / test-server (map[arch:amd64 platform:windows version:1809]) (push) Waiting to run
Test / test-server (map[arch:amd64 platform:windows version:ltsc2022]) (push) Waiting to run
Test / test-server (map[arch:arm64 platform:linux]) (push) Waiting to run
Some checks are pending
ci / build_images (map[arch:amd64 platform:linux version:]) (push) Waiting to run
ci / build_images (map[arch:amd64 platform:windows version:1809]) (push) Waiting to run
ci / build_images (map[arch:amd64 platform:windows version:ltsc2022]) (push) Waiting to run
ci / build_images (map[arch:arm platform:linux version:]) (push) Waiting to run
ci / build_images (map[arch:arm64 platform:linux version:]) (push) Waiting to run
ci / build_images (map[arch:ppc64le platform:linux version:]) (push) Waiting to run
ci / build_images (map[arch:s390x platform:linux version:]) (push) Waiting to run
ci / build_manifests (push) Blocked by required conditions
/ triage (push) Waiting to run
Lint / Run linters (push) Waiting to run
Test / test-client (push) Waiting to run
Test / test-server (map[arch:amd64 platform:linux]) (push) Waiting to run
Test / test-server (map[arch:amd64 platform:windows version:1809]) (push) Waiting to run
Test / test-server (map[arch:amd64 platform:windows version:ltsc2022]) (push) Waiting to run
Test / test-server (map[arch:arm64 platform:linux]) (push) Waiting to run
This commit is contained in:
parent
3cad13388c
commit
d38085a560
538 changed files with 2571 additions and 595 deletions
|
@ -69,6 +69,7 @@ export function Dialog<T>({
|
|||
color={button.color}
|
||||
key={index}
|
||||
size="medium"
|
||||
data-cy={button.dataCy}
|
||||
>
|
||||
{button.label} {button.timeout && count ? `(${count})` : null}
|
||||
</Button>
|
||||
|
|
|
@ -1,5 +1,7 @@
|
|||
import { ReactNode, useState } from 'react';
|
||||
|
||||
import { AutomationTestingProps } from '@/types';
|
||||
|
||||
import { SwitchField } from '@@/form-components/SwitchField';
|
||||
|
||||
import { ModalType, type ButtonOptions } from './types';
|
||||
|
@ -16,6 +18,7 @@ function SwitchPrompt({
|
|||
modalType,
|
||||
message,
|
||||
defaultValue = false,
|
||||
'data-cy': dataCy,
|
||||
}: {
|
||||
onSubmit: OnSubmit<{ value: boolean }>;
|
||||
title: string;
|
||||
|
@ -24,7 +27,7 @@ function SwitchPrompt({
|
|||
modalType?: ModalType;
|
||||
message?: ReactNode;
|
||||
defaultValue?: boolean;
|
||||
}) {
|
||||
} & AutomationTestingProps) {
|
||||
const [value, setValue] = useState(defaultValue);
|
||||
|
||||
return (
|
||||
|
@ -36,6 +39,7 @@ function SwitchPrompt({
|
|||
{message && <div className="mb-3">{message}</div>}
|
||||
<SwitchField
|
||||
name="value"
|
||||
data-cy={dataCy}
|
||||
label={switchLabel}
|
||||
checked={value}
|
||||
onChange={setValue}
|
||||
|
@ -56,12 +60,15 @@ export async function openSwitchPrompt(
|
|||
modalType,
|
||||
message,
|
||||
defaultValue,
|
||||
'data-cy': dataCy,
|
||||
}: {
|
||||
confirmButton?: ButtonOptions<true>;
|
||||
modalType?: ModalType;
|
||||
message?: ReactNode;
|
||||
defaultValue?: boolean;
|
||||
} = {}
|
||||
} & AutomationTestingProps = {
|
||||
'data-cy': 'switch-prompt',
|
||||
}
|
||||
) {
|
||||
return openModal(SwitchPrompt, {
|
||||
confirmButton,
|
||||
|
@ -70,5 +77,6 @@ export async function openSwitchPrompt(
|
|||
modalType,
|
||||
message,
|
||||
defaultValue,
|
||||
'data-cy': dataCy,
|
||||
});
|
||||
}
|
||||
|
|
|
@ -8,6 +8,7 @@ export interface ButtonOptions<TValue = undefined> {
|
|||
color?: ComponentProps<typeof Button>['color'];
|
||||
value?: TValue;
|
||||
timeout?: number;
|
||||
dataCy: string;
|
||||
}
|
||||
|
||||
export interface ButtonsOptions<T> {
|
||||
|
|
|
@ -7,15 +7,20 @@ import { ButtonOptions } from './types';
|
|||
export function buildConfirmButton(
|
||||
label = 'Confirm',
|
||||
color: ComponentProps<typeof Button>['color'] = 'primary',
|
||||
timeout = 0
|
||||
timeout = 0,
|
||||
dataCy = 'modal-confirm-button'
|
||||
): ButtonOptions<true> {
|
||||
return { label, color, value: true, timeout };
|
||||
return { label, color, value: true, timeout, dataCy };
|
||||
}
|
||||
|
||||
export function buildCancelButton(label = 'Cancel'): ButtonOptions<false> {
|
||||
export function buildCancelButton(
|
||||
label = 'Cancel',
|
||||
dataCy = 'modal-cancel-button'
|
||||
): ButtonOptions<false> {
|
||||
return {
|
||||
label,
|
||||
color: 'default',
|
||||
value: false,
|
||||
dataCy,
|
||||
};
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue