Reputation: 51
I am new to protractor. I followed the steps mentioned in https://www.protractortest.org/#/ When I run the command protractor conf.js, browser opens and closes immediately. I am getting the following error in command line:
[22:41:08] E/launcher - Process exited with error code 100
I tried executing in Firefox by adding capabilities in conf.js
contents of files:
import { element } from "protractor";
describe('angularjs homepage todo list', function() {
it('should add a todo', async function() {
await browser.get('https://angularjs.org');
await element(by.model('todoList.todoText')).sendKeys('write first protractor test');
await element(by.css('[value="add"]')).click();
var todoList = element.all(by.repeater('todo in todoList.todos'));
expect(await todoList.count()).toEqual(3);
expect(await todoList.get(2).getText()).toEqual('write first protractor test');
// You wrote your first test, cross it off the list
await todoList.get(2).element(by.css('input')).click();
var completedAmount = element.all(by.css('.done-true'));
expect(await completedAmount.count()).toEqual(2);
});
});
exports.config = {
seleniumAddress: 'http://localhost:4444/wd/hub',
specs: ['spec.js'],
//useAllAngular2AppRoots: true,
//directConnect=true,
/* capabilities: {
'browserName': 'firefox'
} */
};
Upvotes: 3
Views: 2782
Reputation: 2348
As mentioned in my comment the documentation has not been updated to reflect the fact that in the latest releases the control flow (which was previously used to handle the asynchronous nature of protractor) is disabled by default. Now it is necessary to handle these promises yourself and the async/await
style is the easiest long term.
Below is the example from the main site using the async/await style.
describe('angularjs homepage todo list', function() {
it('should add a todo', async function() {
await browser.get('https://angularjs.org');
await element(by.model('todoList.todoText')).sendKeys('write first protractor test');
await element(by.css('[value="add"]')).click();
var todoList = element.all(by.repeater('todo in todoList.todos'));
expect(await todoList.count()).toEqual(3);
expect(await todoList.get(2).getText()).toEqual('write first protractor test');
// You wrote your first test, cross it off the list
await todoList.get(2).element(by.css('input')).click();
var completedAmount = element.all(by.css('.done-true'));
expect(await completedAmount.count()).toEqual(2);
});
});
I'm not certain this is the cause of your issue but it is a good place to start troubleshooting.
Note: Will only affect if your protractor version is above 6.0
Upvotes: 1