Skip to content

Instantly share code, notes, and snippets.

@narqo
Created November 13, 2015 23:18
Show Gist options
  • Save narqo/46bd71345142c9c1e3e3 to your computer and use it in GitHub Desktop.
Save narqo/46bd71345142c9c1e3e3 to your computer and use it in GitHub Desktop.
export default class Block {
constructor(driver) {
this.driver = driver
}
}
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);
}
}
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