mirror of
https://github.com/jcreek/LivingDexTracker.git
synced 2026-09-16 18:42:03 +00:00
fix(backup): pause revoked backups and tell users to reconnect
Google answers a revoked or expired refresh token with invalid_grant. Every save then retried the dead token, and reconnecting never cleared the old error, so it kept showing on Backup Settings afterwards. - The Google Drive and Dropbox OAuth callbacks clear lastError when a provider is reconnected. - An invalid_grant, or a missing refresh token, now pauses the integration with a readable "reconnect" message instead of retrying it on every catch update. Other failures still retry as before. - A banner on every page and an alert on the Pokédex page point to Backup Settings, which shows a "Reconnect needed" badge. The Pokédex page re-checks backup status after each export, because saving a catch record also exports on the server and may pause a provider first. - Offline sync status and the "Save all artwork" link move from every page to a new /offline-guide page, linked from the user menu and the home and welcome pages. Only the offline read-only banner stays sitewide. - Unit tests cover every export path and the backup status store. BDD covers revocation and reconnecting for both providers, and the offline guide. The mock provider can now reject token refreshes, and mock control calls fail loudly if a stale mock is reused. Coverage thresholds are raised to the new baseline.
This commit is contained in:
@@ -104,6 +104,23 @@ When('I go offline and reload the current Pokédex', async ({ page, state }) =>
|
||||
});
|
||||
});
|
||||
|
||||
When('I open the offline guide', async ({ page }) => {
|
||||
await page.goto('/offline-guide');
|
||||
});
|
||||
|
||||
When('I open the offline guide from the user menu', async ({ page }) => {
|
||||
await page.getByRole('button', { name: 'usericon' }).click();
|
||||
await page.getByRole('link', { name: 'Using Offline' }).click();
|
||||
await page.waitForURL(/\/offline-guide$/);
|
||||
});
|
||||
|
||||
// Client-side navigation keeps the sync status in memory, so the old layout would show it at once.
|
||||
When('I return to my Pokédexes from the user menu', async ({ page }) => {
|
||||
await page.getByRole('button', { name: 'usericon' }).click();
|
||||
await page.getByRole('link', { name: 'My Pokédexes' }).click();
|
||||
await page.waitForURL(/\/my-pokedexes$/);
|
||||
});
|
||||
|
||||
When('I go offline and then return online', async ({ page }) => {
|
||||
await page.context().setOffline(true);
|
||||
await page.reload({ waitUntil: 'domcontentloaded' });
|
||||
@@ -167,6 +184,26 @@ Then('the application remains available', async ({ page }) => {
|
||||
await expect(page.getByRole('heading', { name: /Start Your Pokédex Journey/ })).toBeVisible();
|
||||
});
|
||||
|
||||
Then('the offline guide shows my offline copy status', async ({ page }) => {
|
||||
await expect(
|
||||
page.getByRole('heading', { name: 'Using Living Dex Tracker offline' })
|
||||
).toBeVisible();
|
||||
await expect(page.getByTestId('offline-copy-status')).toBeVisible();
|
||||
});
|
||||
|
||||
Then('the offline guide shows when my offline copy was updated', async ({ page }) => {
|
||||
await expect(page.getByTestId('offline-copy-status')).toContainText(/Offline copy updated/, {
|
||||
timeout: 30_000
|
||||
});
|
||||
});
|
||||
|
||||
Then('no offline sync status is shown', async ({ page }) => {
|
||||
await expect(page.getByRole('heading', { name: /My Pok/ }).first()).toBeVisible();
|
||||
await expect(
|
||||
page.getByText(/Offline copy updated|Updating offline copy|Save all artwork for offline/)
|
||||
).toHaveCount(0);
|
||||
});
|
||||
|
||||
Then('the read-only offline viewer is available', async ({ page }) => {
|
||||
await expect(page.getByText(/offline.*read-only/i)).toBeVisible();
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user