Add post-login welcome and friendly how-it-works guide
Magent CI/CD / verify (push) Successful in 10m26s
Magent CI/CD / deploy-prod (push) Skipped
Magent CI/CD / deploy-beta (push) Skipped

This commit is contained in:
2026-09-07 16:08:37 +12:00
parent 0637860b95
commit 4034a8f72a
9 changed files with 174 additions and 179 deletions
+34
View File
@@ -0,0 +1,34 @@
const { chromium } = require(process.env.REVIEW_PLAYWRIGHT);
const assert = require('node:assert/strict');
(async () => {
const browser = await chromium.launch({ headless: true });
try {
const page = await browser.newPage();
let mode = 'ready';
await page.route('**/api/**', route => {
if (route.request().url().endsWith('/auth/me')) return route.fulfill({ json: { username: 'Tester', role: 'user' } });
if (route.request().url().endsWith('/site/info')) return route.fulfill({ status: mode === 'unauthorized' ? 401 : 200, json: { mediaServerUrl: mode === 'missing' ? null : 'https://watch.example.com/' } });
return route.fulfill({ json: {} });
});
for (const width of [1440, 390]) {
await page.setViewportSize({ width, height: 900 });
await page.goto('http://127.0.0.1:3103/welcome');
await page.getByRole('link', { name: /Go to GrizzlyFlix/ }).waitFor();
assert.equal(await page.getByRole('link', { name: /Go to GrizzlyFlix/ }).getAttribute('href'), 'https://watch.example.com/');
assert.equal(await page.getByRole('link', { name: /Manage your account/ }).getAttribute('href'), '/');
assert.equal(await page.locator('.header').count(), 0);
assert(await page.evaluate(() => document.documentElement.scrollWidth <= innerWidth));
await page.goto('http://127.0.0.1:3103/how-it-works');
await page.getByText('Understand the six progress steps').click();
await page.getByText('Your request has been received.').waitFor();
assert(await page.evaluate(() => document.documentElement.scrollWidth <= innerWidth));
}
mode = 'missing';
await page.goto('http://127.0.0.1:3103/welcome');
await page.getByText(/watch link hasnt been set up/).waitFor();
mode = 'unauthorized';
await page.goto('http://127.0.0.1:3103/welcome');
await page.waitForURL('**/login');
console.log('Welcome and guide checks passed: desktop, mobile, links, disclosure, missing URL, auth redirect.');
} finally { await browser.close(); }
})().catch(error => { console.error(error); process.exit(1); });