Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: search on homepage test #1398

Merged
merged 8 commits into from
Oct 15, 2020
Merged
Changes from 7 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
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');
});
});