Questions tagged [testcafe]

TestCafe and TestCafe Studio - end-to-end testing, simplified. Questions from users of the open-source TestCafe and TestCafe Studio community edition subscribers.

Resources

1850 questions
8
votes
1 answer

How to get the json response of a RequestLogger

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…
8
votes
2 answers

TestCafe-- Proper way to assert an element is visible

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…
Meg
  • 938
  • 9
  • 20
8
votes
1 answer

testcafe how to make the selection of the conditional element

I'm having trouble making the selection of the element that conditionally appears on a page. I've tried awaiting but it didn't work. // Gets imported as detailedProductPage export default class Page { constructor () { this.chipItem0 =…
8
votes
1 answer

How to integrate testcafejs in jenkins with different browsers

Currently, I am doing automation UI tests with testcafejs for React project. I would like to run these tests in continuous integration environments such as Jenkins. I already add browserStack plugin to run them locally with different browsers and…
Jing
  • 145
  • 1
  • 9
7
votes
1 answer

'testcafe' is not recognized as the name of a cmdlet, function, script file, or operable program

I'm trying to run testcafe chrome tests/ -e to execute my test but it throws an error saying "testcafe: The term 'testcafe' is not recognized as the name of a cmdlet, function, script file, or operable program. Check the spelling of the name, or if…
rk2019
  • 73
  • 1
  • 4
7
votes
1 answer

How do I insert a variable into a regex .match() assertion?

I would like to add a variable, 'example', into a regular expression assertion. const example = Selector('xyz'); await t.expect(getLocation()).match(/^https:\/\/int-.*.example.com\/en\/example\/-\/ ** HERE SHOULD BE INSERTED A VARIABLE, 'example'…
Jakub Sip
  • 195
  • 1
  • 10
7
votes
2 answers

How do I mock a Date() in testcafe?

My test includes a step where the date is set based on the current date (using dayjs()). I need to always get the same, pre-defined date. dayjs() calls new Date(), so my approach was to mock the global Date() constructor. I've tried it like…
Kim
  • 73
  • 5
7
votes
2 answers

How to wait for an element to disappear in TestCafe?

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?
7
votes
2 answers

How do i combine Selector with my Utility function?

While writing tests with TestCafe i'm creating utility functions, but there seems to be a problem when using the Selector('') method inside any function. The Selector('') method works fine inside test files and also when importing from another file…
D.Rooij
  • 243
  • 2
  • 12
7
votes
1 answer

TestCafe - How can I run multiple fixtures (one after the other, not concurrent)?

I have multiple fixtures (interaction between a website and a hybrid app) and I would like to have a test suite run (Smoke test, regression test ...) but I'm not sure how to do it. This is how my tests look like: What I want to do is run all tests…
7
votes
3 answers

Vue: How do you add E2E tests after not including them in initial webpack template?

To start my project, I ran vue init webpack my-project, but I excluded E2E tests. Now I changed my mind and do want to include E2E tests. How can I add them to my project? Note to readers: Tarun Lalwani's answer worked great for me. However you may…
Adam Zerner
  • 17,797
  • 15
  • 90
  • 156
7
votes
1 answer

Debugging UI Tests written with Testcafe

UPDATE: Regarding to another(hammerhead) bug we were forced to use minified code in testcafe test. Since this bug is resolved we're now able to run the tests against non minified code. But still, we have the problem that source maps get removed by…
C.d.
  • 9,932
  • 6
  • 41
  • 51
6
votes
1 answer

How do I prevent Testcafe interacts with the target element even if overlapped by another element?

Description: The bug has been introduced preventing the customer to click on an element that he was would be supposed to click How? Steps explanation: Here is what happens on our payment page application after implementing the Dialog HTML tag in our…
6
votes
2 answers

Testcafe can see button but not click on it

In a testcafe test how can I click on an element that is clearly clickable (with t.debug() I'm able to click on the element) and visible without using ClientFunction, or t.eval -- these "workarounds" recommended in testcafe's github issues do not…
sjt003
  • 2,407
  • 5
  • 24
  • 39
6
votes
1 answer

Does TestCafe have a way of setting the default browser window size?

Reading the CLI Docs, there doesn't appear to be a way to set the default browser window size. Is there a way to do this so that each test or each test fixture doesn't have to? I should point out that adding a resizeWindow call in each test, or…
icfantv
  • 4,523
  • 7
  • 36
  • 53