e2e-testing

TestCafe docker - Run tests against app running on hosts localhost

自古美人都是妖i 提交于 2021-01-28 07:38:55
问题 I have a local dev server running on Mac OS on localhost:3000 I want to be able to run testcafe tests in the docker container, pointing to the app running on the Mac host. Test code: fixture('<Page>') .page(`localhost:3000/page-test`) I've tried docker run --network="host" which should make Mac's localhost accessible, but no success. Have also read, host.docker.internal or docker.for.mac.localhost can be used inside the container, but there is no way for me to access, modify the image

How to write xpath with contains ID using TestCafé?

一个人想着一个人 提交于 2021-01-28 03:09:55
问题 Need to take the dynamic ID using "contains" keyword in TestCafé selector. html: <div id="content-body-14269002-17290547"> xpath: //div[contains(@id,"content-body")] I would like to write above xpath in TestCafé Selector Is it possible to do? 回答1: I believe this is not supported. See here. A good workaround I can recommend to handle such cases is to use xpath-to-css package. Also, you can just create a CSS selector for this case, CSS Selector for partial id match will be: div[id*='content

Download file - Save popup in Internet Explorer using TestCafe

廉价感情. 提交于 2021-01-28 02:55:41
问题 In Internet Explorer, whenever a download file window is asking for three options 1. Open 2. Save 3. Close Due to company policy, can't disable popup. However, need to handle same in TestCafe automation. What to click save/save as option? Request for a solution. 回答1: There is no way to overcome this issue, except for disabling the popup in settings. As a workaround, I can suggest you use the requestHooks feature to download the file. Please try the following example in IE: import fs from 'fs'

Keep browser open while developing a test in Testcafe

南笙酒味 提交于 2021-01-27 20:00:39
问题 How to keep the browser window open after a test executes in Testcafe? There was a question on the forum here that brought me to a live Testcafe version, but it seems to be deprecated. I wish to keep the browser window open to see the elements while I'm developing the test. Update: This is my config file: { "name": "testcafe-demo", "version": "1.0.0", "description": "", "main": "index.js", "dependencies": { "testcafe": "^1.8.2" }, "devDependencies": {}, "scripts": { "test": "testcafe chrome

How can I inject parameters into a TestCafé test?

徘徊边缘 提交于 2021-01-27 17:55:44
问题 Scenario: I run TestCafé wrapped in code, using the API I have a test I want to parameterize, testing with different dynamic values. Problem Testcafé has no support for sending parameters to a test. Is there a way to inject values? 回答1: You can use process.env to pass parameters to TestCafe tests from your runner script. //test.js const createTestCafe = require('testcafe'); (async => { process.env.foo = 'bar'; const testcafe = await createTestCafe(); await testcafe .createRunner() .src('test

How do I pass variable data between tests

浪子不回头ぞ 提交于 2021-01-27 13:21:31
问题 I am trying to do something similar to this post on TestCafe I am generating a random email in my helper.js file. I would like to use this random email to log in the test.js file. This is how I am creating my email in the helper.js var randomemail = 'test+' + Math.floor(Math.random() * 10000) + '@gmail.com' This is how I want to use it in my test.js file .typeText(page.emailInput, randomemail) I have tried several things without luck. How could I go about using the generated email in my test

Element is not clickable at point in headless mode. But when we remove headless from protractor.conf.js it is working fine.

让人想犯罪 __ 提交于 2021-01-27 12:13:00
问题 element(by.className('cuppa-dropdown')).element(by.className('dropdown-list')).element(by.className('list-area')).element(by.tagName('li')).click(); actually this element is in pop up. ANd it is woring fine in headless mode. But as we need to automate the test cases by build in vsts we need to execute test in headless mode Failed: unknown error: Element is not clickable at point (863, 343) (Session info: headless chrome=63.0.3239.84) (Driver info: chromedriver=2.34.522940

Is it possible to use the TestCafe .meta object to skip tests running from the cli

ぃ、小莉子 提交于 2021-01-27 12:11:55
问题 I'm using TestCafe to run my integration tests. I know it has the test.skip function, which is great for when I'm testing locally and want to skip a set of tests I don't need/want to run... but I was wondering if there was a way to run ALL TESTS except --test-meta environmentSpecific=true etc? We have a number of different environments, and I'm looking for a simple way to skip tests via the CLI, depending on the environment we're targeting for the build. 回答1: Yes, you can do it using the

Run testcafe headless when passing custom args to Chrome binary via testcafe-browser-tools

强颜欢笑 提交于 2021-01-27 12:10:25
问题 Running testcafe inside a Vagrant VM, which is mostly working. However, Chrome doesn't start properly in this environment with hardware acceleration enabled, so I have to start it with the command line flag --disable-gpu . I'm leveraging the 'testcafe-browser-tools' package to accomplish this, by overriding the default browser command via the Runner class in the TestCafe API. This all works fine for the case of running TestCafe with it opening a browser window, but I've not been able to

How to get the json response of a RequestLogger

China☆狼群 提交于 2021-01-27 06:10:50
问题 RequestLogger A have this test outside the main test controller, using page model and this recipe. /** Used to get the periodic analytic id. Whenever we are viewing an asset, the server must respond with an id. This id is later used by the client, to send periodic analytics. @param {object} t Testcafe's test controller @param {object} logger A testcafe's RequestLogger. @returns {string} Returns the periodic analytic id. */ async getPeriodicAnalyticId(t, logger) { const logPrefix = 'Get