testcafe

TestCafé + React JSX error (unexpected Token)

谁说胖子不能爱 提交于 2020-04-17 22:07:05
问题 I am new to test café, and am seeing some errors in my React project. All tests seem to be fine, except whenever it hits JSX code in a helper method, it gives a SyntaxError. SyntaxError: .../_helpers.js: Unexpected token (779:29) 777 | 778 | export const customLegend = (data) => { > 779 | if (isEmpty(data)) return (<div />); SyntaxError: .../_helpers.js: Unexpected token (710:4) 708 | } = props || {}; 709 | return ( > 710 | <div | ^ 711 | transform={`translate(${x},${y})`} I have not found a

How to test leaflet based maps using testcafe?

我们两清 提交于 2020-04-15 03:55:35
问题 We are building a series of tests using TestCafe. How do we test if a point or path in a leaflet control is rendered correctly? To be more specific we are trying to test the lat-lon data of a circle marker in the map. But, we do not have any leaflet map/marker object available in the scope of testcafe scripts. References: Unit testing leaflet maps 回答1: I created a simple example of an assertion for a path element in a leaflet control on the getting started demo page https://leafletjs.com

Continue test case on assert

我只是一个虾纸丫 提交于 2020-04-13 17:17:27
问题 last time i am using testcafe i have realized about function which missing me in this great framework. This function is something like "continue executing the rest of particular test despite of fact that assertions appears" To be more precise, I describe the reason i missing something like such function: Let say you are testing web application like web form where you are entering date for contracts. Such contract forms contains a lot of input boxes, dropdown menu, checkboxes etc. First simple

Testcafe wont recognise React

别来无恙 提交于 2020-03-21 17:59:24
问题 I'm trying to run my first testcafe test but it's proving arduous. testcafe -e chrome client/routes/Lookup/components/testcafe/lookup-test.js SyntaxError: client/routes/Lookup/components/Lookup.js: Unexpected token (60:8) 58 | if (error.status && error.status !== 404) { 59 | return ( > 60 | <NetworkIssues code={error.status} /> | ^ 61 | ); 62 | } 63 | at Object.<anonymous> (client/routes/Lookup/components/testcafe/lookup-test.js:1:1) lookup-test.js import Lookup from '../Lookup'; import React

How to share a global variable between test files from a test in TestCafe?

余生颓废 提交于 2020-02-04 06:36:54
问题 I'm manually setting auth cookies for my login purpose and I would like to share the Auth token across my tests. The very first time I have to perform a login in a test and then I have to save the auth token in a variable and share it across the test files. Here is the code snippet to explain what and how I'm trying to do: loginTest.js : let authToken = null; fixture`Login test` .page(inputData.url) .beforeEach(async (t) => { const nextMonth = new Date(); nextMonth.setMonth(nextMonth.getMonth

The specified glob pattern does not match any file or the default test directories are empty. - testcafe

亡梦爱人 提交于 2020-02-03 13:03:33
问题 I have started learning testcafe, as our organization wanted to invest time on R & D on getting new e2e tools for angular automation. I am trying to create an initial small test and facing the following error. I have installed the testcafe locally using the command npm install --save-dev testcafe and have created a spec file with name first-test.spec.ts import { Selector } from "testcafe"; fixture`Getting Started`.page`http://devexpress.github.io/testcafe/example`; test("My First Test", async

TestCafe: User Role logs out the user in the first test

大城市里の小女人 提交于 2020-01-24 20:38:06
问题 I'm trying to implement User Role in my existing tests as I don't want to login in every tests. Here is what my tests look like: const accountUser = Role('https://localhost:9000', async (t) => { await t.wait(1000); await loginPage.login(inputData.emailId, inputData.password); }, { preserveUrl: true }); fixture`login-test` .meta('testingType', 'regression') .requestHooks(mock) test('Add a person', async (t) => { await t.useRole(accountUser); await loginPage.goToPeopleList(inputData

Customize TestCafe Selector in TypeScript for Shadow root Element

ぐ巨炮叔叔 提交于 2020-01-21 14:38:10
问题 Please help me to define Selector part in TypeScript import { Selector, t } from 'testcafe' fixture `Scenario Name : Validation` .page `https://chrisbateman.github.io/guide-to-web-components/demos/shadow-dom.htm`; const demoPage = Selector('#demo1'); const paragraph = Selector(() => { return demoPageSelector().shadowRoot.querySelectorAll('p'); }, { dependencies: { demoPageSelector: demoPage } }); test('Test ShadowDom', async t => { await t .expect(paragraph.value).eql('Some text'); }); 回答1:

Browser detection using user agent in fixture hooks

旧时模样 提交于 2020-01-15 03:54:07
问题 I have a few tests that only need to be run when in a mobile browser. Currently I have a client function to check the user agent. const checkMobile = ClientFunction(() => /iPhone|Android/i.test(navigator.userAgent)) Which I then access inside my tests: test("Check if mobile", async t => { const isMobile = await checkMobile(); if (isMobile) { await t // do the tests } } Is there a way for me to use this in a fixture? Like a fixture which will only run if checkMobile is true ? So I don't need

TestCafe— Proper way to assert an element is visible

心不动则不痛 提交于 2020-01-03 10:59:08
问题 Based on various forum discussions, the TestCafe documentation, and trying it out to compare results, I am still not certain which is the correct (or best) way to assert that a page element is visible. await t.expect(Selector('#elementId').visible).ok(); vs await t.expect(await Selector('#elementId').visible).ok(); Or are these both incorrect and there is another way that is preferable? How does this compare to asserting that an element exists? Or other properties of the element, such as