Skip to content
Merged
Show file tree
Hide file tree
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 May 7, 2026
5e8bbb9
feat(app): replace release notes dialog with subtle toast
Astro-Han May 7, 2026
d8788a6
chore(app): remove DialogReleaseNotes
Astro-Han May 7, 2026
c2b6840
feat(app): rename release notes i18n keys to toast namespace
Astro-Han May 7, 2026
48ccb80
refactor(app): drop unused release notes toast i18n keys
Astro-Han May 7, 2026
27e6601
test(app): e2e coverage for release notes toast
Astro-Han May 7, 2026
dfebfcb
fix(app): only mark release seen on explicit user dismiss
Astro-Han May 7, 2026
78946c9
test(app): use expect.poll for release notes toast e2e
Astro-Han May 7, 2026
5909d69
style(test): rename release notes spec constants to SCREAMING_SNAKE_CASE
Astro-Han May 7, 2026
388681b
fix(app): preserve filtered releases when slicing toast window
Astro-Han May 7, 2026
23df996
fix(app): unify toast locale across merged release segments
Astro-Han May 7, 2026
5216a8d
fix(ui): mark toast seen on swipe and escape dismissal
Astro-Han May 7, 2026
7fc344a
chore(opencode): register release notes smoke test in inventory
Astro-Han May 7, 2026
c7a2dfa
fix(app): anchor toast title and link on current app version
Astro-Han May 7, 2026
2eaeacf
fix(ui): harden toast dismiss paths
Astro-Han May 7, 2026
3e55c4a
fix(app): tag every description segment that does not match current v…
Astro-Han May 7, 2026
9399c5d
test(app): cover release notes action click path
Astro-Han May 7, 2026
ee020cf
test(app): extract LANGUAGE_KEY constant in release notes spec
Astro-Han May 7, 2026
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
213 changes: 213 additions & 0 deletions packages/app/e2e/release-notes/release-notes-toast.spec.ts
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")
})
Comment thread
coderabbitai[bot] marked this conversation as resolved.
Outdated

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")
})
Comment thread
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")
})
})
160 changes: 0 additions & 160 deletions packages/app/src/components/dialog-release-notes.tsx

This file was deleted.

Loading
Loading