From 39237b798308e6855acde1a938c18a8e4da62fce Mon Sep 17 00:00:00 2001 From: Shreya Sharma <66686803+shreyaa-sharmaa@users.noreply.github.com> Date: Wed, 5 Aug 2020 22:58:37 +0530 Subject: [PATCH] heading test (#34) --- test/ui-tests/heading.test.js | 34 ++++++++++++++++++++++++++++++++++ 1 file changed, 34 insertions(+) create mode 100644 test/ui-tests/heading.test.js 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