angularjs-e2e

Protractor - Wait for async promise before doing next

白昼怎懂夜的黑 提交于 2019-11-30 07:02:25
First of all, I've already checked various post and blogs concerning that point and I still can't figure out how to make it correctly. I have tried many different combinaison of : browser wait protractor.controlFlow().execute protractor.controlFlow().await( ...Still no success.. My problem Within my beforeEach function, I'd like to call a protractor promise and wait for it to resolve before performing the rest of my code. My Code I've prepared this simple test for anyone willing to help me describe('testAsync', function() { beforeEach(function() { console.log('beforeEach - step 1 ') browser

e2e protractor test requiring oauth authentication

|▌冷眼眸甩不掉的悲伤 提交于 2019-11-30 06:27:45
问题 I've got an Angular app that requires authentication with Google, granting of some scopes, etc, and I'm trying to set up automatic e2e tests for it. I have protractor working well for me in general, but when we get to the google auth page, login, and get redirected, protractor fails the test because "document unloaded while waiting for result." Is there a tool or technique I can use to authenticate to a development google account beforeEach test? If I could just get the framework to hold on

How to mock angular.module('myModule', []).value() in Jasmine/Protractor

為{幸葍}努か 提交于 2019-11-30 05:27:32
问题 I'm trying to use Protractor's addMockModule() to mock a simple AngularJS module and override a variable: Here is my HTML: <body ng-app="myApp"> <div ng-controller="myAppController"> Overriden module value <b>{{myValue}}</b> </div> <script src="/Scripts/Lib/angular/angular.js"></script> <script src="/module.js"></script> <script src="/controller.js"></script> </body> Here is my Controller: var myApp = angular.module("myApp", ['myModule']); myApp.controller("myAppController", function ($scope,

Protractor addMockModule and $httpProvider interceptor

北城余情 提交于 2019-11-30 03:41:12
问题 This question is a possible solution for my other question (where they advice to use addMockModule from protractor): Call other api when running tests using Protractor. I have the following file: mockedRest.js this is the module I want to add to protractor. It should intercept any REST calls and replace the address (api/ to apiMock/). exports.apiMockModule = function () { console.log('apiMockModule executing'); var serviceId = 'mockedApiInterceptor'; angular.module('apiMockModule', ['myApp'])

How to test drag & drop functionality in AngularJS e2e testing

倖福魔咒の 提交于 2019-11-29 19:05:04
问题 I am trying to test my application where I need to move a widget from one location to other, in other word I need to test drag & drop functionality in an end to end test. How would I test this? 回答1: I had this same issue. The solution for me was to follow the advice in the Selenium issue here: https://code.google.com/p/selenium/issues/detail?id=3604#c20 Starting with the example from @nilsK, here was my solution: var yourOffset = {x:5,y:5}; ptor().actions() .mouseMove(yourElement,yourOffset)

Set browser timezone in a Protractor test

此生再无相见时 提交于 2019-11-29 16:08:21
I'm working on a project where the e2e tests are made using protractor. Some tests, need to validate date/times. Tests are ok on our continuous deliver platforms that ensure the timezone remains stable. However, when test are run on a local machine, where timezone can change, tests fail because the captured browser is running on a different timezone. I need to, somehow, control the timezone through protractor in order to have platform independent tests. Is this possible? Late answer, but maybe someone in the future can use this...It is a bit ugly, but I haven`t found anything prettier.It might

Angular2 Inject ElementRef in unit test

五迷三道 提交于 2019-11-29 11:05:17
问题 I am trying to test a component that receives a reference to ElementRef through DI. import { Component, OnInit, ElementRef } from '@angular/core'; @Component({ selector: 'cp', templateUrl: '...', styleUrls: ['...'] }) export class MyComponent implements OnInit { constructor(private elementRef: ElementRef) { //stuffs } ngAfterViewInit() { // things } ngOnInit() { } } and the test: import { beforeEach, beforeEachProviders, describe, expect, it, inject, } from '@angular/core/testing'; import {

Protractor - Where to use browser.waitForAngular()

笑着哭i 提交于 2019-11-29 11:04:07
问题 I have some tests written using protractor for angular.js app. I am using Page Objects design pattern and there i have some methods that navigate to other pages by clicking on links and buttons. and soon after that i am calling browser.waitForAngular() . Page Object module.exports = function () { this.companyNameLink = element(by.id('viewCompany')); this.newMeetingButton = element(by.id('newMeetingButton')); this.createNewGeneralMeeting = function () { this.newMeetingButton.click(); browser

Set an item from localStorage in a protractor test

大憨熊 提交于 2019-11-29 02:58:38
问题 describe('The feature', function() { beforeEach(function () { browser.executeScript('localStorage.setItem("key","value");'); }); it('should do this', function() { }); }); but i get this error when the test is run against selenium with chromedriver 2.10 and chrome 37 Executing: [execute script: window.localStorage.setItem("key","value");, []]) 15:31:29.747 WARN - Exception thrown org.openqa.selenium.WebDriverException: <unknown>: Failed to read the 'localStorage' property from 'Window':

Getting error: Error while waiting for Protractor to sync with the page: {}

空扰寡人 提交于 2019-11-29 00:07:39
My e2e.conf.coffee file is: exports.config = baseUrl: 'http://localhost:9001' specs: [ 'e2e/**/*.coffee' ] framework: 'jasmine' I have my node project running and listening on port 9001. My test is: describe 'Happy Path', -> it 'should show the login page', -> console.log browser expect(browser.getLocationAbsUrl()).toMatch("/view1"); it 'should fail to login', -> setTimeout -> console.log "FAIL!" , 1200 And the error that I get is: Failures: 1) Happy Path should show the login page Message: Error: Error while waiting for Protractor to sync with the page: {} Stacktrace: Error: Error while