Skip to content
Open
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
45 changes: 34 additions & 11 deletions e2e/c2pa-migration-test.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -45,31 +45,45 @@ function collectPageErrors(page: import('@playwright/test').Page) {
}

test.describe('c2pa-web SDK migration — trust badge rendering', () => {
test('loads a conformant fixture image without browser errors', async ({ page }) => {
test('loads a conformant fixture image without browser errors', async ({
page,
}) => {
const { consoleErrors, pageErrors } = collectPageErrors(page);

await page.goto(`/?source=${encodeURIComponent(`${FIXTURES_BASE}/CAICAI.jpg`)}`);
await page.goto(
`/?source=${encodeURIComponent(`${FIXTURES_BASE}/CAICAI.jpg`)}`,
);

await expect(page.getByText('Content Credentials', { exact: true })).toBeVisible({
await expect(
page.getByText('Content Credentials', { exact: true }),
).toBeVisible({
timeout: 20000,
});

expect(pageErrors).toHaveLength(0);
expect(consoleErrors).toHaveLength(0);
});

test('does not show an unrecognized-issuer banner for a conformant fixture image', async ({ page }) => {
test('does not show an unrecognized-issuer banner for a conformant fixture image', async ({
page,
}) => {
const { consoleErrors, pageErrors } = collectPageErrors(page);

await page.goto(`/?source=${encodeURIComponent(`${FIXTURES_BASE}/CAICAI.jpg`)}`);
await page.goto(
`/?source=${encodeURIComponent(`${FIXTURES_BASE}/CAICAI.jpg`)}`,
);

await expect(page.getByText('Content Credentials', { exact: true })).toBeVisible({
await expect(
page.getByText('Content Credentials', { exact: true }),
).toBeVisible({
timeout: 20000,
});

// The orange "issuer couldn't be recognized" banner must not appear for an image signed
// by a conformant implementation.
await expect(page.getByText("issuer couldn't be recognized", { exact: false })).toBeHidden();
await expect(
page.getByText("issuer couldn't be recognized", { exact: false }),
).toBeHidden();

expect(pageErrors).toHaveLength(0);
expect(consoleErrors).toHaveLength(0);
Expand All @@ -78,9 +92,14 @@ test.describe('c2pa-web SDK migration — trust badge rendering', () => {
// Requires a locally-available legacy-signed image. Set TEST_LEGACY_IMAGE_PATH to an
// absolute path on disk to run this test; it is skipped when the variable is unset so that
// CI passes without the proprietary asset.
test('shows a "Legacy trust" badge for a legacy-signed image', async ({ page }) => {
test('shows a "Legacy trust" badge for a legacy-signed image', async ({
page,
}) => {
const legacyImagePath = process.env.TEST_LEGACY_IMAGE_PATH;
test.skip(!legacyImagePath, 'TEST_LEGACY_IMAGE_PATH not set — skipping legacy trust test');
test.skip(
!legacyImagePath,
'TEST_LEGACY_IMAGE_PATH not set — skipping legacy trust test',
);

const { consoleErrors, pageErrors } = collectPageErrors(page);

Expand All @@ -90,11 +109,15 @@ test.describe('c2pa-web SDK migration — trust badge rendering', () => {
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
await page.setInputFiles('input[type="file"]', legacyImagePath!);

await expect(page.getByText('Content Credentials', { exact: true })).toBeVisible({
await expect(
page.getByText('Content Credentials', { exact: true }),
).toBeVisible({
timeout: 20000,
});

await expect(page.getByText('Legacy trust', { exact: true })).toBeVisible({ timeout: 10000 });
await expect(page.getByText('Legacy trust', { exact: true })).toBeVisible({
timeout: 10000,
});

expect(pageErrors).toHaveLength(0);
expect(consoleErrors).toHaveLength(0);
Expand Down
7 changes: 7 additions & 0 deletions locales/en-US.json
Original file line number Diff line number Diff line change
Expand Up @@ -125,6 +125,13 @@
"sidebar.verify.about.issuedby.tooltip": "The \"Conformant\" badge indicates products that have met the requirements of the C2PA Conformance Program for correctness and security of implementation, and are issued certificates from the C2PA Trust List. The \"Legacy trust\" badge is for products with certificates on the frozen Interim Trust List. The correctness and security of those products have not been evaluated by the C2PA Conformance Program. <a href=\"https://c2pa.org/conformance\" target=\"_blank\" class=\"underline hover:text-gray-200\">Learn more at c2pa.org/conformance</a>",
"sidebar.verify.about.issuedby.tooltip.link": "See certificate information",
"sidebar.verify.about.issuedon": "Issued on",
"sidebar.verify.cawg.role.contributor": "Contributor",
"sidebar.verify.cawg.role.creator": "Creator",
"sidebar.verify.cawg.role.editor": "Editor",
"sidebar.verify.cawg.role.producer": "Producer",
"sidebar.verify.cawg.role.publisher": "Publisher",
"sidebar.verify.cawg.role.sponsor": "Sponsor",
"sidebar.verify.cawg.role.translator": "Translator",
"sidebar.verify.advanced": "Advanced",
"sidebar.verify.advanced.show": "Show all data",
"sidebar.verify.asset.date.on": "on",
Expand Down
1 change: 0 additions & 1 deletion playwright.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
import type { PlaywrightTestConfig } from '@playwright/test';
import testImageConfig from './e2e/c2pa-test-image-service.config';


export const port = parseInt(
(process.env.HOST_PORT as string | undefined) ?? '4173',
10,
Expand Down
Loading