e2e-testing

Testcafe example to assert file download

与世无争的帅哥 提交于 2019-12-24 03:51:10
问题 I want to write a fixture to simulate the export file and make sure a file is downloaded from browser actions. any example? NA 回答1: There's not a fancy way check if the download has finished, TestCafe is somewhat limited in its ability to control the download ability in the browser. import fs from 'fs'; const fileName = 'junk.txt'; const downloadLocation = 'C:\\Wherever\\Downloads\\'; const fileDLUrlBase = 'https://example.com/downloads/'; fixture('download test fixture'); test('download test

In TestCafe is there a way to know if the test passed or failed in after hook?

只愿长相守 提交于 2019-12-23 21:27:52
问题 I am trying to mark tests as pass/failed through a rest API (Zephyr) while my testcafe tests are running. I was wondering if it's possible in the after or afterEach hook to know if the test passed/failed so that I can run some script based on the result. Something like: test(...) .after(async t => { if(testFailed === true) { callApi('my test failed'); } }) 回答1: I see two ways in which to solve your task. First, do not subscribe to the after hook, but create your own reporter or modify the

How to do 'beforeEach' only at Fixture level and not for each test under that fixture

。_饼干妹妹 提交于 2019-12-23 16:26:38
问题 I want to run 'beforeEach' only at the fixture level and not for each test under that fixture fixture `Fixture A for Use Case1` .beforeEach(login) test('A Test 1', async t => { await t --- }); test('A Test 2', async t => { await t --- }); fixture `Fixture B for Use Case2` .beforeEach(login) test('B Test 1', async t => { await t --- }); test('B Test 2', async t => { await t --- }); test('B Test 3', async t => { await t --- }); What Is Happening The login function is being run before every test

Ambient flag is deprecated

落花浮王杯 提交于 2019-12-23 14:58:06
问题 I am trying to install dependency in my app i get err that ambient flag is depreciated and also terminal says to replace it with --global i done it but now terminal says that "Unable to find "node" ("npm") in the registry". I followed this link to make e2e testing http://lathonez.github.io/2016/ionic-2-e2e-testing/ yokeshs-Mac-mini:easycloud yokesh$ sudo typings install express --save --ambient typings ERR! deprecated The "ambient" flag is deprecated. Please use "global" instead yokeshs-Mac

Protractor capture screenshot on failure

痞子三分冷 提交于 2019-12-23 05:42:09
问题 I have written below code in afterEach method to capture screenshot on failure afterEach(function() { var passed = jasmine.getEnv().currentSpec.results().passed(); if (!passed) { browser.takeScreenshot().then(function(png) { //capturing screenshot here }; } }); But while executing getting below error.. Message: Failed: Cannot read property 'results' of undefined Stack: TypeError: Cannot read property 'results' of undefined how to remove above error... 回答1: currentSpec is not going to work

Protractor capture screenshot on failure

余生长醉 提交于 2019-12-23 05:42:09
问题 I have written below code in afterEach method to capture screenshot on failure afterEach(function() { var passed = jasmine.getEnv().currentSpec.results().passed(); if (!passed) { browser.takeScreenshot().then(function(png) { //capturing screenshot here }; } }); But while executing getting below error.. Message: Failed: Cannot read property 'results' of undefined Stack: TypeError: Cannot read property 'results' of undefined how to remove above error... 回答1: currentSpec is not going to work

“setNetworkConditions” in protractor e2e tests says not a function

僤鯓⒐⒋嵵緔 提交于 2019-12-23 04:58:19
问题 I am trying to use the driver.setNetworkConditions({ offline : true }); in my code, but it says that Failed: _protractor.browser.driver.setNetworkConditions is not a function . Here is my code to access it. import { browser } from 'protractor'; describe('disable browser network', () => { "use strict"; let browserA = browsers.a; it('should disable chrome network', () => { browserA.ignoreSynchronization = true; browser.driver.setNetworkConditions({ offline: true }); //..... my other

Viewing outstanding requests

自闭症网瘾萝莉.ら 提交于 2019-12-23 04:18:17
问题 Is there any way to view what requests Protractor are waiting on? I'm trying to debug flaky state testing, but it is hard to tell whether a button didn't trigger a response or if Protractor didn't bother to wait. TL;DR: How can I view the remaining promises on the Protractor control flow? 回答1: The usual approach is to start protractor in a debug mode and put browser.debugger() breakpoint before the problem block of code. See more information at Debugging Protractor Tests. On the other hand,

Protractor failed to start test with firefox

跟風遠走 提交于 2019-12-23 04:02:15
问题 I can not start the test with protractor on firefox version 56.0.1. my protractor version is 5.1.2 exports.config = { allScriptsTimeout: 11000, specs: [ './e2e/**/*.e2e-spec.ts' ], capabilities: { 'browserName': 'firefox' }, directConnect: true, baseUrl: 'http://localhost:4444/', framework: 'jasmine', jasmineNodeOpts: { showColors: true, defaultTimeoutInterval: 30000, print: function() {} }, }; this is the error: [00:02:20] I/launcher - Running 1 instances of WebDriver [00:02:20] I/direct -

Using Data Objects while E2E testing with Protractor

风格不统一 提交于 2019-12-22 14:16:35
问题 So a coworker and I were discussing making a data object for our e2e tests. From my understanding about data objects they are used for decoupling your test suites. For example, my first test suite is to create an account and to test if the fields are valid and the second test suite logins into the account and does its own tests. I am told it is good to use data objects (not a page object) just incase the first test suite fails when making an account. That way we can use the data object in the