e2e-testing

Protractor e2e Tests Login Redirection

南楼画角 提交于 2019-12-20 10:33:29
问题 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

In Cypress, set a token in localStorage before test

空扰寡人 提交于 2019-12-20 10:00:56
问题 I want to login and set a localStorage token on the client (specifically jwt) How can I accomplish this using cy.request , as suggested in the Cypress Documentation? 回答1: Here's an example of adding a command cy.login() that you can use in any Cypress test, or put in a beforeEach hook. Cypress.Commands.add('login', () => { cy.request({ method: 'POST', url: 'http://localhost:3000/api/users/login', body: { user: { email: 'jake@jake.jake', password: 'jakejake', } } }) .then((resp) => { window

Selecting angular-ui date-picker value from the calendar using Protractor

偶尔善良 提交于 2019-12-19 11:32:09
问题 My datepicker structure looks like: <button type="button" class="date-picker-item"> <span>1</span> </button> <button type="button" class="date-picker-item"> <span>2</span> </button> etc.. I am trying to use by.cssContainingText from the protractor api. element.all(by.cssContainingText('.date-picker-item > span', day)) but its not selecting it at the minute. Do I need to target this a different way? Thanks a lot in advance. 回答1: In one of my project i wrote function like this: elementDate:

“angular is not defined” error while executing Protractor test on angular application stored in Liferay

浪尽此生 提交于 2019-12-19 07:21:59
问题 i'm running on a Ubuntu 14.04 virtual-host and i'm trying to create some E2E tests with PROTRACTOR for and Application hosted in "Liferay". For the login section (that doesn't require angular) the test with protractor are Ok, the page logins and navigates correctly, but when i try to open a "drop-down" menu on the angularjs based app with the following code: <select class = "form-control menu-select ng-pristine ng-valid" ng-model = "topTitlesData.topFiveDateRange" name = "topFiveDateRange" ng

Protractor wait for isElementPresent and click on waited element fails

陌路散爱 提交于 2019-12-19 06:15:59
问题 I have a issue with my end2end tests. Sometimes they pass without any problem but two thirds of the time they fail. I use protractor with following code: describe('Admin dashboard delete Exports', function () { it('create export', function () { browser.get(e2GUrl + '/admin/studies'); ptor.wait(function() { return ptor.isElementPresent(by.id('export')); }, 5000, 'wait for study list page to be loaded.'); element(by.id('export')).click(); }); HTML (note that this element is visible and not

Protractor wait for isElementPresent and click on waited element fails

橙三吉。 提交于 2019-12-19 06:15:52
问题 I have a issue with my end2end tests. Sometimes they pass without any problem but two thirds of the time they fail. I use protractor with following code: describe('Admin dashboard delete Exports', function () { it('create export', function () { browser.get(e2GUrl + '/admin/studies'); ptor.wait(function() { return ptor.isElementPresent(by.id('export')); }, 5000, 'wait for study list page to be loaded.'); element(by.id('export')).click(); }); HTML (note that this element is visible and not

How to simulate a drag and drop action in protractor in angular2?

丶灬走出姿态 提交于 2019-12-18 05:21:30
问题 I have two divs. var e1 = element(by.id('draggable-0')); var e2 = element(by.id('dropContainer-0')); I want to drop e1 in e2 .i.e. implementing drag & drop in e2e test case for angular2. I tried below code: var e1 = element(by.id('draggable-0')); var e2 = element(by.id('dropContainer-0')); browser.driver.actions().dragAndDrop(e1.getWebElement(),e2.getWebElement()).perform(); browser.sleep(2000); but its not working.My chrome gets opened but nothing happens. any inputs? thanks. 回答1: Your page

How to get the testCafe exit code

馋奶兔 提交于 2019-12-13 13:41:56
问题 I am having an issue running Testcafe through cucumber. for whatever reason, When I run testCafe through cucumber, the process will always exit with exit code 0 even in the test fails. If I run puppeteer through cucumber I don't get this issue. I am thinking that this behavior is due to the way I have things set up in my hooks file where I am not properly interpreting the test cafe exit code. In my hooks file, I am creating a testCafe runner and in my Before hook and then closing it during my

How to pass userDataDir profile folder to Puppeteer

情到浓时终转凉″ 提交于 2019-12-13 00:02:18
问题 I want to pass a custom profile to Puppeteer. To start I've tried to pass my real Google Chrome profile: const browser = await puppeteer.launch({ userDataDir: '/Users/[USERNAME]/Library/Application Support/Google/Chrome/Default', headless: false, slowMo: 250, ... } but when the browser opens if I go to Settings it shows Person 1 rather than the data from my Google Chrome profile The userDataDir path above is what is shown in Profile Path when on Google Chrome I visit chrome://version (where

Async setup of environment with Jest

倖福魔咒の 提交于 2019-12-12 10:57:53
问题 Before running e2e tests in Jest I need to get an authentication token from the server. Is it possible to do this globally one and set it somehow to the global environment / context for each test ? I tried it with globalSetup config option: const auth = require('./src/auth') const ctx = require('./src/context') module.exports = () => { return new Promise(res => { auth.getToken() .then(token => { ctx.init({token}) global.token = token res() }) }) } context.js let _token const init = ({token})