mirror of
https://github.com/mauriceboe/TREK.git
synced 2026-11-28 07:30:04 +00:00
feat(help): in-app help center with per-screen guides and pictures
A help icon on every screen opens a panel with the screen's overview, its sub-screens, task guides with a framed picture per step, search across guides and the wiki, and a switch to any other screen's help. Guides exist for the dashboard, Vacay, Atlas, Collections, Journey (list, journal, studio), Settings (all tabs), Admin (all tabs) and the trip frame; the trip's own screens are in progress. Pictures are produced by Playwright (client/e2e/help), texts in all 23 languages.
This commit is contained in:
@@ -87,6 +87,35 @@ describe('GET /api/help', () => {
|
||||
await request(app).get('/api/help/asset/%2e%2e%2fserver%2f.env').expect(404);
|
||||
});
|
||||
|
||||
it('searches the shipped pages and lands on the section that carries the words', async () => {
|
||||
const res = await request(app).get('/api/help/search').query({ q: 'cover image' }).expect(200);
|
||||
|
||||
expect(res.body.hits.length).toBeGreaterThan(0);
|
||||
const hit = res.body.hits[0];
|
||||
expect(hit).toEqual({
|
||||
slug: expect.any(String),
|
||||
title: expect.any(String),
|
||||
section: expect.any(String),
|
||||
anchor: expect.anything(),
|
||||
heading: expect.anything(),
|
||||
snippet: expect.any(String),
|
||||
score: expect.any(Number),
|
||||
});
|
||||
expect(hit.snippet.toLowerCase()).toContain('cover');
|
||||
});
|
||||
|
||||
it('clamps the hit count to the requested limit', async () => {
|
||||
const res = await request(app).get('/api/help/search').query({ q: 'trip', limit: 2 }).expect(200);
|
||||
expect(res.body.hits).toHaveLength(2);
|
||||
});
|
||||
|
||||
it('400s a missing, blank, overlong or non-integer-limited query', async () => {
|
||||
await request(app).get('/api/help/search').expect(400);
|
||||
await request(app).get('/api/help/search').query({ q: ' ' }).expect(400);
|
||||
await request(app).get('/api/help/search').query({ q: 'x'.repeat(121) }).expect(400);
|
||||
await request(app).get('/api/help/search').query({ q: 'trip', limit: 'many' }).expect(400);
|
||||
});
|
||||
|
||||
it('never calls out to GitHub', () => {
|
||||
expect(fetchSpy).not.toHaveBeenCalled();
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user