testing

How do you reliably wait for page idle in cypress.io test

淺唱寂寞╮ 提交于 2020-01-02 03:03:47
问题 When using cypress.io to test an angular web page, whats the best / most reliable way to detect when the page is fully loaded and idle. Not just the onload event. Needs to include all XHR requests, angular digest cycles complete and all rendering complete including all animations complete. The reason is that at this point I want to test that the page does NOT contain an element and cant test that until all the above is fully complete. 回答1: You can make Cypress wait for any request to complete

Is 'repeater' in this angular tutorial a jasmine concept?

。_饼干妹妹 提交于 2020-01-02 03:01:26
问题 Looking through angular js tutorial, I do not understand where the repeater (function?) comes from in a jasmine test. Is this a jasmine or an angular construct? The page does have an ng-repeat attribute in a <li> element - but I dont see how that translates to the reference to 'repeater' in the test it('should be possible to control phone order via the drop down select box', function() { //let's narrow the dataset to make the test assertions shorter input('query').enter('tablet'); //where

What is the difference between `assert_frame_equal` and `equals`

非 Y 不嫁゛ 提交于 2020-01-02 02:59:47
问题 I'm curious to find the difference between assert_frame_equal and equal . Both are for checking the equality of two data. It applies for assert_series_equal and assert_index_equal . So what is the difference between equals and testing functions? So far I found was testing functions gives little more flexibility to compare the values, like check_dtpye options etc., and differs from returning values Is this the only difference between them? or otherwise, When Should I use testing functions

How to use Moq to return a List of data or values?

荒凉一梦 提交于 2020-01-02 02:59:07
问题 Can anyone tell me how to return List of data using mock object using Moq framework and assigning the so returned list of data to another List<> variable.?? 回答1: public class SomeClass { public virtual List<int> GimmeSomeData() { throw new NotImplementedException(); } } [TestClass] public class TestSomeClass { [TestMethod] public void HowToMockAList() { var mock = new Mock<SomeClass>(); mock.Setup(m => m.GimmeSomeData()).Returns(() => new List<int> {1, 2, 3}); var resultList = mock.Object

What's the best way to write unit tests for a REST API?

梦想的初衷 提交于 2020-01-02 02:18:06
问题 When writing unit tests for an API wrapper, should I be making real calls to the REST API endpoints or should I use mocl responses that simulate successful and erroneous calls? 回答1: Unit tests mean testing only your unit (API wrapper), nothing else. Thus, unfortunately, you should mock the entire API. On the other hand this never really gives me enough confidence, so I go for system tests (also known as component tests). In that case you should run your API wrapper against existing API, maybe

Robolectric, Problems with clicking list items

隐身守侯 提交于 2020-01-02 01:55:15
问题 I have been struggling with this problem a bit, and I think I am not getting something fundamental about Robolectric. Usually some google searches can help me get to the bottom of this type of problem, but between that and looking at the sample code I am not finding anything of use. I am trying to emulate a click on a list view item and check that an activity is launched after the click. I keep getting back that the current activity I am testing is the resulting activity. I tried removing all

How do i supply “rootelement” option while testing protractor interatively

≯℡__Kan透↙ 提交于 2020-01-02 01:55:12
问题 When I execute node elementexplorer.js http://127.0.0.1:8080/app/view1 I get the following error: There was a webdriver error: Error Error while waiting for Protractor to sync with the page: "root element (body) has no injector. this may mean it is not inside ng-app." Please let me know how to provide the rootelement option. 回答1: At the moment, rootElement defaults to body. If you don't have your ng-app in the body, you will get that error. It can be set manually tho. You need to change the

Need to mock google OAuth2 service

烈酒焚心 提交于 2020-01-01 21:54:13
问题 Need to virtualize google OAuth2 for testing a web app that uses OAuth for user sign in, Any ideas ? Currently using Java/TestNG/Selenium, I tried with Hoverfly but I am still analyzing request/response pairs to figure out how to make simulation succeed. (I have a web application under test ( black box ) where I need to automate tests of some activities made by a google-signed-in user, so first step is to login with google account, I currently do this with (selenium) actual google account but

JS Testing: Trigger jQuery keypress event from CasperJS and PhanthomJS

十年热恋 提交于 2020-01-01 19:42:14
问题 my webpage has a listener to the enter key press event. I am trying to run the casperjs code below to trigger this event, but without success. Although no error is prompted out, the (evaluate) function returns true and the code works fine from my chrome console, the function result, that should be sending a request to the server is never happening casper.then(function(){ var result = this.evaluate(function(term){ var search_form_id = "#search-form"; $(search_form_id).val(term); jQuery(search

Getting RSpec to report intermediate failures

梦想与她 提交于 2020-01-01 18:17:06
问题 Is there a way to get RSpec to report failures as they occur, instead of the long list of green/red dots? I'm running RSpec 2.5.0. 回答1: RSpec supports multiple output formats, specified with the --format option. The default is "progress", the string of dots you're seeing. If you change to a more verbose format, you'll see the name of the test in red/green as you run, but you still won't see what the failure was until the summary that's printed at the end. The other format options, from