Last active
August 1, 2018 14:37
-
-
Save Y2017/f86ff99aee8d5cfdbdc54b84363b6208 to your computer and use it in GitHub Desktop.
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
cd ~/_APP && mkdir -p pr2017_tests && | |
cd ~/_APP/pr2017_tests && | |
npm init -f && | |
npm install g codeceptjs && | |
npm install -g nightmare nightmare-upload && | |
codeceptjs init | |
//Choose webdrive.io | |
Scenario('test some forms', (I) => { | |
I.amOnPage('http://simple-form-bootstrap.plataformatec.com.br/documentation'); | |
// I.saveScreenshot('tc1_1.png'); | |
// var title = yield I.grabTitle(); | |
// assert.equal(title, 'Example application with SimpleForm and Twitter Bootstrap'); | |
I.seeInTitle('Example application'); | |
I.fillField('Email', 'hello@world.com'); | |
I.fillField('Password', '123456'); | |
I.checkOption('Active'); | |
I.checkOption('Male'); | |
I.click('Create User'); | |
I.see('User is valid'); | |
I.saveScreenshot('tc1_2.png'); | |
// I.dontSeeInCurrentUrl('/documentation'); | |
}); | |
SELECT OPTION | |
--- | |
selectOption | |
Selects an option in a drop-down select. Field is searched by label | name | CSS | XPath. Option is selected by visible text or by value. | |
I.selectOption('Choose Plan', 'Monthly'); // select by label | |
I.selectOption('subscription', 'Monthly'); // match option by text | |
I.selectOption('subscription', '0'); // or by value | |
I.selectOption('//form/select[@name=account]','Premium'); | |
I.selectOption('form select[name=account]', 'Premium'); | |
I.selectOption({css: 'form select[name=account]'}, 'Premium'); | |
Provide an array for the second argument to select multiple options. | |
I.selectOption('Which OS do you use?', ['Android', 'iOS']); | |
RETRY | |
--- | |
Feature('Complex JS Stuff', {retries: 3}) | |
Scenario('Not that complex', {retries: 1}, (I) => { | |
// test goes here | |
}); | |
codeceptjs run --steps | |
``` | |
Examples : | |
https://github.com/Codeception/CodeceptJS/tree/master/examples | |
source : | |
http://pythonhackers.com/p/segmentio/nightmare | |
https://github.com/segmentio/nightmare#api | |
http://126kr.com/article/6cbuduph26m | |
http://codecept.io/nightmare/ | |
https://www.npmjs.com/package/codeceptjs |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment