forked from mdn/todo-vue
-
Notifications
You must be signed in to change notification settings - Fork 5
/
Copy pathtodoFormTest.js
33 lines (22 loc) · 995 Bytes
/
todoFormTest.js
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
const delay = ms => new Promise(res => setTimeout(res, ms));
describe('Component test for the TodoForm', function() {
browser.baseUrl = browser.baseUrl || 'http://localhost:3000';
it('render and test the component', async function(browser) {
const component = await browser.mountComponent('/test/component/ToDoForm_TestHarness.vue');
browser.expect(component).to.be.visible;
expect(await component.find('label[for="new-todo-input"]'))
.text.toContain('What needs to be done?');
expect(await component.find('#testHarnessOutput')).text.toBe('todo-added:', );
//await delay(10000);
browser.clearValue('#new-todo-input')
.sendKeys('#new-todo-input', "abc")
.click("button")
.clearValue('#new-todo-input')
.sendKeys('#new-todo-input', "def")
.click("button");
expect(await component.find('#testHarnessOutput')).text.toBe('todo-added: abcdef', );
});
after(function(browser) {
browser.quit();
});
});