angularjs-e2e

Clicking on given coordinates of element in protractor

ⅰ亾dé卋堺 提交于 2019-12-05 16:10:24
问题 I want to click on a specific location of my canvas element, so I wrote the following Protractor code: var canvas = element(by.id("canvas")); var clickCanvas = function(toRight, toBottom) { browser.actions() .mouseMove(canvas, -toRight, -toBottom) .click(); } toRight / toBottom are the numbers of pixels where the click should be made, relative the top left corner of my canvas. However, the click does not seem to be executed at the given coordinates. I got the snippet from a related question

How to mock get(id) requests

若如初见. 提交于 2019-12-05 11:52:22
I am building an application prototype and try to mock the REST web-services. Here is my code: var mock = angular.module('mock', ['ngMockE2E']); mock.run(function($httpBackend){ users = [{id:1,name:'John'},{id:2,name:'Jack'}]; $httpBackend.whenGET('/users').respond(users); $httpBackend.whenGET(new RegExp('\\/users\\/[0-9]+')).respond(users[0]); } Everything is ok, my resource User.query() returns all users, and User.get({id:1}) and User.get({id:2}) returns the same user (John). Now to improve my prototype, I would like to return the appropriate user, matching the good id. I read in the angular

'$' selector in Protractor

旧时模样 提交于 2019-12-05 10:33:17
I have seen in many examples like this $('.selector') and I am also using this. So what this $ variable does. This is what I got from the protractor docs . Calls to $ may be chained to find elements within a parent. There is no example in docs which use $ alone. We are using $ to chain with element selector. Also $('.selector') itself is an element, when we does this element($('.selector')) , it is an error. So how to use this $ selector in protractor. Does it have all the features of JQuery $ . I tried $('.selector').children which says children is not a function. Any help is greatly

protractor remote tests multibrowser

◇◆丶佛笑我妖孽 提交于 2019-12-05 09:07:59
问题 I'm new to Protractor. Could you please advise if there is any way to run protractor E2E tests on multiple remote hosts (Ubuntu - Firefox,chrome, Windows - IE, Chrome, firefox, Mac - Firefox, Chrome, Mobile - Android device, Mobile - iOS etc..), with multi browsers. Please share sample config to specify remote hosts. Due to licensing costs not considering to use saucelabs, planning to setup in local test environment. Currently I'm able to run protractor E2E tests, with multibrowsers on one

Protractor coverage not generating report

孤者浪人 提交于 2019-12-05 07:28:56
问题 Backend of our app is in PHP and for frontend we are using AngularJs . We successfully managed to run e2e tests on local as well as on production server using protractor . After writing loads of e2e tests for our app, we started looking for its coverage similar to that of unit testing. After searching for lot, luckily we find https://www.npmjs.com/package/grunt-protractor-coverage , exactly what we wanted. I took help from http://lkrnac.net/blog/2014/04/measuring-code-coverage-by-protractor/

Angularjs - simulate touch event in Protractor e2e test

牧云@^-^@ 提交于 2019-12-05 03:24:04
I use Protractor with Jasmine for my mobile Angularjs app. I want to test a touch event (touchStart / touchEnd etc...) on a particular element. Something like: it('should play video', function(){ var poster = by.css('.video-poster'); element(poster).??? //Simulate touch event here }); Meligy Update: Since Protractor returns a Selenium element finder not an angular element, you'll have to use the executeScript() function to call a JavaScript method on it, like: var poster = element(by.css('.video-poster')); browser.executeScript( 'angular.element(arguments[0]).triggerHandler("touchstart");',

Protractor - beforeAll and afterAll undefined

拈花ヽ惹草 提交于 2019-12-04 18:17:53
I am using Protractor with jasmine. Protractor version is 3.2.2 , I found this using the command protractor --version . How to find the jasmine version used by protractor. When I read the updgrade doc , I couldn't find the steps to upgrade jasmine, all I found is to add jasmine2 in configuration file. My configuration file looks like this exports.config = { framework: 'jasmine2', .... } But I still was not able to use beforeAll and afterAll . Am I missing anything here. Since beforeAll and afterAll are undefined I think the version of jasmine used by protractor is not 2x. Any help is greatly

Test login with protractor on a non angular page

∥☆過路亽.° 提交于 2019-12-04 18:13:13
问题 I am trying to use protractor for e2e testing but first I need to login on a non-angular page. I try to directly use the webDriver as indicated here but it fails. My e2e test: describe('angularjs homepage', function() { it('should prompt the login page', function() { browser.get('/'); expect(browser.driver.find(By.id('user_password'))); }); }); My logs: Running "protractor:all" (protractor) task Using the selenium server at http://localhost:4444/wd/hub F Failures: 1) angularjs homepage should

Protractor: Failed: protractor.getInstance is not a function

耗尽温柔 提交于 2019-12-04 17:23:29
I have installed protractor globally , and after locally. I am using this code: var protractor = require('protractor'); var ptor, driver; ptor.switchTo().frame(driver.findElement(protractor.By.tagName("iframe"))); driver.findElement(protractor.by.css(".cke_editable")).sendKeys("123"); And get this message: Failed: protractor.getInstance is not a function What am I do wrong? P.S. I havn't " lib/protractor.js ", only " bin/protractor ". Wherever you are using var ptor = protractor.getInstance() , just get the driver from the browser var browser = require("protractor").protractor.browser; var

Protractor - how to reuse the same spec file for different tests

拜拜、爱过 提交于 2019-12-04 17:21:20
In my Protractor conf.js file, I'd like to re-use the same spec files multiple times; however, it's seems to not be possible. Some background: We are reading test cases from a JSON file, launching reports, then testing grid results and various DOM elements. All reports have the same format. The primary differences lie in the report titles, data columns, actual data results, etc. So in my conf.js file, ideally I'd like to re-use the same spec files multiple times - but my understanding is that I cannot do this. For example, my spec array: specs: [ 'spec/report1-spec.js', 'spec/report-grid