I want to execute protractor script on android emulator using Appium, but the problem emulator isn't launched when i tap: " protractor conf.js " on terminal. The test is passed in chrome browser of windows instead of browser in the emulator. Shall i add other capabilities ? or i should change the base url ?
// An example configuration file.
exports.config = {
seleniumAddress: 'http://localhost:4733/wd/hub',
specs: ['todo-spec.js'],
directConnect: true,
// Capabilities to be passed to the webdriver instance.
capabilities: {
'browserName': 'chrome',
'device': 'android',
'deviceName' : '5554:AndroidDevice',
device: 'android',
'appium-version': "1.4.16.1",
deviceName : '5554:AndroidDevice',
},
// Framework to use. Jasmine is recommended.
framework: 'jasmine',
baseUrl: 'http://127.0.0.1:5858',
// Spec patterns are relative to the current working directly when
// protractor is called.
// Options to be passed to Jasmine.
jasmineNodeOpts: {
defaultTimeoutInterval: 30000
}
};
//------------------todo-spec.js----------------------------------------
describe('angularjs homepage todo list', function() {
it('should add a todo', function() {
browser.get('https://angularjs.org');
element(by.model('todoList.todoText')).sendKeys('write first protractor test');
element(by.css('[value="add"]')).click();
var todoList = element.all(by.repeater('todo in todoList.todos'));
expect(todoList.count()).toEqual(3);
expect(todoList.get(2).getText()).toEqual('write first protractor test');
// You wrote your first test, cross it off the list
todoList.get(2).element(by.css('input')).click();
var completedAmount = element.all(by.css('.done-true'));
expect(completedAmount.count()).toEqual(2);
});
});
Remove the directConnect
to allow it to use the selenium server:
// An example configuration file.
exports.config = {
seleniumAddress: 'http://localhost:4733/wd/hub',
specs: ['todo-spec.js'],
directConnect: true, <-- remove this line
...
}
A related topic that should help clearing things up: