jasmine

protractor-html-screenshot-reporter not showing any report after test execution

梦想与她 提交于 2019-12-21 05:37:06
问题 I am using protractor to automate a hybrid mobile app, I am using the Protractor-HTML-screenshot-reporter, but it is not displaying any report after successful test execution. Here's my code below: var HtmlReporter = require('protractor-html-screenshot-reporter'); var reporter=new HtmlReporter({ baseDirectory: 'C:\\Users\\bhawani.prasad\\Desktop\\Protractor\\PageObject\\report', // a location to store screen shots. docTitle: 'Protractor Demo Reporter', docName: 'protractor-demo-tests-report

How to make a list of failed specs using jasmine custom reporter to post to slack?

烈酒焚心 提交于 2019-12-21 05:14:15
问题 I am trying to work on a custom jasmine reporter and get a list of all the failed specs in the specDone function: specDone: function(result) { if(result.status == 'failed') { failedExpectations.push(result.fullName); console.log(failedExpectations); } } where failedExpectations will store an entire list of the failed specs and i need to access this in the afterLaunch function in the protractor config file. But due to the fact that the config file loads everytime a new spec runs it basically

Using ngMock to simulate $http calls in service unit tests

a 夏天 提交于 2019-12-21 05:13:09
问题 I've been looking at this for hours. I've tried example after example. I just can't seem to get this to work. Please help =) I am doing all this on a clean clone of the angular-seed repo (git://github.com/angular/angular-seed.git). I have made no changes except those listed below. Problem: When I run the following, the test works. Note that in this version, the service returns a value before doing any kind of $http call. ./app/js/services/services.js 'use strict'; angular.module('myApp

Angular.js unitest a Directive with external template using html2js - Fail to load templates

为君一笑 提交于 2019-12-21 04:25:21
问题 I am trying to test a Directive which uses external template. I tried all the following solutions with no luck: ng-directive-testing How to test directives that use templateUrl and controllers? AngularJS + Karma + Ng-html2js => Failed to instantiate module ...html I created a test directive (a simple div) and tested it using an inline 'template' and external 'templateUrl'. The inline solution works while the external doesn't: angular.module('AdUnit').directive('actionButton',function(

BlanketJS + Jasmine 2.0 not working

邮差的信 提交于 2019-12-21 04:06:35
问题 I have been testing with Jasmine 2.0.0 and it works without any problem. But there's a problem when I append BlanketJS to my code. I used a specRunner(https://github.com/alex-seville/blanket/blob/master/test/jasmine-requirejs/runner.html) that works with Jasmine 1.3.1. But It does not work when I replace Jasmine 1.3.1 with Jasmine 2.0.0, Here's original code from BlanketJS repo: <html> <head> <title>Jasmine Spec Runner</title> <link rel="stylesheet" type="text/css" href="../vendor/jasmine.css

Testing javascript with Chutzpah and requirejs

冷暖自知 提交于 2019-12-21 03:48:50
问题 I just wonder if there is a simple tutorial showing how to test javascript in visual studio with Chutzpah, require.js and jasmine. Basically, i want to run the tests without using an .html file so that i can see the results in the vs test explorer. 回答1: You can find some sample codes here: https://chutzpah.codeplex.com/SourceControl/latest#Samples/RequireJS/Jasmine/tests/base/base.jasmine.test.js Please note if you want to use requirejs with Chutzpah and Jasmine, you need to set

How would I test a $scope.watch (AngularJS) change in Jasmine?

我的梦境 提交于 2019-12-21 03:08:12
问题 I've just recently started writing something with AngularJS and I'm not sure how to go about writing a test for this particular thing. I'm building a "Help Request" mode that has different states. So in my controller, I use a $scope.request_mode variable. The different links to activate help requests set that variable to something differently. Then inside my directive, I'm doing a $scope.$watch('request_mode', function(){...}); to selectively activate or deactivate things as the request mode

“Stale element reference” error behavior undestanding

走远了吗. 提交于 2019-12-21 02:30:09
问题 Code 1: element(by.id('myButtonId')).click(); return element(by.id('myValidationSummaryId')).getText().then(function (val) { return val; }); Above code worked fine many times and then it started giving below error "Failed: stale element reference: element is not attached to the page document" this id 'myValidationSummaryId' is no where used before, clicking button posts form and success/failure message available from service side in 'myValidationSummaryId'. Code 2: return element(by.id(

How to unit test async Redux actions to mock ajax response

梦想与她 提交于 2019-12-21 01:11:28
问题 I am creating a middleware for making ajax requests using async actions. The middleware intercepts original action, performs ajax request, and re- dispatch es the original action along with the response from the url . So, my Component would merely dispatch an action like this onClick() { dispatch(ActionCreator.fetchUser()); } Rest will be taken care by the middleware as shown here. My question is, what should I do for unit testing? Should I mock the onClick itself? or I should write a mocked

How do I test angularjs directive to spy on the function call?

不羁岁月 提交于 2019-12-20 20:38:06
问题 Code below executes but complains about element.popover not being invoked. I can't seem to figure out what the issue is. Thanks for help in advance. directive: angular.module('directives', []). directive('popOver', function ($http) { return { restrict:'C', link: function (scope, element, attr) { element.bind('mouseover', function (e) { $http.get("someurl" + attr.chatid + ".json").success(function (data) { element.popover({content: data.firstName + " " + data.lastName }); }); }); } } })