Skip to content

Commit

Permalink
Merge pull request #7658 from LedgerHQ/support/qaa143/improving_allur…
Browse files Browse the repository at this point in the history
…e_report

[QAA-143] Improving Allure report
  • Loading branch information
VicAlbr authored Aug 23, 2024
2 parents c358bb7 + 453d658 commit 93a4951
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 0 deletions.
8 changes: 8 additions & 0 deletions apps/ledger-live-desktop/tests/utils/allureUtils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@ import { allure } from "allure-playwright";
import { Page, TestInfo } from "@playwright/test";
import { promisify } from "util";
import fs from "fs";
import { takeScreenshot } from "./speculos";

const readFileAsync = promisify(fs.readFile);

export async function addTmsLink(ids: string[]) {
Expand All @@ -14,6 +16,12 @@ export async function captureArtifacts(page: Page, testInfo: TestInfo) {
const screenshot = await page.screenshot();
await testInfo.attach("Screenshot", { body: screenshot, contentType: "image/png" });

const speculosScreenshot = await takeScreenshot();
await testInfo.attach("Speculos Screenshot", {
body: speculosScreenshot,
contentType: "image/png",
});

if (page.video()) {
const finalVideoPath = await page.video()?.path();
if (finalVideoPath) {
Expand Down
13 changes: 13 additions & 0 deletions apps/ledger-live-desktop/tests/utils/speculos.ts
Original file line number Diff line number Diff line change
Expand Up @@ -335,3 +335,16 @@ export function verifyAmount(amount: string, text: string[]): boolean {
const amountDevice = text[1];
return amountDevice.includes(amount);
}

export async function takeScreenshot() {
const speculosApiPort = getEnv("SPECULOS_API_PORT");
try {
const response = await axios.get(`http://127.0.0.1:${speculosApiPort}/screenshot`, {
responseType: "arraybuffer",
});
return response.data;
} catch (error) {
console.error("Error downloading speculos screenshot:", error);
throw error;
}
}

0 comments on commit 93a4951

Please sign in to comment.