-
-
Notifications
You must be signed in to change notification settings - Fork 33.7k
/
Copy pathmarkdown.spec.ts
46 lines (39 loc) · 1.16 KB
/
markdown.spec.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
import {
setupPuppeteer,
expectByPolling,
getExampleUrl,
E2E_TIMEOUT
} from './e2eUtils'
describe('e2e: markdown', () => {
const { page, isVisible, value, html } = setupPuppeteer()
async function testMarkdown(apiType: 'classic' | 'composition') {
await page().goto(getExampleUrl('markdown', apiType))
expect(await isVisible('#editor')).toBe(true)
expect(await value('textarea')).toBe('# hello')
expect(await html('#editor div')).toBe('<h1 id="hello">hello</h1>\n')
await page().type('textarea', '\n## foo\n\n- bar\n- baz')
// assert the output is not updated yet because of debounce
// debounce has become unstable on CI so this assertion is disabled
// expect(await html('#editor div')).toBe('<h1 id="hello">hello</h1>\n')
await expectByPolling(
() => html('#editor div'),
'<h1 id="hello">hello</h1>\n' +
'<h2 id="foo">foo</h2>\n' +
'<ul>\n<li>bar</li>\n<li>baz</li>\n</ul>\n'
)
}
test(
'classic',
async () => {
await testMarkdown('classic')
},
E2E_TIMEOUT
)
test(
'composition',
async () => {
await testMarkdown('composition')
},
E2E_TIMEOUT
)
})