Skip to content

Create polished demo videos without editing skills. Mac/Windows/Linux

Integrate publishing with main and preserve export error reporting

webadderall356e32d7fad1
diff --cc src/components/video-editor/layout/EditorExportMenu.tsx
index 292458db,ac4a7aa2..ff2dee84
--- a/src/components/video-editor/layout/EditorExportMenu.tsx
+++ b/src/components/video-editor/layout/EditorExportMenu.tsx
@@@ -1,10 -1,10 +1,11 @@@
+ import { ExportErrorReportButton } from "@/components/feedback/ExportErrorReportButton";
-import { useEffect, useState } from "react";
-import { CloudArrowUp } from "@/components/ui/icons";
+import { LinkSimple, HardDrive, Export } from "@phosphor-icons/react";
+import { useEffect, useLayoutEffect, useRef, useState } from "react";
import { CloudShareButton } from "../cloud/CloudShareButton";
-import { Card } from "@heroui/react";
+import { Card, TagGroup, Tag } from "@heroui/react";
+import { motion, useReducedMotion } from "motion/react";
import { ProgressBar } from "@heroui/react";
-import { DownloadSimple as Download } from "@/components/ui/icons";
+
import { toast } from "@/components/ui/toast";
import { Button } from "@/components/ui/button";
import { Popover, PopoverContent, PopoverTrigger } from "@/components/ui/popover";
@@@ -185,267 -128,254 +186,279 @@@ export function EditorExportMenu(props
</Button>
</PopoverTrigger>
<PopoverContent
- aria-label="Export"
+ aria-label="Publish"
align="end"
sideOffset={10}
- className="w-[360px] p-0"
+ className="w-[360px] max-h-none overflow-hidden p-0"
+ isKeyboardDismissDisabled={shareBusy}
+ shouldCloseOnInteractOutside={() => !shareBusy}
>
- {isExporting ? (
- <Card className="rounded-none bg-transparent p-5 text-foreground shadow-none">
- <div className="mb-3 flex items-center justify-between gap-3">
- <div>
- <p className="text-sm font-semibold text-foreground">
- {t("editor.exportStatus.exporting", "Exporting")}
- </p>
- <p className="text-xs text-muted-foreground">
- {t(
- "editor.exportStatus.renderingFile",
- "Rendering your file.",
- )}
- </p>
- {isLightningExportInProgress && exportMessage ? (
- <p className="mt-1 text-[11px] leading-relaxed text-muted-foreground/70">
- {exportMessage}
- </p>
- ) : null}
- {isLegacyExportInProgress ? (
- <p className="mt-1 text-[11px] text-muted-foreground/70">
- Export too slow? Cancel and try Lightning export!
- </p>
- ) : null}
- </div>
- <Button
- type="button"
- variant="outline"
- onClick={handleCancelExport}
- className="h-8 px-3 text-xs"
- >
- {t("common.actions.cancel")}
- </Button>
- </div>
- <ProgressBar
- aria-label={t("editor.exportStatus.exporting", "Exporting")}
- isIndeterminate={
- isExportPreparing ||
- isExportSaving ||
- isExportFinalSaveIndeterminate
- }
- value={Math.min(
- isRenderingAudio
- ? (exportProgress?.audioProgress ?? 0) * 100
- : (exportFinalizingProgress ??
- exportProgress?.percentage ??
- 8),
- 100,
- )}
- >
- <ProgressBar.Track>
- <ProgressBar.Fill />
- </ProgressBar.Track>
- </ProgressBar>
- <p className="mt-2 text-xs text-muted-foreground">
- {exportPercentLabel}
- </p>
- {isRenderingAudio ? (
- <p className="mt-1 text-[11px] text-muted-foreground/70">
- {t(
- "editor.export.processingAudioEdits",
- "Processing audio with speed/overlay edits",
- )}
- </p>
- ) : exportRenderSpeedLabel ? (
- <p className="mt-1 text-[11px] text-muted-foreground/70">
- {exportRenderSpeedLabel}
- </p>
- ) : null}
- {exportRuntimeLabel ? (
- <p className="mt-1 text-[11px] text-muted-foreground/70">
- Path: {exportRuntimeLabel}
- </p>
- ) : null}
- {exportNativeSkipLabel ? (
- <p className="mt-1 text-[11px] text-amber-500/80">
- {exportNativeSkipLabel}
- </p>
- ) : null}
- </Card>
- ) : exportError ? (
- <Card className="rounded-none bg-transparent p-5 text-foreground shadow-none">
- <p className="text-sm font-semibold text-foreground">
- {t("editor.exportStatus.issue", "Export issue")}
- </p>
- {exportRuntimeLabel ? (
- <p className="mt-1 text-[11px] text-muted-foreground/70">
- Path: {exportRuntimeLabel}
- </p>
- ) : null}
- <p className="mt-1 select-text whitespace-pre-wrap break-words text-xs leading-relaxed text-muted-foreground">
- {exportError}
- </p>
- <div className="mt-4 flex gap-2">
- <Button
- type="button"
- variant="outline"
- className="h-8 text-xs"
- onClick={async () => {
- try {
- await navigator.clipboard.writeText(exportError);
- toast.success(
- t(
- "editor.exportStatus.errorCopied",
- "Error copied",
- ),
- );
- } catch {
- toast.error(
- t(
- "editor.exportStatus.errorCopyFailed",
- "Couldn't copy. Select the error text and copy it manually.",
- ),
- );
- }
+ <motion.div
+ initial={false}
+ animate={{ height: contentHeight ?? "auto" }}
+ transition={{ duration: reducedMotion ? 0 : 0.22, ease: "easeInOut" }}
+ className="overflow-hidden"
+ >
+ <div ref={contentRef}>
+ <div className="p-5 space-y-3">
+ <h2 className="text-sm font-semibold">Publish</h2>
+ <TagGroup
+ aria-label="Publish destination"
+ selectionMode="single"
+ disallowEmptySelection
+ selectedKeys={[destination]}
+ onSelectionChange={(keys) => {
+ if (
+ keys !== "all" &&
+ keys.size > 0 &&
+ !isExporting &&
+ !shareBusy
+ )
+ setDestination(keys.has("link") ? "link" : "local");
}}
>
- {t("editor.exportStatus.copyError", "Copy error")}
- </Button>
- <ExportErrorReportButton
- key={exportError}
- error={exportError}
- format={exportFormat}
- />
- {hasPendingExportSave ? (
- <Button
- type="button"
- onClick={handleRetrySaveExport}
- className="h-8 flex-1 text-xs"
- >
- {t("editor.actions.saveAgain", "Save Again")}
- </Button>
- ) : null}
- <Button
- type="button"
- variant="outline"
- onClick={handleExportDropdownClose}
- className="h-8 flex-1 text-xs"
- >
- {t("common.actions.close", "Close")}
- </Button>
+ <TagGroup.List className="flex gap-2">
+ <Tag
+ id="link"
+ isDisabled={isExporting || shareBusy}
+ className="h-24 flex-1 flex-col justify-center gap-2 rounded-xl border border-foreground/10"
+ >
+ <LinkSimple className="size-6" />
+ Link
+ </Tag>
+ <Tag
+ id="local"
+ isDisabled={isExporting || shareBusy}
+ className="h-24 flex-1 flex-col justify-center gap-2 rounded-xl border border-foreground/10"
+ >
+ <HardDrive className="size-6" />
+ Local
+ </Tag>
+ </TagGroup.List>
+ </TagGroup>
</div>
- </Card>
- ) : exportedFilePath ? (
- <Card className="rounded-none bg-transparent p-5 text-foreground shadow-none">
- <p className="text-sm font-semibold text-foreground">
- {t("editor.exportStatus.complete", "Export complete")}
- </p>
- <p className="mt-1 text-xs text-muted-foreground">
- {t(
- "editor.exportStatus.savedSuccessfully",
- "Your file was saved successfully.",
+ <div>
+ {destination === "link" ? (
+ <div className="px-5 pb-5">
+ <CloudShareButton
+ inline
+ projectPath={props.projectPath}
+ projectTitle={props.projectTitle}
+ prepareFile={props.prepareExportForShare}
+ onCancelPrepare={handleCancelExport}
+ preparationProgress={exportProgress?.percentage ?? 0}
+ authToken={props.authToken}
+ accountId={props.accountId}
+ onBusyChange={setShareBusy}
+ onRequestSignIn={() => {
+ setShowExportDropdown(false);
+ props.onRequestShareSignIn();
+ }}
+ />
++ {exportError && !shareBusy && (
++ <ExportErrorReportButton
++ key={exportError}
++ error={exportError}
++ format="mp4"
++ />
++ )}
+ </div>
+ ) : isExporting ? (
+ <Card className="rounded-none bg-transparent p-5 text-foreground shadow-none">
+ <div className="mb-3 flex items-center justify-between gap-3">
+ <div>
+ <p className="text-sm font-semibold text-foreground">
+ {t(
+ "editor.exportStatus.exporting",
+ "Exporting",
+ )}
+ </p>
+ <p className="text-xs text-muted-foreground">
+ {t(
+ "editor.exportStatus.renderingFile",
+ "Rendering your file.",
+ )}
+ </p>
+ {isLightningExportInProgress && exportMessage ? (
+ <p className="mt-1 text-[11px] leading-relaxed text-muted-foreground/70">
+ {exportMessage}
+ </p>
+ ) : null}
+ {isLegacyExportInProgress ? (
+ <p className="mt-1 text-[11px] text-muted-foreground/70">
+ Export too slow? Cancel and try Lightning
+ export!
+ </p>
+ ) : null}
+ </div>
+ <Button
+ type="button"
+ variant="outline"
+ onClick={handleCancelExport}
+ className="h-8 px-3 text-xs"
+ >
+ {t("common.actions.cancel")}
+ </Button>
+ </div>
+ <ProgressBar
+ aria-label={t(
+ "editor.exportStatus.exporting",
+ "Exporting",
+ )}
+ isIndeterminate={
+ isExportPreparing ||
+ isExportSaving ||
+ isExportFinalSaveIndeterminate
+ }
+ value={Math.min(
+ isRenderingAudio
+ ? (exportProgress?.audioProgress ?? 0) * 100
+ : (exportFinalizingProgress ??
+ exportProgress?.percentage ??
+ 8),
+ 100,
+ )}
+ >
+ <ProgressBar.Track>
+ <ProgressBar.Fill />
+ </ProgressBar.Track>
+ </ProgressBar>
+ <p className="mt-2 text-xs text-muted-foreground">
+ {exportPercentLabel}
+ </p>
+ {isRenderingAudio ? (
+ <p className="mt-1 text-[11px] text-muted-foreground/70">
+ {t(
+ "editor.export.processingAudioEdits",
+ "Processing audio with speed/overlay edits",
+ )}
+ </p>
+ ) : exportRenderSpeedLabel ? (
+ <p className="mt-1 text-[11px] text-muted-foreground/70">
+ {exportRenderSpeedLabel}
+ </p>
+ ) : null}
+ {exportRuntimeLabel ? (
+ <p className="mt-1 text-[11px] text-muted-foreground/70">
+ Path: {exportRuntimeLabel}
+ </p>
+ ) : null}
+ {exportNativeSkipLabel ? (
+ <p className="mt-1 text-[11px] text-amber-500/80">
+ {exportNativeSkipLabel}
+ </p>
+ ) : null}
+ </Card>
+ ) : exportError ? (
+ <Card className="rounded-none bg-transparent p-5 text-foreground shadow-none">
+ <p className="text-sm font-semibold text-foreground">
+ {t("editor.exportStatus.issue", "Export issue")}
+ </p>
+ {exportRuntimeLabel ? (
+ <p className="mt-1 text-[11px] text-muted-foreground/70">
+ Path: {exportRuntimeLabel}
+ </p>
+ ) : null}
+ <p className="mt-1 select-text whitespace-pre-wrap break-words text-xs leading-relaxed text-muted-foreground">
+ {exportError}
+ </p>
+ <div className="mt-4 flex gap-2">
+ <Button
+ type="button"
+ variant="outline"
+ className="h-8 text-xs"
+ onClick={async () => {
+ try {
+ await navigator.clipboard.writeText(
+ exportError,
+ );
+ toast.success(
+ t(
+ "editor.exportStatus.errorCopied",
+ "Error copied",
+ ),
+ );
+ } catch {
+ toast.error(
+ t(
+ "editor.exportStatus.errorCopyFailed",
+ "Couldn't copy. Select the error text and copy it manually.",
+ ),
+ );
+ }
+ }}
+ >
+ {t("editor.exportStatus.copyError", "Copy error")}
+ </Button>
++ <ExportErrorReportButton
++ key={exportError}
++ error={exportError}
++ format={exportFormat}
++ />
+ {hasPendingExportSave ? (
+ <Button
+ type="button"
+ onClick={handleRetrySaveExport}
+ className="h-8 flex-1 text-xs"
+ >
+ {t("editor.actions.saveAgain", "Save Again")}
+ </Button>
+ ) : null}
+ <Button
+ type="button"
+ variant="outline"
+ onClick={handleExportDropdownClose}
+ className="h-8 flex-1 text-xs"
+ >
+ {t("common.actions.close", "Close")}
+ </Button>
+ </div>
+ </Card>
+ ) : exportedFilePath ? (
+ <Card className="rounded-none bg-transparent p-5 text-foreground shadow-none">
+ <p className="text-sm font-semibold text-foreground">
+ {t("editor.exportStatus.complete", "Export complete")}
+ </p>
+ <p className="mt-1 text-xs text-muted-foreground">
+ {t(
+ "editor.exportStatus.savedSuccessfully",
+ "Your file was saved successfully.",
+ )}
+ </p>
+ {exportRuntimeLabel ? (
+ <p className="mt-1 text-[11px] text-muted-foreground/70">
+ Path: {exportRuntimeLabel}
+ </p>
+ ) : null}
+ <p className="mt-3 truncate text-xs text-muted-foreground/70">
+ {exportedFilePath.split(/[\\/]/).pop()}
+ </p>
+ <div className="mt-4 flex gap-2">
+ <Button
+ type="button"
+ onClick={revealExportedFile}
+ className="h-8 flex-1 text-xs"
+ >
+ {t("editor.actions.showInFolder", "Show In Folder")}
+ </Button>
+ <Button
+ type="button"
+ variant="outline"
+ onClick={handleExportDropdownClose}
+ className="h-8 flex-1 text-xs"
+ >
+ {t("editor.cloud.done")}
+ </Button>
+ </div>
+ </Card>
+ ) : (
+ <>{settingsForm}</>
)}
- </p>
- {exportRuntimeLabel ? (
- <p className="mt-1 text-[11px] text-muted-foreground/70">
- Path: {exportRuntimeLabel}
- </p>
- ) : null}
- <p className="mt-3 truncate text-xs text-muted-foreground/70">
- {exportedFilePath.split(/[\\/]/).pop()}
- </p>
- <div className="mt-4 flex gap-2">
- <Button
- type="button"
- onClick={revealExportedFile}
- className="h-8 flex-1 text-xs"
- >
- {t("editor.actions.showInFolder", "Show In Folder")}
- </Button>
- <Button
- type="button"
- variant="outline"
- onClick={handleExportDropdownClose}
- className="h-8 flex-1 text-xs"
- >
- {t("editor.cloud.done")}
- </Button>
- </div>
- </Card>
- ) : (
- <>
- <ExportSettingsMenu
- exportFormat={exportFormat}
- onExportFormatChange={setExportFormat}
- exportEncodingMode={exportEncodingMode}
- onExportEncodingModeChange={setExportEncodingMode}
- mp4FrameRate={mp4FrameRate}
- onMp4FrameRateChange={setMp4FrameRate}
- exportPipelineModel={exportPipelineModel}
- experimentalNvidiaCudaExport={
- experimentalNvidiaCudaExport && nvidiaCudaExportAvailable
- }
- onExperimentalNvidiaCudaExportChange={
- setExperimentalNvidiaCudaExport
- }
- nvidiaCudaExportAvailable={nvidiaCudaExportAvailable}
- exportQuality={exportQuality}
- onExportQualityChange={setExportQuality}
- gifFrameRate={gifFrameRate}
- onGifFrameRateChange={setGifFrameRate}
- gifLoop={gifLoop}
- onGifLoopChange={setGifLoop}
- gifSizePreset={gifSizePreset}
- onGifSizePresetChange={setGifSizePreset}
- showCaptionSidecarOption={
- hasCaptionsForSidecar && exportFormat === "mp4"
- }
- includeCaptionSidecar={includeCaptionSidecar}
- onIncludeCaptionSidecarChange={setIncludeCaptionSidecar}
- mp4OutputDimensions={mp4OutputDimensions}
- gifOutputDimensions={gifOutputDimensions}
- onExport={handleStartExportFromDropdown}
- className="rounded-none bg-transparent p-5 shadow-none"
- />
- <div className="px-5 pb-5">
- <Button
- variant="secondary"
- className="w-full"
- onClick={() => {
- setShowExportDropdown(false);
- props.onRequestShareSignIn();
- }}
- >
- <CloudArrowUp className="size-4" />
- {t("editor.cloud.createShareLink")}
- </Button>
</div>
- </>
- )}
+ </div>
+ </motion.div>
</PopoverContent>
</Popover>
- {shareOpen && (
- <CloudShareButton
- projectPath={props.projectPath}
- hideTrigger
- open={shareOpen}
- onOpenChange={setShareOpen}
- projectTitle={props.projectTitle}
- prepareFile={props.prepareExportForShare}
- onCancelPrepare={handleCancelExport}
- authToken={props.authToken}
- />
- )}
</>
);
}
diff --cc tests/ui/publish-cloud.spec.ts
index 199a2fea,00000000..cf1de692
mode 100644,000000..100644
--- a/tests/ui/publish-cloud.spec.ts
+++ b/tests/ui/publish-cloud.spec.ts
@@@ -1,141 -1,0 +1,154 @@@
+import { expect, test } from "@playwright/test";
+
+test("publish preserves local destination and stays open throughout sharing", async ({ page }) => {
+ await page.goto("/tests/ui/publish.html?switch");
+ await page.getByRole("button", { name: "Publish", exact: true }).click();
+ await page.getByRole("row", { name: "Local", exact: true }).click();
+ await expect(page.getByRole("button", { name: "Export Video", exact: true })).toBeVisible();
+ await page.reload();
+ await page.getByRole("button", { name: "Publish", exact: true }).click();
+ await expect(page.getByRole("row", { name: "Local", exact: true })).toHaveAttribute(
+ "aria-selected",
+ "true",
+ );
+ await page.getByRole("row", { name: "Link", exact: true }).click();
+ await page.getByRole("button", { name: "Share", exact: true }).click();
+ await expect(page.getByText(/Uploading ·/)).toBeVisible();
+ await page.keyboard.press("Escape");
+ await expect(page.getByText(/Uploading ·/)).toBeVisible();
+ await expect(page.getByRole("row", { name: "Local", exact: true })).toHaveAttribute(
+ "aria-disabled",
+ "true",
+ );
+ await expect(page.getByRole("button", { name: "Copy link", exact: true })).toBeVisible({
+ timeout: 20000,
+ });
+ await page
+ .getByRole("button", { name: "Fixture refresh token", exact: true })
+ .evaluate((button: HTMLButtonElement) => button.click());
+ await expect(page.getByRole("button", { name: "Copy link", exact: true })).toBeVisible();
+ await page
+ .getByRole("button", { name: "Fixture switch account", exact: true })
+ .evaluate((button: HTMLButtonElement) => button.click());
+ await expect(page.getByRole("button", { name: "Copy link", exact: true })).toHaveCount(0);
+});
+
+test("a full cloud quota prevents starting preparation", async ({ page }) => {
+ await page.goto("/tests/ui/publish.html?full");
+ await page.getByRole("button", { name: "Publish", exact: true }).click();
+ await expect(
+ page.getByText(
+ "You have 5 cloud recordings. Delete one from Shared before sharing another.",
+ ),
+ ).toBeVisible();
+ await expect(page.getByRole("button", { name: "Share", exact: true })).toBeDisabled();
+});
+
+test("shared cards open ready links and delete incomplete uploads", async ({ page }) => {
+ await page.goto("/tests/ui/shared-recordings.html");
+ await page.getByRole("button", { name: "Product walkthrough", exact: true }).click();
+ await expect(page.getByRole("status")).toHaveText("Opened https://example.test/s/demo1");
+ await expect(
+ page.getByRole("button", { name: "An interrupted upload", exact: true }),
+ ).toBeDisabled();
+ await page
+ .getByRole("button", { name: "Options for An interrupted upload", exact: true })
+ .click();
+ page.once("dialog", (dialog) => dialog.dismiss());
+ await page.getByRole("menuitem", { name: "Delete recording", exact: true }).click();
+ await expect(
+ page.getByRole("button", { name: "An interrupted upload", exact: true }),
+ ).toHaveCount(1);
+ await page
+ .getByRole("button", { name: "Options for An interrupted upload", exact: true })
+ .click();
+ page.once("dialog", (dialog) => dialog.accept());
+ await page.getByRole("menuitem", { name: "Delete recording", exact: true }).click();
+ await expect(
+ page.getByRole("button", { name: "An interrupted upload", exact: true }),
+ ).toHaveCount(0);
+ await page.getByRole("textbox", { name: "Search projects" }).fill("missing");
+ await expect(page.getByText("No matching projects", { exact: true })).toBeVisible();
+});
+
+test("switching accounts clears the previous account's cloud quota", async ({ page }) => {
+ await page.goto("/tests/ui/publish.html?full&switch");
+ await page.getByRole("button", { name: "Publish", exact: true }).click();
+ await expect(
+ page.getByText(
+ "You have 5 cloud recordings. Delete one from Shared before sharing another.",
+ ),
+ ).toBeVisible();
+ await page
+ .getByRole("button", { name: "Fixture sign out", exact: true })
+ .evaluate((button: HTMLButtonElement) => button.click());
+ await expect(
+ page.getByText(
+ "You have 5 cloud recordings. Delete one from Shared before sharing another.",
+ ),
+ ).toHaveCount(0);
+ await page
+ .getByRole("button", { name: "Fixture switch account", exact: true })
+ .evaluate((button: HTMLButtonElement) => button.click());
+ await expect(page.getByRole("button", { name: "Share", exact: true })).toBeEnabled();
+});
+
+for (const fails of [false, true]) {
+ test(`ignores an old account's late upload ${fails ? "error" : "success"}`, async ({
+ page,
+ }) => {
+ await page.goto(`/tests/ui/publish.html?switch&controlled${fails ? "&fail" : ""}`);
+ await page.getByRole("button", { name: "Publish", exact: true }).click();
+ await page.getByRole("button", { name: "Share", exact: true }).click();
+ await expect(page.getByText("Uploading · 85%", { exact: true })).toBeVisible();
+ await page
+ .getByRole("button", { name: "Fixture switch account", exact: true })
+ .evaluate((button: HTMLButtonElement) => button.click());
+ await page
+ .getByRole("button", { name: "Fixture finish upload", exact: true })
+ .evaluate((button: HTMLButtonElement) => button.click());
+ await expect(page.getByRole("button", { name: "Share", exact: true })).toBeEnabled();
+ await expect(page.getByRole("button", { name: "Copy link", exact: true })).toHaveCount(0);
+ await expect(
+ page.getByText("Fixture old-account upload failed", { exact: true }),
+ ).toHaveCount(0);
+ });
+}
+
+test("deleting from another shared library refreshes a mounted Share quota", async ({ page }) => {
+ await page.goto("/tests/ui/shared-recordings.html?capacity");
+ await expect(page.getByRole("button", { name: "Share", exact: true })).toBeDisabled();
+ await page
+ .getByRole("button", { name: "Options for An interrupted upload", exact: true })
+ .click();
+ page.once("dialog", (dialog) => dialog.dismiss());
+ await page.getByRole("menuitem", { name: "Delete recording", exact: true }).click();
+ await expect(page.getByRole("button", { name: "Share", exact: true })).toBeDisabled();
+ await page
+ .getByRole("button", { name: "Options for An interrupted upload", exact: true })
+ .click();
+ page.once("dialog", (dialog) => dialog.accept());
+ await page.getByRole("menuitem", { name: "Delete recording", exact: true }).click();
+ await expect(
+ page.getByRole("button", { name: "An interrupted upload", exact: true }),
+ ).toHaveCount(0);
+ await expect(page.getByRole("button", { name: "Share", exact: true })).toBeEnabled();
+ await expect(
+ page.getByText(
+ "You have 5 cloud recordings. Delete one from Shared before sharing another.",
+ ),
+ ).toHaveCount(0);
+});
++
++for (const destination of ["Local", "Link"]) {
++ test(`Publish preserves manual export reporting for ${destination}`, async ({ page }) => {
++ await page.goto("/tests/ui/publish.html?export-error");
++ await page.getByRole("button", { name: "Publish", exact: true }).click();
++ await page.getByRole("row", { name: destination, exact: true }).click();
++ await page.getByRole("button", { name: "Report error", exact: true }).click();
++ const dialog = page.getByRole("dialog", { name: "Report export error", exact: true });
++ await expect(dialog).toBeVisible();
++ await dialog.getByText("View data to be sent", { exact: true }).click();
++ await expect(dialog.locator("pre")).toContainText("VIDEO_DECODE_ENCODING_ERROR");
++ });
++}
diff --cc tests/ui/publish.tsx
index 9c4bed49,00000000..ce8c8ac0
mode 100644,000000..100644
--- a/tests/ui/publish.tsx
+++ b/tests/ui/publish.tsx
@@@ -1,118 -1,0 +1,121 @@@
+import { useState, type ComponentProps } from "react";
+import { createRoot } from "react-dom/client";
+import { I18nProvider, useI18n } from "@/contexts/I18nContext";
+import { EditorExportMenu } from "@/components/video-editor/layout/EditorExportMenu";
+import "@/index.css";
+import { loadEditorPreferences } from "@/components/video-editor/editorPreferences";
+import { useExportSettings } from "@/components/video-editor/export/useExportSettings";
+const noop = () => undefined;
+let finishUpload: (() => void) | undefined;
+let reportUpload:
+ | ((event: { uploadId: string; uploadedBytes: number; totalBytes: number }) => void)
+ | undefined;
+window.electronAPI = {
+ cloudShareManage: async ({ token }: { token: string }) => ({
+ success: true,
+ videos:
+ token === "fixture" && new URLSearchParams(location.search).has("full")
+ ? Array(5).fill({ ready: true })
+ : [],
+ }),
+ onCloudShareProgress: (callback: typeof reportUpload) => {
+ reportUpload = callback;
+ return () => {
+ reportUpload = undefined;
+ };
+ },
+ discardExportedTemp: async () => ({}),
+ cloudShareUpload: async ({ uploadId }: { uploadId: string }) => {
+ await new Promise((resolve) => setTimeout(resolve, 800));
+ reportUpload?.({ uploadId, uploadedBytes: 50, totalBytes: 100 });
+ if (new URLSearchParams(location.search).has("controlled")) {
+ await new Promise<void>((resolve) => {
+ finishUpload = resolve;
+ });
+ } else {
+ await new Promise((resolve) => setTimeout(resolve, 12000));
+ }
+ if (new URLSearchParams(location.search).has("fail"))
+ throw new Error("Fixture old-account upload failed");
+ return { success: true, shareUrl: "https://example.test/s/preview" };
+ },
+ cloudShareCancel: async () => ({ success: true }),
+} as unknown as typeof window.electronAPI;
+function Preview() {
+ const [open, setOpen] = useState(false);
+ const [authToken, setAuthToken] = useState<string | undefined>("fixture");
+ const [accountId, setAccountId] = useState<string | undefined>("fixture-account");
+ const [percentage, setPercentage] = useState(0);
+ const { t } = useI18n();
+ const [preferences] = useState(loadEditorPreferences);
+ const exportSettings = useExportSettings(preferences, [], []);
+ const props = {
+ t,
+ projectTitle: "Preview",
+ authToken,
+ accountId,
+ shareRequestNonce: 0,
+ exportSettings,
+ exportSession: {
+ showExportDropdown: open,
+ setShowExportDropdown: setOpen,
+ exportProgress: { percentage },
++ exportError: new URLSearchParams(location.search).has("export-error")
++ ? "[VIDEO_DECODE_ENCODING_ERROR] sourceTimeSec=0.500"
++ : undefined,
+ },
+ exportDimensions: { gifOutputDimensions: { width: 800, height: 450 } },
+ exportStatus: {},
+ handleOpenExportDropdown: () => setOpen(true),
+ handleExportDropdownClose: () => setOpen(false),
+ handleCancelExport: noop,
+ handleStartExportFromDropdown: noop,
+ prepareExportForShare: async () => {
+ setPercentage(0);
+ await new Promise((resolve) => setTimeout(resolve, 800));
+ setPercentage(50);
+ await new Promise((resolve) => setTimeout(resolve, 800));
+ setPercentage(100);
+ return "synthetic-preview.mp4";
+ },
+ onRequestShareSignIn: noop,
+ } as unknown as ComponentProps<typeof EditorExportMenu>;
+ return (
+ <div className="flex justify-end p-12">
+ {new URLSearchParams(location.search).has("switch") && (
+ <div>
+ <button type="button" onClick={() => finishUpload?.()}>
+ Fixture finish upload
+ </button>
+ <button type="button" onClick={() => setAuthToken("refreshed-fixture")}>
+ Fixture refresh token
+ </button>
+ <button
+ type="button"
+ onClick={() => {
+ setAuthToken(undefined);
+ setAccountId(undefined);
+ }}
+ >
+ Fixture sign out
+ </button>
+ <button
+ type="button"
+ onClick={() => {
+ setAuthToken("other");
+ setAccountId("other-account");
+ }}
+ >
+ Fixture switch account
+ </button>
+ </div>
+ )}
+ <EditorExportMenu {...props} />
+ </div>
+ );
+}
+createRoot(document.getElementById("root")!).render(
+ <I18nProvider>
+ <Preview />
+ </I18nProvider>,
+);