Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Editor] Avoid to have the ML disclaimer when the ML engine isn't ready (bug 1917543) #18719

Merged
merged 1 commit into from
Sep 9, 2024
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
23 changes: 23 additions & 0 deletions test/integration/stamp_editor_spec.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -1096,5 +1096,28 @@ describe("Stamp Editor", () => {
await page.waitForSelector("#newAltTextDialog", { visible: false });
}
});

it("must check the new alt text flow (part 3)", async () => {
// Run sequentially to avoid clipboard issues.
for (const [, page] of pages) {
await page.evaluate(() => {
window.PDFViewerApplication.mlManager.enableAltTextModelDownload = false;
});

await switchToStamp(page);

// Add an image.
await copyImage(page, "../images/firefox_logo.png", 0);
const editorSelector = getEditorSelector(0);
await page.waitForSelector(editorSelector);
await waitForSerialized(page, 1);

// Wait for the dialog to be visible.
await page.waitForSelector("#newAltTextDialog", { visible: true });

// Check we haven't the disclaimer.
await page.waitForSelector("#newAltTextDisclaimer[hidden]");
}
});
});
});
1 change: 1 addition & 0 deletions web/new_alt_text_manager.js
Original file line number Diff line number Diff line change
Expand Up @@ -346,6 +346,7 @@ class NewAltTextManager {
this.#firstTime = firstTime;
let { mlManager } = uiManager;
let hasAI = !!mlManager;
this.#toggleTitleAndDisclaimer();

if (mlManager && !mlManager.isReady("altText")) {
hasAI = false;
Expand Down