testcafe

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

Does testcafe support testing of rest api

谁说胖子不能爱 提交于 2019-12-10 10:39:09
问题 Tests hang in the testcafe browser when you try to test a rest api url directly. I am trying to run a test against my rest API endpoint using request hooks, but when I run the test from the command line, the browser opens the API endpoint and loads it and hangs. The test doesn't pass or fail and hangs. The rest API endpoint just returns a JSON response. const logger = RequestLogger('https://example.com/search/suggestions?search=testkeyword'); fixture `test` .page('https://example.com/search

Is there a way in TestCafe to validate Chrome network calls?

ぐ巨炮叔叔 提交于 2019-12-10 10:28:08
问题 I have a test case where I need to navigate to a webPage and validate the network calls in chrome browser for that page. Ideally, I would take them in a variable and filter them for certain analytics related calls and validate their values. This can be done through chrome capabilities in Selenium. See doc here: http://chromedriver.chromium.org/logging/performance-log but I am trying to do this through testCafe? I came across this documentation: https://devexpress.github.io/testcafe

TestCafe, CircleCI 2.0 & SauceLabs — can't get this combination to work

无人久伴 提交于 2019-12-07 22:53:31
问题 So -- I can, from my laptop do the following: testcafe "saucelabs:Chrome@70.0:Windows 10" tests/settings/users.js This will, connect to SauceLabs, to launch the test (or multiple tests, works either way), to hit back against our development server. (IP's have been whitelisted, it all works). I can also, of course, login to sauce labs, open a "live testing" browser and connect to this environment/login etc. Thus, the "SauceLabs =-> My environment" is fine. If I try to run a build on circleci

How can you interact with the Windows desktop when using TestCafe

痞子三分冷 提交于 2019-12-07 20:54:16
问题 I need to use TestCafe to perform actions within our Electron app, however I also need to perform actions on the Windows desktop (e.g. click taskbar, launch other apps). Since TestCafe can only interact with what is within the browser window, I have attempted to use Appium to essential run TestCafe (calling the commandline from C#) and then performing the Windows desktop actions through WinAppDriver however this feels like a kludge. Are there other methods of arranging this or a framework

TestCafe with Electron: Determine if app is visible on Windows desktop

流过昼夜 提交于 2019-12-07 13:27:31
问题 Our Electron application starts minimized to the Windows tray notification area i.e. not visible on the desktop. If I attempt to get visibility information through methods such as this or as described here, checking the 'visible' property always returns true . For example, the below always returns true whether the app is minimized to the notification area or visible on the desktop: if(await Selector('button', { visibilityCheck: true }).visible) console.log("VISIBLE"); else console.log("NOT

How to log Google Analytics calls in Testcafe?

拈花ヽ惹草 提交于 2019-12-06 14:11:33
问题 I am trying to automatically test tracking code and I am using the RequestLogger from Testcafé. I succeeded to intercept calls to example.com and localhost but not to https://www.google-analytics.com/ . What could be the reason? Expected This test should be green Test code import { RequestLogger } from 'testcafe'; const logger_ga = RequestLogger('https://www.google-analytics.com/'); fixture `localhost` .page('http://localhost:8000') test .requestHooks(logger_ga) ('logs calls to Google