Skip to content

Instantly share code, notes, and snippets.

@surfjedi
Last active August 29, 2015 14:24
Show Gist options
  • Save surfjedi/c47df0b1c977041af42e to your computer and use it in GitHub Desktop.
Save surfjedi/c47df0b1c977041af42e to your computer and use it in GitHub Desktop.
demo protractor conf and spec
describe('gloo homepage', function() {
it('Get gloo live', function() {
browser.get('https://polymer.gloo.us/');
browser.sleep(2000);
var heading = element(by.css('h1'));
expect(heading.getText()).toEqual('Grow a better You with Gloo');
});
it('Get local thru ngrok', function() {
browser.get('http://1d0151e7.ngrok.io/');
browser.sleep(2000);
var heading = element(by.css('h1'));
expect(heading.getText()).toEqual('Grow a better You with Gloo');
});
describe('todo list', function() {
var todoList;
beforeEach(function() {
browser.get('http://www.angularjs.org');
todoList = element.all(by.repeater('todo in todoList.todos'));
});
it('should list todos', function() {
expect(todoList.count()).toEqual(2);
expect(todoList.get(1).getText()).toEqual('build an angular app');
});
it('should add a todo', function() {
var addTodo = element(by.model('todoList.todoText'));
var addButton = element(by.css('[value="add"]'));
addTodo.sendKeys('write a protractor test');
addButton.click();
expect(todoList.count()).toEqual(3);
expect(todoList.get(2).getText()).toEqual('write a protractor test');
});
});
});
// An example configuration file.
exports.config = {
// directConnect: true,
seleniumAddress: 'http://localhost:4444/wd/hub',
// Capabilities to be passed to the webdriver instance.
capabilities: {
'browserName': 'chrome'
},
// Framework to use. Jasmine 2 is recommended.
framework: 'jasmine2',
// Spec patterns are relative to the current working directly when
// protractor is called.
specs: ['example_spec.js'],
// Options to be passed to Jasmine.
jasmineNodeOpts: {
defaultTimeoutInterval: 300000
}
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment