This is really beneficial! Coming from a beginner in React though, I am finding it difficult to really utilize the React plugin for TestCafe.
Maybe the website I'm having to test isn't really following React principals, but how do you print properties, state, keys, etc. from React? I want to print stuff to the console, but get this: ReExecutablePromise { _then: [], _fn: [Function], _taskPromise: null }
I'm a software engineer with over 15 years of experience developing web and mobile applications. Follow my blog, and follow me on Pluralsight https://www.pluralsight.com/authors/marques-woodson
I'm a software engineer with over 15 years of experience developing web and mobile applications. Follow my blog, and follow me on Pluralsight https://www.pluralsight.com/authors/marques-woodson
I'm a software engineer with over 15 years of experience developing web and mobile applications. Follow my blog, and follow me on Pluralsight https://www.pluralsight.com/authors/marques-woodson
fixture("A fixture this is").page("http://localhost:3002");test("this is a test",asynct=>{constheader=ReactSelector("Header").withProps({name:"marques"});conststuff=awaitheader.getReact();console.log(stuff);});
outputs:
$ testcafe chrome:headless test.ts
Running tests in:
- HeadlessChrome 74.0.3729 / Mac OS X 10.14.5
A fixture this is
{ state: {}, props: { name: 'marques' }, key: null }
✓ this is a test
I'm a software engineer with over 15 years of experience developing web and mobile applications. Follow my blog, and follow me on Pluralsight https://www.pluralsight.com/authors/marques-woodson
This is really beneficial! Coming from a beginner in React though, I am finding it difficult to really utilize the React plugin for TestCafe.
Maybe the website I'm having to test isn't really following React principals, but how do you print properties, state, keys, etc. from React? I want to print stuff to the console, but get this:
ReExecutablePromise { _then: [], _fn: [Function], _taskPromise: null }
Where are you doing the
console.log
? In the React component, or in your test?no, it is within the TestCafe fixture/test
doubleArrowLeft.getReact()
returns a promise. So try this:That didn't work....
Here's what I tested really quick:
outputs:
Try this out
Awesome, thanks for the help. So, I figured out my issue. I was trying to locate the selector by 'Key', which is NOT a property!
Aaah yea, you'd want to use
withKey
instead ofwithProps
. I'm glad you got it figured out :)