e2e-testing

Message: function timed out after 5000 milliseconds - Protractor & CucumberJS

泪湿孤枕 提交于 2019-12-04 17:54:17
cucumberjs --version 1.2.2 protractor --version 4.0.1 Both installed globally via npm I keep getting this error after upgrading to cucumberJs version above. Failures: 1) Scenario: Get records from DB e2e\features\transac.feature:7 Step: Given I am logged in as "username" with "password"- e2e\features\transac.feature:8 Step Definition: e2e\steps\loginSteps.js:17 Message: function timed out after 5000 milliseconds 1 scenario (1 failed) 1 step (1 failed) 0m06.608s Please note I included my env.js above in the cucumber options block and here's my env.js content: exports.config = { // set to

Making an API call while running protractor tests

我们两清 提交于 2019-12-04 15:10:45
I have built a web application using angular2.0 and typescript . Now I am writing E2E for my site using protractor . Now, in one of my tests I need to make an API call(HTTP GET request) and use the response value as an input in my test case. So basically I want to know how to make a GET request in Protractor-Jasmine and use the result/response. Protractor runs on top of nodejs, and under the hood is calling Selenium API. You can use all of the node libraries, including request . Choose between import/require: import * as request from 'request'; var request = require('request'); And perform

“Mock” a backend http response with Protractor, Cucumber and Chai

霸气de小男生 提交于 2019-12-04 13:10:49
First of all i will explain my goal : I have an app divided into several modules. In this case I just want to test my ui-module. I have some calls to the back-end there and i want to simulate the response or just change some models' values. I think you can not change the value of a model, so i am trying to simulate the back-end. I have a model 'documents' that when i press a search button, it get data from the back-end in other module. Example: http://localhost:8080/search-module/API/search I want to test that without the backend. I have tried with "httpbackend" but i can not get it going.

Protractor expectation that element is eventually present

烂漫一生 提交于 2019-12-04 10:58:25
Is there a way to have an expectation that an element is eventually on the page? e.g. a way for browser.wait(protractor.ExpectedConditions.presenceOf(element(by.partialLinkText('Continue'))), 1000, 'Unable to find continue link'); to fail with an expectation error instead of a timeout? Essentially a way to have a isEventuallyPresent() instead of isPresent() in the line below expect(element(by.partialLinkText('Continue')).isPresent()).toBe(true); For reference, I'm using browser.ignoreSynchronization = true even though it's an Angular app, and using Jasmine (at least for now). Using the facts

Protractor how to run login test script first

大兔子大兔子 提交于 2019-12-04 09:34:38
问题 I am trying to test an Angular Single Page application with protractor. I need to run the login script first. Only then I can move to other routes since there is a check for token in localStorage on route change. Is this testing approach correct?. In that case I need to run the login script first. Does protractor allows to control the spec file order. Or should I run the each script independently by hardcoding the token in localStorage (Should I do login api call independently before each

A Jasmine spec timed out. Resetting the WebDriver Control Flow - when redirect to new page

若如初见. 提交于 2019-12-04 04:29:48
I'm bedinner in e2e testing and have a problem. When I do login - I make redirect from login.php to index.php page. But my test is fails with following errors: ..A Jasmine spec timed out. Resetting the WebDriver Control Flow. F Failures: 1) Login Page should login and redirect to overview page with CR Operators rights Message: Error: Timeout - Async callback was not invoked within timeout specified by jasmine.DEFAULT_TIMEOUT_INTERVAL. Stack: Error: Timeout - Async callback was not invoked within timeout specified by jasmine.DEFAULT_TIMEOUT_INTERVAL. 3 specs, 1 failure My code: it('should login

tell Protractor to wait for the page before executing expect

核能气质少年 提交于 2019-12-03 20:28:05
When I click the export button, it makes a REST call to our endpoint then few seconds after, I receive the response then I also render the table. Unfortunately, I read that every call is asynchronous which means my expect will be executed even if table hasn't been rendered yet. The expect I wrote checks if the string is on the table but it's failing since it's not there yet. What is the proper approach to this? it('should generate global user report', function() { element(by.css('button#exportButton')).click(); expect(element(by.css("th[name*=Date]")).getText()). toEqual('Date'); }) The error

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

帅比萌擦擦* 提交于 2019-12-03 16:23:27
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 gets overwritten and scoping is such that I cannot access it in the afterLaunch function, that is where

Protractor how to run login test script first

我的梦境 提交于 2019-12-03 03:18:11
I am trying to test an Angular Single Page application with protractor. I need to run the login script first. Only then I can move to other routes since there is a check for token in localStorage on route change. Is this testing approach correct?. In that case I need to run the login script first. Does protractor allows to control the spec file order. Or should I run the each script independently by hardcoding the token in localStorage (Should I do login api call independently before each test). My login script contains the following it('Login with wrong email', function() { }) it('Login with

Protractor e2e Tests Login Redirection

喜欢而已 提交于 2019-12-02 23:01:48
Currently have a partial end-to-end test that enters a username/password and clicks 'sign in'. It does that successfully, but concludes at a "thanks you're logged in" page, instead of being redirected to the 'account portal' or 'dashboard', the way it would if I logged in through the browser.\ New to this project but we are using OAuth. Main question: Does this sound like a need for http mocking? Further details: spec.js describe('login page', function() { browser.driver.get('http://url.path/login'); it('should render login page', function() { // Checking the current url var currentUrl =