14

I do use Webdriver to use Angular pages. So it IS possible, and OP's assumption is wrong. But it is not easy - not as straightforward as using WebDriver to automate more traditional web pages (which do not use "single page application" concept and DOM manipulation so heavily), where is trivial to add id or name to any element you want. Angular uses IDs ...


12

Adding couple notes to Niels's great answer. Protractor wraps WebDriverJS which is Javascript Selenium bindings - in other words, Protractor does interact with a browser through the Selenium WebDriver. Protractor provides a really convenient API and has some unique Angular-specific features, like Angular specific element locating strategies (by.model(), by....


11

Protractor is Selenium, but then integrated with tooling and helper methods. If you know programming and Selenium it should be relative easy to pick up. Protractor is an end-to-end test framework for Angular and AngularJS applications. Protractor is a Node.js program built on top of WebDriverJS. Protractor runs tests against your application running ...


7

Avoid the use of 'Absolute XPath' if possible in your coding. If your element is having with class, ID, name & Type attributes then try to locate the element with the use of Relative XPath. You can use- XPath: //input[@id='portfolioName'] OR XPath: //input[@id='portfolioName'][@type='text'] OR Xpath=//input[@type='text' AND @name='portfolioName[]'...


7

It's an okay idea with some guidelines. QA code is software. And software engineering principles should still apply. Since none of the developers know protractor, they should be trained. They may be able to add tests to their application on their own eventually. As for who to code review, the frontend developers are probably a good choice. They might ...


6

I discovered the following points while speeding up my protractor(selenium) tests: Run tests in a headless browser(from version 59, chrome can be run headless natively) Run tests as direct connection(directConnect: true) Don't log off & reuse user session between tests with the same base state(Home Page) wherever possible. Make short & simple to ...


6

I somewhat followed the transition process as below: Learned basic JavaScript, including basic constructs like variables, loops, conditions, functions. Learned advanced JavaScript, particularly asynchronous nature, and its problems. Usage of callbacks and role of anonymous functions. Once I grasped the basic concept of async execution, learned what ...


5

Yes - For Unit Testing Javascript I've been working with this concept over the last few years and I've come to the following, multi-tier approach: Unit testing on the backend. For example with Ruby or Java on the server code. User acceptance testing on the UI using Selenium and a programming language such as Ruby with Capybara Unit testing on the front ...


5

I think you've got it wrong. Organizing test specs into suites in Protractor does not mean you need to copy the file and keep multiple versions of the same file. Instead, suites is simply a configuration parameter that maps "suite names" into a list of specs. In other way, this is a way to group specs by a certain criteria. Example: suites: { smoke: [ ...


5

The nice thing of TypeScript you do not have to migrate at once. TypeScript is a superset and can parse plain JavaScript as well. You can keep your old code and start using TypeScript for new code or just some features. Read this story about gradually switching at Slack: One of the reasons why the Slack team chose TypeScript is its being a superset of ...


5

A few things to consider come to mind: Only run in Chrome Controversial huh? Let me explain more fully though. My question for multi-browser and indeed multi-device (responsive web sites) testing is always what kind of browser / device specific issues have we seen and do we expect to see? How many browser specific errors have occurred in the last year. ...


5

Open source: Cypress.IO looks promising, but I have been holding off with starting to use it on a production project. My main reason that it is a commercial company and I cannot be sure they keep their open-source promise. I think development tools should be open-source. I don't want to invest my time and our company's resources if I am not sure I can re-...


5

As an aside, although I will want to test the 'log in' capability too, is there a way to 'skip' this during testing, so that I can run the tests on all of the features of the app, without Protractor having to log in to the app every time to run the tests? You have multiple ways of handling that, but using beforeAll() to provide setup for your it() tests ...


4

If it is an Angular application I would go for Protractor EDIT: Protractor was made for Angular Apps. You don't have deal with elements not being visible yet due to page loads. Protractors deals with it for you As far as I know CodedUI des not provide this functionality. Correct me if I'm wrong. Resource reason: Most Angular projects are javascript ...


4

The trade-off is between script length and diagnostic value: Script length: one script with everything in it may be shorter (and should never be longer) than a positive script plus a negative script, because multiple scripts will duplicate setup steps. Because it has fewer steps, the everything script will probably be faster to execute than multiple ...


4

In my opinion you should not mix positive and negative paths because every test has to be independent and give a clear result. Suppose that you create 100 scripts both positive and negative and all tests with negative paths fail, in theory you'll never know if they would fail even with positive ones until you fix your code. My suggestion is having a ...


4

You just need to remove all files in the "Downloads" directory inside the onPrepare() function which you define inside your Protractor configuration file. Let's use the synchronous rmDir function suggested here (feel free to use a different method): var fs = require('fs'); function rmDir (dirPath) { try { var files = fs.readdirSync(dirPath); } catch(e)...


4

We have recently started with writing WebDriver tests in JavaScript and I have to agree that the asynchronous execution is adding an unneeded complexity. Pro's: Same test-runner as other (front-end) unit-tests Everyone knows JavaScript (e.g. front-end development with Angular, Vue or React) If you use JavaScript (e.g. NodeJS) also on the back-end, sticking ...


4

As you mention, the asynchronous chaining API seen in "selenium-webdriver" NPM package and also in nightwatch, protractor, testcafe, cypress, intern and wd.js etc can be quite hard to understand. Luckily there is a way to write E2E tests in Node and still get an API that feels intuitive and synchronous, namely http://webdriver.io Webdriver.io is able to do ...


4

NO. I would not suggest doing so until you have a specific objective to be met by doing it. In my opinion, its only worth the effort if you are working on large development project but for comparatively smaller UI automation projects with less than 1K tests, I would not suggest so. Also, there are a lot of misconceptions about the advantages of moving ...


4

An absolute XPath should start with a slash /: '/html/body/div[2]/div[1]/div/div[1]'. It is advised to use relative XPath like: '//div[@id="portfolioName"]'. For this to work, the id has to be unique for div tags. However if the id is unique, you can better identify the object by id and not XPath: driver.findElement(By.id("portfolioName"))


4

Open Source: I am a developer at Cypress.io. Cypress recently released its public beta and is now open source. The code for it's core product, the Test Runner can be found here. The Cypress Dashboard Service, used to display test recordings and data when tests are run in CI, will be free for open source projects and paid based on usage for private projects ...


4

After a long hard fought battle, I was able to overcome this using opposite of what K-8 had suggested. Instead of checking if an element is visible on the viewport, I checked the negative of that, which is if element is not visible on the viewport. So, I did this public waitForSpinnerDisappear(){ let EC = protractor.ExpectedConditions; browser.wait(EC....


4

Let's first wrap our heads around the definitions: a lot of different languages have selenium bindings. And JavaScript is no exception - WebDriverJS are javascript selenium bindings - a selenium client written in JavaScript Protractor is a library that is built on top of WebDriverJS adding a lot of convenient and handy functionality on top. And, at the ...


4

I would expect directly referencing it by a few milliseconds. However premature optimization ('efficiency, performance') without a clear issue to address will 'fix' the wrong problem and lead to less readable and maintainable code, which is more important. So 'faster today' will quickly lead to 'but slower 'tomorrow' (i.e. the next time a change is needed) ...


3

multiCapabilities: [ {'browserName': 'internet explorer'}, {'browserName': 'chrome'} ], maxSessions: 1,


3

You'll need to turn browser.ignoreSynchronization = true on when you are accessing a non-angular page. If It's pop up then, just as information for other possible users, I modified a bit the promise handle: var handles = handlePromise.then(function (handles) { popUpHandle = handles[1]; var handle = browser.switchTo().window(popUpHandle); ...


3

You can approach this in multiple ways but you need to think beyond the conf.js file. You should look into using a build tool such as gulp, grunt or even npm (if you like shell scripting). All of which allow you to pass an external baseUrl and set the order in which your tests run. Personally I use gulp with gulp-protractor and runSequence (for executing ...


3

I suppose you can look at tools that were not created specifically for Angular but convenient for Angular web apps testing. I've tried to use TestCafe for testing Angular web apps to compare it with Protractor and it was comfortable. TestCafe api has Selectors, it helps to create useful page model for Angular web apps tests. For example, you call replace ...


3

I was able to accomplish this using a gulp task that accepted an argument representing the environment. You can configure gulp tasks to accept arguments using a tool like yargs and work with Protractor using gulp-protractor I used this to switch out the baseUrl in the protractor config. Example: const protractor = require("gulp-protractor").protractor; ...


Only top voted, non community-wiki answers of a minimum length are eligible