From 0ade6d9eced7c73e86bf235e4702262e2d8ef4b4 Mon Sep 17 00:00:00 2001 From: asmsuechan Date: Thu, 1 Jun 2017 17:26:28 +0900 Subject: [PATCH] Add e2e tests for modal click and input texts --- tests/e2e/spectron.js | 26 +++++++++++++++++++++++--- 1 file changed, 23 insertions(+), 3 deletions(-) diff --git a/tests/e2e/spectron.js b/tests/e2e/spectron.js index c27bef1e..384d1550 100644 --- a/tests/e2e/spectron.js +++ b/tests/e2e/spectron.js @@ -4,6 +4,12 @@ import path from 'path' let app = null +const modalOpenButton = '.TopBar__control-newPostButton___browser-main-TopBar-' +const modalCloseButton = '.NewNoteModal__close-mark___browser-main-modals-' +const noteCreateButton = '.NewNoteModal__control-button___browser-main-modals-' +const currentNoteItem = '.NoteItem__item--active___browser-components-' +const noteDetail = '.MarkdownNoteDetail__body___browser-main-Detail-' + test.before(async t => { const boostnotePath = ((platform) => { switch (platform) { @@ -39,7 +45,21 @@ test('Measure BrowserWindow status with await', async t => { t.true(height > 0) }) -test('Modal can be opened and closed', async t => { - await app.client.click('.TopBar__control-newPostButton___browser-main-TopBar-') - await app.client.click('.NewNoteModal__close-mark___browser-main-modals-') +test.serial('Modal can be opened and closed', async t => { + await app.client.click(modalOpenButton) + await app.client.click(modalCloseButton) +}) + +test.serial('Modal can be opened and a note can be created', async t => { + await app.client.click(modalOpenButton) + await app.client.click(noteCreateButton) +}) + +test.serial('NoteList can be clicked', async t => { + await app.client.click(currentNoteItem) +}) + +test.serial('A sentence can be inputted', async t => { + const input = 'this is a text' + await app.client.click(noteDetail).webContents.insertText(input) })