Skip to content

Commit

Permalink
test: ✅ adding new e2e test - User can access to Ledger Support
Browse files Browse the repository at this point in the history
  • Loading branch information
VicAlbr committed Jan 9, 2025
1 parent e785a43 commit fbd9e0d
Show file tree
Hide file tree
Showing 5 changed files with 60 additions and 4 deletions.
13 changes: 11 additions & 2 deletions apps/ledger-live-desktop/src/renderer/icons/ExternalLink.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,18 @@ const path = (
d="M12.19 2.75H10a.75.75 0 0 1 0-1.5h4a.75.75 0 0 1 .75.75v4a.75.75 0 1 1-1.5 0V3.81L7.197 9.865a.75.75 0 0 1-1.06-1.061l6.052-6.053zm-.94 5.917a.75.75 0 1 1 1.5 0v4c0 1.15-.933 2.083-2.083 2.083H3.333a2.083 2.083 0 0 1-2.083-2.083V5.333c0-1.15.933-2.083 2.083-2.083h4a.75.75 0 1 1 0 1.5h-4a.583.583 0 0 0-.583.583v7.334c0 .322.261.583.583.583h7.334a.583.583 0 0 0 .583-.583v-4z"
/>
);
const ExternalLink = ({ size, dataTestId }: { size: number; dataTestId?: string }) => (
<svg viewBox="0 0 16 16" height={size} width={size} data-testid={dataTestId}>
const ExternalLink = ({
size,
dataTestId,
url,
}: {
size: number;
dataTestId?: string;
url?: string;
}) => (
<svg viewBox="0 0 16 16" height={size} width={size} data-testid={dataTestId} href={url}>
{path}
</svg>
);

export default ExternalLink;
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ const AboutRowItem = ({ url, title, desc, dataTestId }: Props) => {
cursor: "pointer",
}}
>
<IconExternalLink size={16} dataTestId={`${dataTestId}-link`} />
<IconExternalLink size={16} dataTestId={`${dataTestId}-link`} url={url} />
</Tabbable>
</SettingsSectionRow>
);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,12 @@ const SectionHelp = () => {
url={urls.chatbot}
/>
) : (
<RowItem title={t("settings.help.faq")} desc={t("settings.help.faqDesc")} url={urlFaq} />
<RowItem
title={t("settings.help.faq")}
desc={t("settings.help.faqDesc")}
url={urlFaq}
dataTestId={"ledgerSupport"}
/>
)}
<Row
title={t("settings.profile.softResetTitle")}
Expand Down
18 changes: 18 additions & 0 deletions apps/ledger-live-desktop/tests/page/settings.page.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import { AppPage } from "tests/page/abstractClasses";
import { step } from "tests/misc/reporters/step";
import { expect } from "@playwright/test";
import axios from "axios";

export class SettingsPage extends AppPage {
private manageLedgerSyncButton = this.page.getByRole("button", { name: "Manage" });
Expand All @@ -12,6 +13,7 @@ export class SettingsPage extends AppPage {
readonly experimentalTab = this.page.getByTestId("settings-experimental-tab");
private developerTab = this.page.getByTestId("settings-developer-tab");
private experimentalDevModeToggle = this.page.getByTestId("MANAGER_DEV_MODE-button");
private ledgerSupport = this.page.getByTestId("ledgerSupport-link");

readonly counterValueSelector = this.page.locator(
"[data-testid='setting-countervalue-dropDown'] .select__value-container",
Expand Down Expand Up @@ -106,4 +108,20 @@ export class SettingsPage extends AppPage {
await this.clearCacheButton.click();
await this.confirmButton.click();
}

@step("expect Ledger Support URL to be correct")
async expectLedgerSupportUrlToBeCorrect() {
expect(this.ledgerSupport).toBeVisible();
const url = await this.ledgerSupport.getAttribute("href");
if (!url) {
throw new Error("The href attribute is missing or null");
}
try {
const response = await axios.get(url);
expect(response.status).toBe(200);
} catch (error) {
throw new Error(`Failed to fetch URL ${url}`);
}
expect(url).toBe("https://support.ledger.com/?redirect=false");
}
}
24 changes: 24 additions & 0 deletions apps/ledger-live-desktop/tests/specs/speculos/settings.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -123,3 +123,27 @@ test.describe("counter value selection", () => {
},
);
});

test.describe("Ledger Support (web link)", () => {
test.use({
userdata: "skip-onboarding",
});

test(
"Verify that user can access to Ledger Support (Web Link)",
{
annotation: {
type: "TMS",
description: "B2CQA-820",
},
},
async ({ app }) => {
await addTmsLink(getDescription(test.info().annotations, "TMS").split(", "));

await app.layout.goToSettings();
await app.settings.goToHelpTab();

await app.settings.expectLedgerSupportUrlToBeCorrect();
},
);
});

0 comments on commit fbd9e0d

Please sign in to comment.