Skip to content

Commit

Permalink
heading test (#34)
Browse files Browse the repository at this point in the history
  • Loading branch information
cypherean authored Aug 5, 2020
1 parent 7a47ab7 commit 39237b7
Showing 1 changed file with 34 additions and 0 deletions.
34 changes: 34 additions & 0 deletions test/ui-tests/heading.test.js
Original file line number Diff line number Diff line change
@@ -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 <h1>, <h2>, ... Ctrl+D"]');
let stringIsIncluded = await page.evaluate(() => document.querySelector('#ta').value.includes('# Heading Text'));
expect(stringIsIncluded).toBe(true);

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

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

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

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

}, timeout);
});

0 comments on commit 39237b7

Please sign in to comment.