Last active
January 7, 2021 05:26
-
-
Save barayuda/30baa7d20011c83b252d821fb1d462b5 to your computer and use it in GitHub Desktop.
E2E Testing Simple Script
This file contains hidden or 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
/** | |
* File: simple.test.js | |
* Author: barayuda.gautama[at]dana.id || gede[at]barayuda.web.id | |
*/ | |
'use strict'; | |
import { | |
webpackHelper | |
} from 'macaca-wd'; | |
const { | |
driver, | |
BASE_URL | |
} = webpackHelper; | |
describe('test/simple.test.js', () => { | |
before(() => { | |
return driver | |
.initWindow({ | |
width: 800, | |
height: 600, | |
deviceScaleFactor: 2 | |
}); | |
}); | |
beforeEach(() => { | |
return driver | |
.getUrl(`${BASE_URL}`); // your project URL here | |
}); | |
afterEach(function () { | |
return driver | |
.coverage() | |
.saveScreenshots(this); | |
}); | |
after(() => { | |
return driver | |
.openReporter(true) | |
.quit(); | |
}); | |
describe('Page input testing', () => { | |
it('Input todo task', () => { | |
/** | |
* Just example, for more test API, please go to | |
* https://macacajs.github.io/macaca-wd/ | |
*/ | |
return driver | |
.elementByCss('#new-todo') | |
.formInput(`Create Medium article by formInput ${Date.now()}`) | |
.elementByCss('#new-todo') | |
.domEvent('keyup', { | |
key: 'Enter', | |
keyCode: 13, | |
}) | |
.sleep(3000) | |
.elementByCss('#new-todo') | |
.clear() | |
.sendKeys(`Create Medium article by sendKeys ${Date.now()}`) | |
.elementByCss('#new-todo') | |
.domEvent('keyup', { | |
key: 'Enter', | |
keyCode: 13, | |
}); | |
}); | |
}); | |
}); | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment