The general rule is to use IDs whenever possible assuming they are unique across the DOM and not dynamically generated. Quoting Jim Holmes: Whenever possible, use ID attributes. If the page is valid HTML, then IDs are unique on the page. They're extraordinarily fast for resolution in every browser, and...

The method with @BeforeClass annotation should be static. In your case classSetup method should be static. @BeforeClass public static void classSetup(){ logger = new Logger(); stringUtils = new StringUtils(logger); } ...

Alright - I think I figured this out. If anyone has better methods, I'd love to see/read them :) I realize I could have put all of this into one it block, but I like seeing the Executed 2 of 2 SUCCESS over Executed 1 of 1 SUCCESS. describe('Acronym Generator',...

Following Leo's comments. This is not something you need to solve on the protractor level. protractor itself is basically a browser automation testing framework which mimics user action to test your web site. The usual way to report about the test failures by email is to do it on a...

The idea here is to use browser.wait() to wait for the blurred content to disappear: browser.driver.wait(function() { return !browser.driver.isElementPresent(by.css(".blurred")); }, 20000); In this case it would wait up to 20 seconds. It would stop waiting right after the blurred content disappears....

each() fits perfectly here. I would use toBeNonEmptyString() matcher from jasmine-matchers to assert there is a non empty text: element.all(by.repeater('item in detail.container.items')).each(function(item) { expect(item.getText()).toBeNonEmptyString(); }); Also, if you know the expected values added to the list, you can use map(): var items = element.all(by.repeater('item in detail.container.items')).map(function (item) { return item.getText();...

The usual approach is to start protractor in a debug mode and put browser.debugger() breakpoint before the problem block of code. See more information at Debugging Protractor Tests. On the other hand, you can catch the chromedriver service logs that look like: [2.389][INFO]: COMMAND FindElement { "sessionId": "b6707ee92a3261e1dc33a53514490663", "using": "css...

Instead of a name of the window, you need to provide a handle: browser.getAllWindowHandles().then(function (handles) { // switch to the popup browser.switchTo().window(handles[1]); // do stuff with the popup // ... // go back to the main window browser.switchTo().window(handles[0]); }); ...

After investigation I found quite simple way to handle jquery ajax calls from angular page (which is made by jquery ajaxForm plugin) In our test spec i just put browser.executeScript( '$.fn.ajaxForm = function(form){return{submit: function(){form.success([{result: "ok"}]);}}}' ); So in this way i mocked request that is being sent by jquery ajaxForm...

After dealing with this same dilemma myself, I can wholeheartedly recommend using your preferred Selenium webkit (mine is Chrome) in conjunction with XVFB. XVFB allows you to heedlessly run a browser like Firefox, Chrome, etc. which basically eradicates all of the bugginess that inherently comes with using PhantomJS. While it’s...

I've solved this issue by disabling IE protected mode for all zones and also by lowering the security to lowest possible level for all zones as well.

The problem was solved simply by adding require('babel/register'); at the very top of the protractor.conf.js file. for more info check this issue on github So the protractor.conf.js now looks like this: /*eslint-disable no-var*/ 'use strict'; require('babel/register'); exports.config = { specs: ['../tests/e2e/**/*.js'], capabilities: { browserName: 'chrome' }, baseUrl: 'http://localhost:3000', frameworks: ['mocha',...

protractor is basically a wrapper around WedDriverJS (javascript selenium bindings). protractor makes testing AngularJS page easier and more natural, knowing when angular is settled and a page is ready to be interacted with and introducing several angular-specific locators. In other words, you can definitely test knockout pages with protractor. In...

You should pass an element you found to dragAndDrop(): var slider = element(by.id('slider')); browser.actions().dragAndDrop( slider, {x:100, y:0} ).perform(); See other examples here: Drag and drop using protractor in dthmlx component How to simulate a drag and drop action in protractor? ...

You can test whether the element is present. Here is the protractor docs for the isPresent function. So, your code would be something like: var myElement = element(by.css('.elementClass')); expect(myElement.isPresent()).toBeFalsy(); ...

Here is what was able to fix my problem in the end. Courtesy of: How to click on hidden element in protractor? I added this block to my code to hover over the area of the image, and then issue a click command. // Move mouse over the button browser.driver.actions().mouseMove(element(by.css('[ng-src="img/banks/bofa.png"]'))).perform();...

The problem is two-fold: 1) From what I can deduce, the duration property of the $ionicLoading method is implemented with a timeout function. Protractor does not work well with $timeout. So instead of using the duration property, the $ionicLoading dialog can be hidden with a $interval call (adapting the code...

Testing Angular is difficult. Don't be down on yourself. :) Try these two things: Be more specific with your CSS selectors. Add an #idTag to make sure you're clicking on the exact element you want: element(by.id('idTag')).click(); Write an assertion. Your test isn't testing anything. It is only clicking on a...

All Protractor function calls return promises that resolve asynchronously, so if the functions you defined on createNewService are all calling Protractor functions you'll have to wait for them resolve before calling the assert. Try something like the following: it (' :: 2.0 service creation :: should fill out service info...

Since this is an input element you are working with, you need to read the value attribute: expect(element(by.model('first_name')).getAttribute('value')).toEqual('Frank'); The actual problem is that you are overriding the expect() - in this case you need to resolve the promise manually using then(): element(by.model('first_name')).getAttribute('value').then(function (value) { expect(value).to.equal('Frank'); }); ...

I would approach it with isElementPresent() calling it on result[0]: expect(result[0].isElementPresent(by.css('#edit'))).toBe(false); ...

I found out there the issue is in the difference between: element isPresent() and isDisplayed() so if you wait for only isPresent() it could be found in html but not yet displayed. tricky if you just want to use elm.isDisplayed() only, it will crash if the element doesn’t exist yet....

I think you are able to download and install Protractor at least. If so, you should be able to run them manually on the console webdriver-manager update webdriver-manager start I have a step by step tutorial here...

You can check that an element with processComplete class is present: expect(element(by.css('.processComplete')).isPresent()).toBe(true); Or, you can check that a particular element has processComplete class: expect(element(by.css('i.fa.fa-check-circle')).getAttribute('class')).not.toMatch('processComplete'); // perform some action expect(element(by.css('i.fa.fa-check-circle')).getAttribute('class')).toMatch('processComplete'); ...

Finally i solved this using this function in launcher.js var start = Date.now(); casper.test.on('success', function tiempo() { casper.echo(Date.now()-start + "ms"); start = Date.now(); }); This function is started when each test run the event "success"....

OK, I have resolved this issue by myself, but not sure why element and browser don't work. I have changed expect(element(by.css('body')).getText()).toContain('Welcome Test User'); to expect(browser.driver.findElement(by.css('body')).getText()).toContain('Welcome Test User'); So I have changed element to browser.driver.findElement and everything works. I don't know why it happens, but it works :) UPD As I...