testcafe

How to determine how to compare website navigation text/links to config

一个人想着一个人 提交于 2021-02-11 12:58:03
问题 I'm trying to create a test using TestCafe/JavaScript that will compare a website's top menu text/links to the expected data stored in a config. I have some experience with TestCafe, but am still learning. When I set up the function and call it, I enter the function but not the loop within it, as evidenced by the console.log inside of the FOR loop not being printed to the console. I've been debugging this for a while and cannot figure it out. URL: https://wdwthemeparks.com Config file

How to determine how to compare website navigation text/links to config

别说谁变了你拦得住时间么 提交于 2021-02-11 12:57:59
问题 I'm trying to create a test using TestCafe/JavaScript that will compare a website's top menu text/links to the expected data stored in a config. I have some experience with TestCafe, but am still learning. When I set up the function and call it, I enter the function but not the loop within it, as evidenced by the console.log inside of the FOR loop not being printed to the console. I've been debugging this for a while and cannot figure it out. URL: https://wdwthemeparks.com Config file

How to check downloaded file name?

大城市里の小女人 提交于 2021-02-10 14:21:57
问题 I wrote a test that downloads the export file, but I also need to send this file through email. The problem is that filename is always different and I don't know how to look it up during the test. 回答1: You can retrieve the dynamic downloaded filename from the 'content-disposition' header. import { Selector, RequestLogger } from 'testcafe'; const url = 'https://demos.devexpress.com/ASPxGridViewDemos/Exporting/Exporting.aspx'; const logger = RequestLogger({ url, method: 'post' }, {

Testcafe - How to run code after all the fixtures are run

天涯浪子 提交于 2021-02-10 13:21:21
问题 I want to create a snapshot of the SQL server DB and then restore it after "all the fixtures" are run. I can do it after every fixture through .after hook in a fixture. However, that is causing issues while running tests since the DB may be still in transition after a restore. So I would prefer to do it after all the fixtures. 回答1: I have found a workaround for now. The workaround is: Add dependency for ts-node. I also had to add tsconfig.json with compiler options' lib property set to es2015

Testcafe concurrent load test performance

折月煮酒 提交于 2021-01-29 14:17:08
问题 I am trying to run a load test on my web application with Testcafe, by concurrently running a single test for each "user" in the system. I need to run 1000 instances of the test but ran into a resource problem on the test side - running multiple Testcafe instances is very resource heavy and I was wondering if anyone knows a way to run a batch of Testcafe tests concurrently without the performance overhead? 回答1: As an alternative, you can run TestCafe in an AWS lambda with a headless browser.

TestCafe & chrome:headless : how to force the browser language (locale)

谁说我不能喝 提交于 2021-01-29 03:13:32
问题 I have write a few browser test who run with TestCafe, chrome:headless. The test are launched by commandline, from a server that I don't want to change the default language. My website is multi-language. I want to be change the language of the test, without having to impact the language of the server/computer each time. How can I do that? I launch the tests with this command line: npx testcafe chrome:headless src/scenarios/**/*.test.ts 回答1: It all depends on your "multi-language"

TestCafe visibilityCheck does not wait for element to appear

爱⌒轻易说出口 提交于 2021-01-28 19:50:35
问题 I am trying to get TestCafe to wait for an element to appear in the dom. Currently I am using { visibilityCheck: true } but it does not seem to do anything and the test will time out and be considered a failure. Goals: Go to page Wait for searchIconElement to load Code: fixture`Library /all`.page(page.libraryScreen).beforeEach(async t => { await t.useRole(page.adminUser); }); test('Search Bar', async t => { const searchIcon = Selector('div').withAttribute('class', 'CampaignsPage-fab1'); const

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'