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: false })).toBeVisible({
await expect(
page.getByText('Content Credentials', { exact: false }),
).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: false })).toBeVisible({
await expect(
page.getByText('Content Credentials', { exact: false }),
).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: false })).toBeVisible({
await expect(
page.getByText('Content Credentials', { exact: false }),
).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
12 changes: 1 addition & 11 deletions src/components/EmbeddedIcon/EmbeddedIcon.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -3,28 +3,18 @@
-->
<script lang="ts">
import type { ClaimGeneratorDisplayInfo } from '$src/lib/asset';
import { loadThumbnail } from '$src/lib/thumbnail';
interface DisposableBlobUrl {
url: string;
dispose: () => void;
}

import { onMount } from 'svelte';

export let generator: ClaimGeneratorDisplayInfo;
let iconUrl: string | undefined;

onMount(() => {
let dispose: DisposableBlobUrl['dispose'];

if (generator.icon) {
// The new SDK requires the active reader instance to fetch embedded resources.
// The legacy synchronous .getUrl() is not supported. Skipping icon render for now.
iconUrl = undefined;
}

return () => {
dispose?.();
};
});
</script>

Expand Down
Loading
Loading