e2e-testing

Breaking out of a Protractor .filter() or .map() loop

核能气质少年 提交于 2020-01-20 08:43:11
问题 I'm using Protractor and cucumber framework; how do I break out of a .filter or .map loop? I do not want to continue to iterate further if I found a match! Page.prototype.getElementByKey = function (key) { var foundElement = null; return someElement.all(by.css('.someClass')).map(function (rawItem, index) { var itemObject = new ItemObjectClass(rawItem); return itemObject.getItemKey().then(function (foundItemKey) { var matched = String(foundItemKey).trim() === String(key).trim(); console.log('

Breaking out of a Protractor .filter() or .map() loop

心已入冬 提交于 2020-01-20 08:42:07
问题 I'm using Protractor and cucumber framework; how do I break out of a .filter or .map loop? I do not want to continue to iterate further if I found a match! Page.prototype.getElementByKey = function (key) { var foundElement = null; return someElement.all(by.css('.someClass')).map(function (rawItem, index) { var itemObject = new ItemObjectClass(rawItem); return itemObject.getItemKey().then(function (foundItemKey) { var matched = String(foundItemKey).trim() === String(key).trim(); console.log('

Browser detection using user agent in fixture hooks

旧时模样 提交于 2020-01-15 03:54:07
问题 I have a few tests that only need to be run when in a mobile browser. Currently I have a client function to check the user agent. const checkMobile = ClientFunction(() => /iPhone|Android/i.test(navigator.userAgent)) Which I then access inside my tests: test("Check if mobile", async t => { const isMobile = await checkMobile(); if (isMobile) { await t // do the tests } } Is there a way for me to use this in a fixture? Like a fixture which will only run if checkMobile is true ? So I don't need

How to use Fake timers with nightwatch.js and sinon.js?

女生的网名这么多〃 提交于 2020-01-13 16:29:15
问题 I'm doing JavaScript e2e test with nightwatch.js, and I want to mock the clock with sinon.js's fake timer http://sinonjs.org/docs/#clock But test stops before finish it, I got the log like below, and doesn't progress anymore. [some test] Test Suite =============================== ✔ Element <body> was visible after 5000 milliseconds. My test code is like below. How can I solve the problem? Thank you. module.exports = { before: function(browser) { clock = sinon.useFakeTimers(new Date(2015, 7,

Is there a programmatic way to change user agent in Cypress.io?

妖精的绣舞 提交于 2020-01-13 09:32:29
问题 I have some ad calls that are only made on mobile devices. In Chrome, I can use Device Mode and simulate a mobile device, and the resulting ad call from the server is correctly tailored to mobile. I'm not sure how Chrome does this, except possibly by sending a different user agent. In the Cypress.io documentation, it says the user agent can be changed in the configuration file (Cypress.json). But, I need to run a test for a desktop viewport and then a mobile viewport with a mobile user agent.

Is there a programmatic way to change user agent in Cypress.io?

妖精的绣舞 提交于 2020-01-13 09:31:06
问题 I have some ad calls that are only made on mobile devices. In Chrome, I can use Device Mode and simulate a mobile device, and the resulting ad call from the server is correctly tailored to mobile. I'm not sure how Chrome does this, except possibly by sending a different user agent. In the Cypress.io documentation, it says the user agent can be changed in the configuration file (Cypress.json). But, I need to run a test for a desktop viewport and then a mobile viewport with a mobile user agent.

Protractor: Unable select input element inside a shadow DOM (Polymer) using by.deepCss('input')

↘锁芯ラ 提交于 2020-01-13 04:31:51
问题 Environment: Angular (v5 Application with Polymer Web Components. Protractor for running e2e tests. Angular CLI: 1.6.4 Node: 6.10.0 Angular: 5.2.0 @angular/cli: 1.6.4 typescript: 2.5.3 Below given is my polymer web component shadow root expanded in chrome. You could see input type = "text" inside this custom element. I am unable to access input element inside custom polymer component using protractor by.deepCss . var polymerFirstName = element(by.className('polyFName')); var inputs =

Protractor Failed: element not interactable

妖精的绣舞 提交于 2020-01-13 02:13:27
问题 I am running an E2E test for an Angular 7.x app. The test runs straight forward on my local machine. But when I push it on the repo (GitLab), then pipeline fails and throws following error: USER PROFILE - Check and change PROFILE - Failed: element not interactable (Session info: chrome=71.0.3578.80) (Driver info: chromedriver=2.45.615279 (12b89733300bd268cff3b78fc76cb8f3a7cc44e5),platform=Linux 4.14.74-coreos x86_64) Test Case: it('USER PROFILE - Check and change PROFILE', () => { page

recording videos of Protractor e2e tests

不想你离开。 提交于 2020-01-12 10:54:08
问题 I use Protractor and gulp to test an angular application. I'm looking for a way to record videos for my Protractor e2e tests so that I can play them back as .mp4 or whatever other forms that can be opened on Windows 10. Has anyone accomplished this? Could you suggest maybe some useful links or code? 回答1: There's an npm package that allows you to record protractor e2e tests using ffmpeg binaries: https://www.npmjs.com/package/protractor-video-reporter It also generates subtitles with each spec

recording videos of Protractor e2e tests

六月ゝ 毕业季﹏ 提交于 2020-01-12 10:53:11
问题 I use Protractor and gulp to test an angular application. I'm looking for a way to record videos for my Protractor e2e tests so that I can play them back as .mp4 or whatever other forms that can be opened on Windows 10. Has anyone accomplished this? Could you suggest maybe some useful links or code? 回答1: There's an npm package that allows you to record protractor e2e tests using ffmpeg binaries: https://www.npmjs.com/package/protractor-video-reporter It also generates subtitles with each spec