Last active
June 28, 2022 11:52
-
-
Save rodrigojmartin/18636b9953ff78194e18eb713dc7b743 to your computer and use it in GitHub Desktop.
TodoApp - Scripted Test
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import { describe, it } from 'mocha'; | |
import { expect } from 'chai'; | |
describe('TodoList App - Scripted', function () { | |
it('allows the user to add items to the TodoList', async function () { | |
let itemsText = []; | |
await browser.url('https://todomvc.com/examples/vue/'); | |
await $('.new-todo').waitForDisplayed(({ timeout: 2000 })); | |
expect(await browser.getTitle()).include('Vue'); | |
await $('.new-todo').setValue('Learn Screenplay'); | |
await browser.keys(['Enter']); | |
await $('.new-todo').setValue('Love Testing!'); | |
await browser.keys(['Enter']); | |
const todoItems = await $$('.todo-list li'); | |
const item1Text = await todoItems[0].getText(); | |
const item2Text = await todoItems[1].getText(); | |
expect(item1Text).equal('Learn Screenplay'); | |
expect(item2Text).equal('Love Testing!'); | |
}); | |
beforeEach(async () => { | |
// clean up code required to avoid state leakage | |
await browser.execute('window.localStorage.clear()'); | |
}); | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment