e2e-testing

What are some best practices for structuring e2e tests?

房东的猫 提交于 2019-12-10 21:43:40
问题 I'm a bit confused as to the best way to structure end to end tests. Most tests tests that I write depend on other tests. i.e User needs to log in User needs to create Foo User can now create Bar Bar needs to exist, in order to edit it obviously. How would you structure your tests to take this into account? 回答1: I would personally make use of the PageObject pattern, this will allow reliability and make the code more maintainable in these situations. Once you have that in place you can then

Cypress request wait by default?

白昼怎懂夜的黑 提交于 2019-12-10 20:55:00
问题 I need Cypress to wait for any xhr requests to complete by default before performing any operations. Is there any way to make this as a default or any other alternatives because the application I am testing is slow and makes a lot of api calls? Edit: By writing a single statement for every api request is getting messy and unnecessary work. Need a way to make this easier. 回答1: Found something that works for me here https://github.com/PinkyJie/cypress-auto-stub-example Look for cy

Selecting elements from DOM

你。 提交于 2019-12-10 18:46:43
问题 On my page contents, I have multiple cards organized as a grid __________________ | ____ ____ | | | | | | | | | | | | | | |____| |____| | | | | ____ ____ | | | | | | | | | | | | | | |____| |____| | |__________________| My issue is that each card container has the same class, and I want to select a distinct element inside a container. Example: <div class="parent-container"> <div class="container"> <h2> Distinct title 1 </h2> </div> <div class="container"> <div class="another-container">

Testcafe how to reload actual page

淺唱寂寞╮ 提交于 2019-12-10 17:53:16
问题 Is there a way to reload the actual tested page I'm visiting in TestCafe and not the site that TestCafe is running under. I've tried using: await t.eval(() => location.reload(true)); but that just reloads the server page that Testcafe uses. So for example, if I test www.google.com, the URL in the browser after I launch TestCafe will be something like http://172.16.0.152:58486/Qf6eMxOvA/https:/www.google.com/ That is the site that reloads when I execute the code above. Is there a way to force

How i can get text from web element and print in console (for example)

社会主义新天地 提交于 2019-12-10 17:47:53
问题 I have a problem with getting a text from elements on a web page. I'm using TestCafe e2e framework and want to print the contents of a text web element to console. Can you provide some code? const getInnerText = ClientFunction(() => homePage.kzLink.innerText); console.log(getInnerText()); what i get: ReExecutablePromise { _then: [], _fn: [Function], _taskPromise: null } 回答1: To execute a client function, call it with the await keyword and a dependency. const getInnerText = ClientFunction(() =

How to wait for an element to disappear in TestCafe?

我的未来我决定 提交于 2019-12-10 17:25:42
问题 When I need to wait for an element to become visible I can simple call the selector as a function like this: await element.with({ visibilityCheck: true })(); But how can I wait for an element to disappear? 回答1: To wait for an element to disappear you can use our built-in waiting mechanism for assertions. Please see the documentation for more information on how it works. import { Selector } from 'testcafe'; fixture `fixture` .page `http://localhost/testcafe/`; test('test 2', async t => { /

Cannot intercept outgoing AJAX request from page using Testcafe

北城余情 提交于 2019-12-10 17:19:11
问题 I am attempting to use TestCafe for a client-side javascript library, and I am unable to capture any outgoing AJAX requests for on the load of a testing page through the counting mechanism. My attempts involve using the RequestLogger object from this library involve setting up the first parameter using the regex /\.org/ , to capture any outgoing tile request which uses the .org suffix. I believe this makes sense, as all the outgoing requests go to openstreetmap.org with the aim of grabbing

E2E: Select an image from a UIImagePickerController with Wix Detox

爱⌒轻易说出口 提交于 2019-12-10 14:42:41
问题 Description I need to write an e2e test that in some point it has to select an image in UIImagePickerController, I tried to use element(by.type('UIImagePickerController')). tapAtPoint() with no use. I need a way to select an image. I have found a way to do it with native tests. Also mocking isn't an option for me since I use a higher version that the one react-native-repackeger needs. Steps to Reproduce Use with any application that uses image picker Try to use element(by.type(

Angular migration (from 4 to 6) e2e --proxy-config not working

大兔子大兔子 提交于 2019-12-10 12:37:56
问题 I've been currently migrating my app from 4 to 6 and I can not executing my proxy script for my e2e tests . The script listing looks as follows: "scripts": { "ng": "ng", "start": "ng serve", "start:tst1": "ng serve --proxy-config config/proxy/proxy.tst1.json", "start:tst5": "ng serve --proxy-config config/proxy/proxy.tst5.json", ... "test:watch": "ng test", "lint": "ng lint --type-check true", "e2e": "ng e2e", "e2e:tst1": "ng e2e --proxy-config config/proxy/proxy.tst1.json", "e2e:tst5": "ng

Protractor starts Firefox but doesn't run any tests

前提是你 提交于 2019-12-10 11:31:47
问题 If I run protractor agains Firefox, Firefox is started and a blank tab is shown. Which is all I get (no specs are executed). After a while I get the following error: WebDriverError: Unable to connect to host 127.0.0.1 on port 7055 after 45000 ms. Firefox console output: "}],"targetPlatforms":[],"seen":true} ... Now, I've also written a script which uses selenium webdriver directly, which works like a charm with FF. So, the problem must be protractor specific I would say! So, here is my