test(applications): cover flat edit dialog at tablet width
This commit is contained in:
@@ -15,16 +15,19 @@ const report = { journeys: [], captures: [], writes: [], errors: [], unavailable
|
|||||||
const browser = await chromium.launch();
|
const browser = await chromium.launch();
|
||||||
try {
|
try {
|
||||||
const zones = process.env.A3_PILOT ? ['America/Los_Angeles'] : ['America/Los_Angeles', 'Europe/Oslo', 'Pacific/Kiritimati'];
|
const zones = process.env.A3_PILOT ? ['America/Los_Angeles'] : ['America/Los_Angeles', 'Europe/Oslo', 'Pacific/Kiritimati'];
|
||||||
for (const zone of zones) for (const language of ['en', 'nb']) {
|
const screens = [{ language: 'en', width: 1440, touch: false, theme: 'light' }, { language: 'nb', width: 390, touch: true, theme: 'dark' }];
|
||||||
const mobile = language === 'nb';
|
if (flatEdit) screens.push({ language: 'nb', width: 768, touch: true, theme: 'light' });
|
||||||
|
for (const zone of zones) for (const screen of screens) {
|
||||||
|
const { language, width, theme } = screen;
|
||||||
|
const mobile = screen.touch;
|
||||||
const copy = translations[language];
|
const copy = translations[language];
|
||||||
const name = `${zone.replaceAll('/', '-')}-${language}`;
|
const name = `${zone.replaceAll('/', '-')}-${language}${flatEdit ? `-${width}-${theme}` : ''}`;
|
||||||
console.log(`Checking ${name}`);
|
console.log(`Checking ${name}`);
|
||||||
const context = await browser.newContext({ timezoneId: zone, viewport: { width: mobile ? 390 : 1440, height: 1000 }, hasTouch: mobile, isMobile: mobile, reducedMotion: 'reduce' });
|
const context = await browser.newContext({ timezoneId: zone, viewport: { width, height: 1000 }, hasTouch: mobile, isMobile: mobile, reducedMotion: 'reduce' });
|
||||||
const page = await context.newPage();
|
const page = await context.newPage();
|
||||||
page.on('pageerror', error => report.errors.push(error.message));
|
page.on('pageerror', error => report.errors.push(error.message));
|
||||||
await page.clock.setFixedTime(new Date('2026-11-23T00:30:00Z'));
|
await page.clock.setFixedTime(new Date('2026-11-23T00:30:00Z'));
|
||||||
await page.addInitScript(({ language, mobile }) => { localStorage.setItem('uiLanguage', language); localStorage.setItem('jobtracker.themeMode', mobile ? 'dark' : 'light'); }, { language, mobile });
|
await page.addInitScript(({ language, theme }) => { localStorage.setItem('uiLanguage', language); localStorage.setItem('jobtracker.themeMode', theme); }, { language, theme });
|
||||||
const job = { id: 42, version: 7, companyId: 1, company: { id: 1, name: 'Synthetic school' }, jobTitle: 'Teacher', status: 'Applied', dateApplied: '2026-11-23', deadline: '2026-11-23', followUpAt: '2026-11-23', responseReceived: true, responseDate: '2026-11-23', isDeleted: false };
|
const job = { id: 42, version: 7, companyId: 1, company: { id: 1, name: 'Synthetic school' }, jobTitle: 'Teacher', status: 'Applied', dateApplied: '2026-11-23', deadline: '2026-11-23', followUpAt: '2026-11-23', responseReceived: true, responseDate: '2026-11-23', isDeleted: false };
|
||||||
const writes = [];
|
const writes = [];
|
||||||
let detailReads = 0;
|
let detailReads = 0;
|
||||||
@@ -128,10 +131,10 @@ try {
|
|||||||
await expect(add).toBeHidden();
|
await expect(add).toBeHidden();
|
||||||
assert.equal(writes.length, 2);
|
assert.equal(writes.length, 2);
|
||||||
assert.equal(writes[1].body.dateApplied, '2026-11-24'); assert.equal(writes[1].body.deadline, '2026-11-24');
|
assert.equal(writes[1].body.dateApplied, '2026-11-24'); assert.equal(writes[1].body.deadline, '2026-11-24');
|
||||||
report.journeys.push({ zone, language, width: mobile ? 390 : 1440, touch: mobile, theme: mobile ? 'dark' : 'light', sevenCalendarSelections: 'PASS', localeDraftRetention: 'PASS', localToday: today, fixtureSaveCreate: 'PASS' });
|
report.journeys.push({ zone, language, width, touch: mobile, theme, sevenCalendarSelections: 'PASS', localeDraftRetention: 'PASS', localToday: today, fixtureSaveCreate: 'PASS' });
|
||||||
await context.close();
|
await context.close();
|
||||||
}
|
}
|
||||||
assert.equal(report.journeys.length, zones.length * 2); assert.deepEqual(report.errors, []);
|
assert.equal(report.journeys.length, zones.length * screens.length); assert.deepEqual(report.errors, []);
|
||||||
console.log(`PASS ${report.journeys.length} real-widget journeys, ${report.captures.length} axe captures, ${report.writes.length} intercepted fixture writes`);
|
console.log(`PASS ${report.journeys.length} real-widget journeys, ${report.captures.length} axe captures, ${report.writes.length} intercepted fixture writes`);
|
||||||
} finally {
|
} finally {
|
||||||
fs.writeFileSync(path.join(out, process.env.A3_PILOT ? 'PILOT.json' : 'BROWSER.json'), JSON.stringify(report, null, 2));
|
fs.writeFileSync(path.join(out, process.env.A3_PILOT ? 'PILOT.json' : 'BROWSER.json'), JSON.stringify(report, null, 2));
|
||||||
|
|||||||
Reference in New Issue
Block a user