Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[CP-3338] Add data-testid for create backup progress #2218

Merged
merged 1 commit into from
Dec 5, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 12 additions & 0 deletions libs/e2e-test-ids/src/e2e-test-ids.ts
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,18 @@ export enum PredefinedBackupPasswordTestIds {
SkipButton = "predefined-backup-password-skip-button",
}

export enum PredefinedBackupProgressTestIds {
Title = "predefined-backup-progress-title",
Description = "predefined-backup-progress-description",
ProgressBar = "predefined-backup-progress-progressbar",
}

export enum ProgressBarTestIds {
Description = "progressbar-description",
Progress = "progressbar-progress",
Details = "progressbar-details",
}

export enum ContactSupportModalTestIds {
Title = "contact-support-modal-success-title",
Description = "contact-support-modal-success-description",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import React, { useId } from "react"
import { APIFC } from "generic-view/utils"
import styled from "styled-components"
import { ProgressBarConfig, ProgressBarData } from "generic-view/models"
import { ProgressBarTestIds } from "e2e-test-ids"

export const ProgressBar: APIFC<ProgressBarData, ProgressBarConfig> = ({
data,
Expand All @@ -16,13 +17,21 @@ export const ProgressBar: APIFC<ProgressBarData, ProgressBarConfig> = ({
const id = useId()
return (
<Wrapper {...props}>
{data?.message && <Message>{data?.message}</Message>}
{data?.message && (
<Message data-testid={ProgressBarTestIds.Description}>
{data?.message}
</Message>
)}
<Progress
id={"progress-" + id}
max={config.maxValue}
value={data?.value}
data-testid={ProgressBarTestIds.Progress}
/>
<Label htmlFor={"progress-" + id}>
<Label
htmlFor={"progress-" + id}
data-testid={ProgressBarTestIds.Details}
>
{data?.value}
{config.valueUnit || "%"}
</Label>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ import { defineMessages } from "react-intl"
import { intl } from "Core/__deprecated__/renderer/utils/intl"
import { useSelector } from "react-redux"
import { backupProgress } from "generic-view/store"
import { PredefinedBackupProgressTestIds } from "e2e-test-ids"

const messages = defineMessages({
title: {
Expand Down Expand Up @@ -50,8 +51,12 @@ export const BackupProgress: FunctionComponent<Props> = ({ features }) => {
return (
<>
<Modal.TitleIcon config={{ type: IconType.Backup }} />
<Modal.Title>{intl.formatMessage(messages.title)}</Modal.Title>
<p>{intl.formatMessage(messages.description)}</p>
<Modal.Title data-testid={PredefinedBackupProgressTestIds.Title}>
{intl.formatMessage(messages.title)}
</Modal.Title>
<p data-testid={PredefinedBackupProgressTestIds.Description}>
{intl.formatMessage(messages.description)}
</p>
<Progress
config={{
maxValue: 100,
Expand All @@ -60,6 +65,7 @@ export const BackupProgress: FunctionComponent<Props> = ({ features }) => {
value: progressStatus.progress,
message: detailMessage,
}}
data-testid={PredefinedBackupProgressTestIds.ProgressBar}
/>
</>
)
Expand Down
Loading