Skip to content

Commit caff169

Browse files
jhildenbiddlesy-records
authored andcommitted
Reset local storage before each e2e test
1 parent 93ea8a0 commit caff169

File tree

2 files changed

+7
-3
lines changed

2 files changed

+7
-3
lines changed

test/config/jest-playwright.setup-tests.js

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -51,4 +51,9 @@ beforeEach(async () => {
5151
// to fail (e.g. AJAX requests). To avoid these issues, this hook ensures
5252
// that each tests begins by a blank HTML page.
5353
await page.goto(BLANK_URL);
54+
55+
// Clear local storage
56+
await page.evaluate(() => {
57+
window.localStorage.clear();
58+
});
5459
});

test/e2e/search.test.js

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -98,10 +98,9 @@ describe('Search Plugin Tests', function() {
9898

9999
await docsifyInit(docsifyInitConfig);
100100
await page.fill('input[type=search]', 'hello');
101+
await expect(page).toHaveSelector('.matching-post');
102+
expect(await page.$$eval('.matching-post', elms => elms.length)).toBe(1);
101103
await expect(page).toEqualText('.results-panel h2', 'Hello World');
102-
// error
103-
await expect(page).toEqualText('.results-panel', 'Hello World');
104-
105104
await page.click('.clear-button');
106105
await page.fill('input[type=search]', 'test');
107106
await expect(page).toEqualText('.results-panel h2', 'Test Page');

0 commit comments

Comments
 (0)