Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
5 changes: 2 additions & 3 deletions script/serve-public.js
Original file line number Diff line number Diff line change
Expand Up @@ -41,9 +41,8 @@ const handler = (request, response) => {
fileStream.pipe(response);
} catch(e) {
console.log(`Could not read ${filename}`);
response.writeHead(404, {'Content-Type': 'text/plain'});
response.write('404 Not Found\n');
response.end();
response.writeHead(404, {'Content-Type': 'text/html'});
fs.createReadStream(path.join(basePath, '404.html')).pipe(response);
return;
}
};
Expand Down
15 changes: 15 additions & 0 deletions tests/git-scm.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -230,3 +230,18 @@ test('book', async ({ page }) => {
}
await expect(page.getByRole('document')).toHaveText(/Snapshot’lar, Fərqlər Yox/)
})

test('404', async ({ page }) => {
await page.goto(`${url}does-not.exist`)

await expect(page.locator('.inner h1')).toHaveText(`That page doesn't exist.`)

// the 404 page should be styled
await expect(page.locator('link[rel="stylesheet"]')).toHaveAttribute('href', /application(\.min)?\.css$/)

// the search box is shown
await expect(page.locator('#search-text')).toBeVisible()

// the usual navbar is shown
await expect(page.getByRole('link', { name: 'Community' })).toBeVisible()
})
Loading