Created
November 13, 2015 23:18
-
-
Save narqo/46bd71345142c9c1e3e3 to your computer and use it in GitHub Desktop.
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
export default class Block { | |
constructor(driver) { | |
this.driver = driver | |
} | |
} |
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
import Block from './lib/block'; | |
class SearchArrow extends Block { | |
get requestInput() { | |
return this.driver.findElement('#search-input'); | |
} | |
get searchButton() { | |
return this.driver.findElement('.b-form-button__input'); | |
} | |
search(request) { | |
this.requestInput.sendKeys(request); | |
this.searchButton.click(); | |
} | |
} | |
export class SearchPage { | |
constructor(driver) { | |
this.driver = driver; | |
this.searchArrow = new SearchArrow(driver); | |
} | |
search(...args) { | |
this.searchArrow.search(...args); | |
} | |
} |
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
import test from 'tape'; | |
import {SearchPage} from './page/searh'; | |
var driver, searchPage; | |
test.before('setup', t => { | |
driver = new FirefoxDriver(); | |
searchPage = new SearchPage(this.driver); | |
}); | |
test.before('loadPage', t => { | |
driver.get('http://www.yandex.com'); | |
}); | |
test.after('closeDriver', t => { | |
driver.quit(); | |
}); | |
test('sample', t => { | |
searchPage.search("yandex"); | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment