-
Notifications
You must be signed in to change notification settings - Fork 2
feat(app): replace release notes dialog with subtle toast (#486) #488
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
Merged
Merged
Changes from 6 commits
Commits
Show all changes
18 commits
Select commit
Hold shift + click to select a range
6989634
feat(ui): add subtle toast variant and onDismiss hook
Astro-Han 5e8bbb9
feat(app): replace release notes dialog with subtle toast
Astro-Han d8788a6
chore(app): remove DialogReleaseNotes
Astro-Han c2b6840
feat(app): rename release notes i18n keys to toast namespace
Astro-Han 48ccb80
refactor(app): drop unused release notes toast i18n keys
Astro-Han 27e6601
test(app): e2e coverage for release notes toast
Astro-Han dfebfcb
fix(app): only mark release seen on explicit user dismiss
Astro-Han 78946c9
test(app): use expect.poll for release notes toast e2e
Astro-Han 5909d69
style(test): rename release notes spec constants to SCREAMING_SNAKE_CASE
Astro-Han 388681b
fix(app): preserve filtered releases when slicing toast window
Astro-Han 23df996
fix(app): unify toast locale across merged release segments
Astro-Han 5216a8d
fix(ui): mark toast seen on swipe and escape dismissal
Astro-Han 7fc344a
chore(opencode): register release notes smoke test in inventory
Astro-Han c7a2dfa
fix(app): anchor toast title and link on current app version
Astro-Han 2eaeacf
fix(ui): harden toast dismiss paths
Astro-Han 3e55c4a
fix(app): tag every description segment that does not match current v…
Astro-Han 9399c5d
test(app): cover release notes action click path
Astro-Han ee020cf
test(app): extract LANGUAGE_KEY constant in release notes spec
Astro-Han File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
213 changes: 213 additions & 0 deletions
213
packages/app/e2e/release-notes/release-notes-toast.spec.ts
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,213 @@ | ||
| import { test, expect, settingsKey } from "../fixtures" | ||
|
|
||
| const RELEASES_URL_PATTERN = "**/api.github.com/repos/Astro-Han/pawwork/releases**" | ||
| const HIGHLIGHTS_KEY = "highlights.v1" | ||
|
|
||
| const singleReleasePayload = [ | ||
| { | ||
| tag_name: "v2026.5.7", | ||
| body: [ | ||
| "## App Update Notice", | ||
| "", | ||
| "Important refresh for this release.", | ||
| "", | ||
| "- Added subtle toast variant", | ||
| "- Replaced release notes dialog", | ||
| ].join("\n"), | ||
| }, | ||
| ] | ||
|
|
||
| const multiVersionPayload = [ | ||
| { | ||
| tag_name: "v2026.5.7", | ||
| body: "## App Update Notice\n\n- Newest highlight A\n- Newest highlight B\n", | ||
| }, | ||
| { | ||
| tag_name: "v2026.5.6", | ||
| body: "## App Update Notice\n\n- Older highlight C\n", | ||
| }, | ||
| ] | ||
|
|
||
| const localizedPayload = [ | ||
| { | ||
| tag_name: "v2026.5.7", | ||
| body: [ | ||
| "## App Update Notice", | ||
| "", | ||
| "- English bullet only", | ||
| "", | ||
| "## 中文版本", | ||
| "", | ||
| "### 主要更新", | ||
| "", | ||
| "- 中文要点 A", | ||
| "- 中文要点 B", | ||
| ].join("\n"), | ||
| }, | ||
| ] | ||
|
|
||
| const toastSelector = '[data-component="toast"][data-variant="subtle"]' | ||
| const toastTitleSelector = `${toastSelector} [data-slot="toast-title"]` | ||
| const toastDescriptionSelector = `${toastSelector} [data-slot="toast-description"]` | ||
| const toastActionSelector = `${toastSelector} [data-slot="toast-action"]` | ||
| const toastCloseButtonSelector = `${toastSelector} [data-slot="toast-close-button"]` | ||
| const toastIconSelector = `${toastSelector} [data-slot="toast-icon"]` | ||
|
|
||
| test.describe("release notes toast", () => { | ||
| test("@smoke shows subtle toast when stored version is older than current", async ({ page, gotoSession }) => { | ||
| await page.route(RELEASES_URL_PATTERN, async (route) => { | ||
| await route.fulfill({ | ||
| status: 200, | ||
| contentType: "application/json", | ||
| body: JSON.stringify(singleReleasePayload), | ||
| }) | ||
| }) | ||
|
|
||
| await page.addInitScript((key) => { | ||
| localStorage.setItem(key, JSON.stringify({ version: "2026.5.6" })) | ||
| }, HIGHLIGHTS_KEY) | ||
|
|
||
| await gotoSession() | ||
|
|
||
| await expect(page.locator(toastSelector)).toBeVisible({ timeout: 10_000 }) | ||
| await expect(page.locator(toastTitleSelector)).toHaveText("Updated to v2026.5.7") | ||
| await expect(page.locator(toastDescriptionSelector)).toContainText("Important refresh for this release.") | ||
| await expect(page.locator(toastDescriptionSelector)).toContainText("• Added subtle toast variant") | ||
| await expect(page.locator(toastDescriptionSelector)).toContainText("• Replaced release notes dialog") | ||
| await expect(page.locator(toastActionSelector)).toHaveText("Full release notes →") | ||
| await expect(page.locator(toastIconSelector)).toBeVisible() | ||
| }) | ||
|
|
||
| test("clicking the close button marks the current version as seen", async ({ page, gotoSession }) => { | ||
| await page.route(RELEASES_URL_PATTERN, async (route) => { | ||
| await route.fulfill({ | ||
| status: 200, | ||
| contentType: "application/json", | ||
| body: JSON.stringify(singleReleasePayload), | ||
| }) | ||
| }) | ||
|
|
||
| await page.addInitScript((key) => { | ||
| localStorage.setItem(key, JSON.stringify({ version: "2026.5.6" })) | ||
| }, HIGHLIGHTS_KEY) | ||
|
|
||
| await gotoSession() | ||
| await expect(page.locator(toastSelector)).toBeVisible({ timeout: 10_000 }) | ||
|
|
||
| await page.locator(toastCloseButtonSelector).click() | ||
| await expect(page.locator(toastSelector)).toBeHidden() | ||
|
|
||
| const stored = await page.evaluate((key) => { | ||
| const raw = localStorage.getItem(key) | ||
| return raw ? JSON.parse(raw) : null | ||
| }, HIGHLIGHTS_KEY) | ||
| expect(stored?.version).toBe("2026.5.7") | ||
| }) | ||
|
|
||
| test("releaseNotes=false suppresses the toast", async ({ page, gotoSession }) => { | ||
| await page.route(RELEASES_URL_PATTERN, async (route) => { | ||
| await route.fulfill({ | ||
| status: 200, | ||
| contentType: "application/json", | ||
| body: JSON.stringify(singleReleasePayload), | ||
| }) | ||
| }) | ||
|
|
||
| await page.addInitScript( | ||
| ([highlightsKey, settingsStorageKey]) => { | ||
| localStorage.setItem(highlightsKey, JSON.stringify({ version: "2026.5.6" })) | ||
| const existing = localStorage.getItem(settingsStorageKey) | ||
| const parsed = existing ? JSON.parse(existing) : {} | ||
| parsed.general = { ...(parsed.general ?? {}), releaseNotes: false } | ||
| localStorage.setItem(settingsStorageKey, JSON.stringify(parsed)) | ||
| }, | ||
| [HIGHLIGHTS_KEY, settingsKey], | ||
| ) | ||
|
|
||
| await gotoSession() | ||
|
|
||
| await page.waitForTimeout(1500) | ||
| await expect(page.locator(toastSelector)).toHaveCount(0) | ||
|
|
||
| const stored = await page.evaluate((key) => { | ||
| const raw = localStorage.getItem(key) | ||
| return raw ? JSON.parse(raw) : null | ||
| }, HIGHLIGHTS_KEY) | ||
| expect(stored?.version).toBe("2026.5.7") | ||
| }) | ||
|
coderabbitai[bot] marked this conversation as resolved.
|
||
|
|
||
| test("merges multiple skipped versions into one description", async ({ page, gotoSession }) => { | ||
| await page.route(RELEASES_URL_PATTERN, async (route) => { | ||
| await route.fulfill({ | ||
| status: 200, | ||
| contentType: "application/json", | ||
| body: JSON.stringify(multiVersionPayload), | ||
| }) | ||
| }) | ||
|
|
||
| await page.addInitScript((key) => { | ||
| localStorage.setItem(key, JSON.stringify({ version: "2026.5.5" })) | ||
| }, HIGHLIGHTS_KEY) | ||
|
|
||
| await gotoSession() | ||
|
|
||
| await expect(page.locator(toastSelector)).toBeVisible({ timeout: 10_000 }) | ||
| await expect(page.locator(toastTitleSelector)).toHaveText("Updated to v2026.5.7") | ||
| const description = page.locator(toastDescriptionSelector) | ||
| await expect(description).toContainText("• Newest highlight A") | ||
| await expect(description).toContainText("• Newest highlight B") | ||
| await expect(description).toContainText("v2026.5.6") | ||
| await expect(description).toContainText("• Older highlight C") | ||
| }) | ||
|
|
||
| test("falls back to English when zh release section is missing", async ({ page, gotoSession }) => { | ||
| await page.route(RELEASES_URL_PATTERN, async (route) => { | ||
| await route.fulfill({ | ||
| status: 200, | ||
| contentType: "application/json", | ||
| body: JSON.stringify([ | ||
| { | ||
| tag_name: "v2026.5.7", | ||
| body: "## App Update Notice\n\n- English fallback bullet\n", | ||
| }, | ||
| ]), | ||
| }) | ||
| }) | ||
|
|
||
| await page.addInitScript((highlightsKey) => { | ||
| localStorage.setItem(highlightsKey, JSON.stringify({ version: "2026.5.6" })) | ||
| localStorage.setItem("pawwork.global.dat:language", JSON.stringify({ locale: "zh" })) | ||
| }, HIGHLIGHTS_KEY) | ||
|
|
||
| await gotoSession() | ||
|
|
||
| await expect(page.locator(toastSelector)).toBeVisible({ timeout: 10_000 }) | ||
| // Title and action must follow the parsed body's locale (en) — never mix with zh UI locale. | ||
| await expect(page.locator(toastTitleSelector)).toHaveText("Updated to v2026.5.7") | ||
| await expect(page.locator(toastActionSelector)).toHaveText("Full release notes →") | ||
| await expect(page.locator(toastDescriptionSelector)).toContainText("• English fallback bullet") | ||
| }) | ||
|
|
||
| test("uses zh title and action when zh release section is present", async ({ page, gotoSession }) => { | ||
| await page.route(RELEASES_URL_PATTERN, async (route) => { | ||
| await route.fulfill({ | ||
| status: 200, | ||
| contentType: "application/json", | ||
| body: JSON.stringify(localizedPayload), | ||
| }) | ||
| }) | ||
|
|
||
| await page.addInitScript((highlightsKey) => { | ||
| localStorage.setItem(highlightsKey, JSON.stringify({ version: "2026.5.6" })) | ||
| localStorage.setItem("pawwork.global.dat:language", JSON.stringify({ locale: "zh" })) | ||
| }, HIGHLIGHTS_KEY) | ||
|
|
||
| await gotoSession() | ||
|
|
||
| await expect(page.locator(toastSelector)).toBeVisible({ timeout: 10_000 }) | ||
| await expect(page.locator(toastTitleSelector)).toHaveText("已更新到 v2026.5.7") | ||
| await expect(page.locator(toastActionSelector)).toHaveText("查看完整发布说明 →") | ||
| await expect(page.locator(toastDescriptionSelector)).toContainText("• 中文要点 A") | ||
| await expect(page.locator(toastDescriptionSelector)).toContainText("• 中文要点 B") | ||
| }) | ||
| }) | ||
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.