Skip to content
Merged
Changes from 7 commits
Commits
File filter

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
34 changes: 28 additions & 6 deletions test/e2e/sidebar.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,33 @@ describe('Sidebar Tests', function() {
// Tests
// ---------------------------------------------------------------------------
test('search readme', async () => {
await docsifyInit();
await page.goto(DOCS_URL + '/#/quickstart');
await page.fill('input[type=search]', 'Please consider donating');
expect(
await page.innerText('.results-panel > .matching-post > a > h2')
).toEqual('Donate');
const docsifyInitConfig = {
markdown: {
homepage: `
# Hello World

This is the homepage.
`,
sidebar: `
- [Home page](/)
- [Test Page](test)
`,
},
routes: {
'/test.md': `
# Test Page

This is a custom route.
`,
},
scriptURLs: ['/lib/plugins/search.min.js'],
};

await docsifyInit(docsifyInitConfig);
await page.fill('input[type=search]', 'hello');
await expect(page).toEqualText('.results-panel h2', 'Hello World');
await page.click('.clear-button');
await page.fill('input[type=search]', 'test');
await expect(page).toEqualText('.results-panel h2', 'Test Page');
});
});