Skip to content
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
3 changes: 3 additions & 0 deletions rfirma-app/po/ca.po
Original file line number Diff line number Diff line change
Expand Up @@ -1052,6 +1052,9 @@ msgstr "Fitxer instal·lat"
msgid "status.storeBrands.windows"
msgstr "Magatzem de Windows"

msgid "status.storeBrands.macos"
msgstr "Magatzem de macOS"

msgid "status.notices.restartFirefox"
msgstr "Reinicia el Firefox perquè tingui efecte."

Expand Down
3 changes: 3 additions & 0 deletions rfirma-app/po/en.po
Original file line number Diff line number Diff line change
Expand Up @@ -1052,6 +1052,9 @@ msgstr "Installed file"
msgid "status.storeBrands.windows"
msgstr "Windows store"

msgid "status.storeBrands.macos"
msgstr "macOS store"

msgid "status.notices.restartFirefox"
msgstr "Restart Firefox for this to take effect."

Expand Down
3 changes: 3 additions & 0 deletions rfirma-app/po/es.po
Original file line number Diff line number Diff line change
Expand Up @@ -1052,6 +1052,9 @@ msgstr "Fichero instalado"
msgid "status.storeBrands.windows"
msgstr "Almacén de Windows"

msgid "status.storeBrands.macos"
msgstr "Almacén de macOS"

msgid "status.notices.restartFirefox"
msgstr "Reinicia Firefox para que surta efecto."

Expand Down
3 changes: 3 additions & 0 deletions rfirma-app/po/eu.po
Original file line number Diff line number Diff line change
Expand Up @@ -1053,6 +1053,9 @@ msgstr "Instalatutako fitxategia"
msgid "status.storeBrands.windows"
msgstr "Windows biltegia"

msgid "status.storeBrands.macos"
msgstr "macOS biltegia"

msgid "status.notices.restartFirefox"
msgstr "Berrabiarazi Firefox eragina izan dezan."

Expand Down
3 changes: 3 additions & 0 deletions rfirma-app/po/gl.po
Original file line number Diff line number Diff line change
Expand Up @@ -1050,6 +1050,9 @@ msgstr "Ficheiro instalado"
msgid "status.storeBrands.windows"
msgstr "Almacén de Windows"

msgid "status.storeBrands.macos"
msgstr "Almacén de macOS"

msgid "status.notices.restartFirefox"
msgstr "Reinicia Firefox para que xurda efecto."

Expand Down
3 changes: 3 additions & 0 deletions rfirma-app/po/messages.pot
Original file line number Diff line number Diff line change
Expand Up @@ -1037,6 +1037,9 @@ msgstr ""
msgid "status.storeBrands.windows"
msgstr ""

msgid "status.storeBrands.macos"
msgstr ""

msgid "status.notices.restartFirefox"
msgstr ""

Expand Down
12 changes: 12 additions & 0 deletions rfirma-app/src/setup/SetupWizard.presentation.test.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import { composeStories } from "@storybook/react-vite";
import { screen } from "@testing-library/react";
import userEvent from "@testing-library/user-event";
import { describe, expect, it } from "vitest";
import { renderWithCatalog } from "../testing/render";
import * as stories from "./SetupWizard.stories";
Expand All @@ -13,6 +14,7 @@ const {
CertificateDoneHandlerPending,
WithoutAutoFirma,
ProtectionOff,
CertificateFailedOnMacos,
} = composeStories(stories);

const stepButtons = ["Instalar", "Usar rFirma", "Ahora no"];
Expand Down Expand Up @@ -99,3 +101,13 @@ describe("the protection against accidental signing", () => {
expect(await screen.findByRole("switch")).not.toBeChecked();
});
});

describe("the certificate step on macOS", () => {
it("names the macOS store among the places where the install failed", async () => {
renderWithCatalog(<CertificateFailedOnMacos />);

await userEvent.click(await screen.findByRole("button", { name: "Instalar" }));

expect(await screen.findByText("Almacén de macOS")).toBeInTheDocument();
});
});
19 changes: 18 additions & 1 deletion rfirma-app/src/setup/SetupWizard.stories.tsx
Original file line number Diff line number Diff line change
@@ -1,13 +1,14 @@
//! Las historias del asistente del primer arranque: la bienvenida y la configuración con cada estado de sus dos pasos.

import type { Meta, StoryObj } from "@storybook/react-vite";
import { fn } from "storybook/test";
import { expect, fn, userEvent, within } from "storybook/test";
import { inMemoryPreferences } from "../preferences/preferences";
import { defaults } from "../preferences/testing/fixtures";
import { memoryStatus } from "../status/status";
import { SetupWizard } from "./SetupWizard";
import {
aVersionRow,
certificateFailedOnMacos,
certificateInstalled,
certificateNotInstalled,
handlerNotOurs,
Expand Down Expand Up @@ -85,6 +86,22 @@ export const WithoutAutoFirma: Story = {
},
};

export const CertificateFailedOnMacos: Story = {
name: "2 · Configuración, certificado sin instalar en macOS",
args: {
initialStep: 2,
statusPort: {
...memoryStatus([aVersionRow, certificateNotInstalled, handlerNotOurs]),
installLocalCaCertificate: async () => certificateFailedOnMacos,
},
},
play: async ({ canvasElement }) => {
const canvas = within(canvasElement);
await userEvent.click(await canvas.findByRole("button", { name: "Instalar" }));
await expect(await canvas.findByText("Almacén de macOS")).toBeVisible();
},
};

export const ProtectionOff: Story = {
name: "2 · Configuración, sin la espera de la sede",
args: {
Expand Down
6 changes: 6 additions & 0 deletions rfirma-app/src/setup/testing/fixtures.ts
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,12 @@ export const certificateInstalled: SignalRow = {
action: null,
};

export const certificateFailedOnMacos: SignalRow = {
...certificateNotInstalled,
verdict: "incorrect",
detail: { kind: "trust", stores: [{ brand: "macos", trusted: false }] },
};

export const handlerNotOurs: SignalRow = {
signal: "siteSignature",
value: "AutoFirma",
Expand Down
2 changes: 2 additions & 0 deletions rfirma-app/src/signing/CertificateCard.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,8 @@ export function storeLabel(store: Store, t: TFunction): string {
return t("panel.certificate.stores.installed");
case "windows":
return t("status.storeBrands.windows");
case "macos":
return t("status.storeBrands.macos");
}
}

Expand Down
9 changes: 9 additions & 0 deletions rfirma-app/src/signing/CertificateSelect.stories.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import { fn } from "storybook/test";
import { CertificateSelect } from "./CertificateSelect";
import {
ENTITY_CERTIFICATE,
MACOS_CERTIFICATE,
PERSONAL_CERTIFICATE,
STORY_CERTIFICATES,
} from "./testing/storyReports";
Expand Down Expand Up @@ -53,4 +54,12 @@ export const Searching: Story = { args: { certificates: [], chosen: null, search

export const Disabled: Story = { args: { disabled: true } };

export const OpenWithMacosStore: Story = {
args: {
certificates: [MACOS_CERTIFICATE, PERSONAL_CERTIFICATE],
chosen: MACOS_CERTIFICATE,
defaultOpen: true,
},
};

export const Open: Story = { args: { defaultOpen: true } };
10 changes: 10 additions & 0 deletions rfirma-app/src/signing/CertificateSelect.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -247,6 +247,16 @@ describe("CertificateSelect", () => {
expect(within(row(0)).getByText("Tarjeta")).toBeVisible();
});

it("names the macOS personal store as the macOS store", async () => {
renderSelect({
certificates: [aCertificate({ id: "macos", stores: ["macos"] })],
});

await userEvent.click(box());

expect(within(row(0)).getByText("Almacén de macOS")).toBeVisible();
});

it("tags a DNIe certificate as «DNIe» and a certificate on any other card as «Tarjeta»", async () => {
renderSelect({
certificates: [
Expand Down
1 change: 1 addition & 0 deletions rfirma-app/src/signing/certificate.ts
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,7 @@ type CertificateStoreClass =
| "nssdb"
| "installed"
| "windows"
| "macos"
| BrowserStoreMark;

/** Un certificado elegible, con lo justo para pintarlo y para firmar con él. */
Expand Down
9 changes: 9 additions & 0 deletions rfirma-app/src/signing/testing/storyReports.ts
Original file line number Diff line number Diff line change
Expand Up @@ -181,6 +181,15 @@ const NOT_YET_VALID_CERTIFICATE = aCertificate({
status: { kind: "notYetValid", notBefore: IN_2099 },
});

export const MACOS_CERTIFICATE = aCertificate({
id: "macos",
holderName: "BABBAGE CHARLES",
givenName: "Charles",
surname: "Babbage",
idNumber: "IDCES-00000002W",
stores: ["macos"],
});

export const STORY_CERTIFICATES: readonly Certificate[] = [
PERSONAL_CERTIFICATE,
ENTITY_CERTIFICATE,
Expand Down
5 changes: 5 additions & 0 deletions rfirma-app/src/status/StatusView.presentation.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -118,6 +118,11 @@ const table: Record<keyof typeof stories, Expected> = {
buttons: [],
absent: ["No aplica"],
},
UserCertificatesOnMacos: {
texts: ["Almacén de macOS", "Tarjeta"],
buttons: ["Ver dónde"],
absent: ["Almacén de Windows"],
},
UserCertificatesDetailExpanded: {
texts: [
"Almacén de Windows",
Expand Down
5 changes: 5 additions & 0 deletions rfirma-app/src/status/StatusView.stories.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ import {
sitesUnavailableOutsideFlatpak,
sitesWithTwoCandidates,
someUserCertificates,
someUserCertificatesOnMacos,
versionChecking,
versionOutdated,
versionUpToDate,
Expand Down Expand Up @@ -122,6 +123,10 @@ export const CardReaderMissing = panel([cardReaderMissing]);

export const CardReaderNotSupported = panel([cardReaderNotSupported]);

export const UserCertificatesOnMacos = panel([someUserCertificatesOnMacos], {
initiallyExpanded: ["userCertificates"],
});

export const UserCertificatesDetailExpanded = panel([someUserCertificates], {
initiallyExpanded: ["userCertificates"],
});
5 changes: 4 additions & 1 deletion rfirma-app/src/status/status.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,8 @@ export type StoreBrand =
| "nssdb"
| "card"
| "installed"
| "windows";
| "windows"
| "macos";

export interface StoreDetail {
brand: StoreBrand;
Expand All @@ -44,6 +45,8 @@ export function storeBrandLabel(t: TFunction, brand: StoreBrand): string {
return t("status.storeBrands.installed");
case "windows":
return t("status.storeBrands.windows");
case "macos":
return t("status.storeBrands.macos");
}
}

Expand Down
11 changes: 11 additions & 0 deletions rfirma-app/src/status/testing/fixtures.ts
Original file line number Diff line number Diff line change
Expand Up @@ -148,6 +148,17 @@ export const someUserCertificates: SignalRow = {
},
};

export const someUserCertificatesOnMacos: SignalRow = {
...someUserCertificates,
detail: {
kind: "certificates",
stores: [
{ brand: "macos", certificates: 2 },
{ brand: "card", certificates: 1 },
],
},
};

export const cardReaderDetected = cardReaderRow({ kind: "noCard" });

export const cardReaderMissing = cardReaderRow({ kind: "noReader" });
Expand Down
Loading