diff --git a/test/ui-tests/heading.test.js b/test/ui-tests/heading.test.js new file mode 100644 index 0000000..4373c2d --- /dev/null +++ b/test/ui-tests/heading.test.js @@ -0,0 +1,34 @@ +const timeout = process.env.SLOWMO ? 60000 : 10000; +const fs = require('fs'); +beforeAll(async () => { + path = fs.realpathSync('file://../index.html'); + await page.goto('file://' + path, {waitUntil: 'domcontentloaded'}); +}); + +describe('Heading Text', () => { + test('Adding and switching between headings', async () => { + await page.click('[title="Markdown Mode Ctrl+M"]'); + await page.click('#ta'); + + await page.click('[title="Heading

,

, ... Ctrl+D"]'); + let stringIsIncluded = await page.evaluate(() => document.querySelector('#ta').value.includes('# Heading Text')); + expect(stringIsIncluded).toBe(true); + + await page.click('[title="Heading

,

, ... Ctrl+D"]'); + stringIsIncluded = await page.evaluate(() => document.querySelector('#ta').value.includes('## Heading Text')); + expect(stringIsIncluded).toBe(true); + + await page.click('[title="Heading

,

, ... Ctrl+D"]'); + stringIsIncluded = await page.evaluate(() => document.querySelector('#ta').value.includes('### Heading Text')); + expect(stringIsIncluded).toBe(true); + + await page.click('[title="Heading

,

, ... Ctrl+D"]'); + stringIsIncluded = await page.evaluate(() => document.querySelector('#ta').value.includes('#### Heading Text')); + expect(stringIsIncluded).toBe(true); + + await page.click('[title="Heading

,

, ... Ctrl+D"]'); + stringIsIncluded = await page.evaluate(() => document.querySelector('#ta').value.includes('Heading Text')); + expect(stringIsIncluded).toBe(true); + + }, timeout); +}); \ No newline at end of file