New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[docs] Describe passing Client Functions to assertions #1143
[docs] Describe passing Client Functions to assertions #1143
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
lgtm
and optionally other arguments. For example, this is how the deep equality assertion looks like. | ||
TestCafe assertions start with the `expect` method exposed by [test controller](../test-code-structure.html#test-controller). | ||
This method accepts the actual value. You can pass an object, a [Selector's DOM node state property](../selecting-page-elements/selectors.md#define-assertion-actual-value) | ||
or a [client function](../obtaining-data-from-the-client.md). |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe Client Function
instead of client function
since it's our term, but not a regular client function?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We use the name client function
everywhere so far.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You can pass an object, a Selector's DOM node state property or a client function.
It seems like it's list all the possible types of the actual value. And though all is object in javascipt, may be better to rephrase?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
/r-
// Regular assertion will fail immediately, but TestCafe retries to run DOM state | ||
// assertions many times until this assertion pass successfully within the timeout. | ||
// A regular assertion will fail immediately, but TestCafe retries to run DOM state | ||
// assertions many times within the timeout until this assertion passes successfully. | ||
// The default timeout is 3000 ms. | ||
.expect(btn.textContent).contains('Loading...'); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We should add info about query mechanism for client function in https://devexpress.github.io/testcafe/documentation/test-api/assertions/#smart-assertion-query-mechanism section
E.g. in sentence If the TestCafe assertion receives a Selector's DOM node state property as an actual value
and may be in other places.
And https://devexpress.github.io/testcafe/documentation/using-testcafe/command-line-interface.html#--assertion-timeout-ms
and for assertionTimeout
here https://devexpress.github.io/testcafe/documentation/using-testcafe/programming-interface/runner.html#run
and optionally other arguments. For example, this is how the deep equality assertion looks like. | ||
TestCafe assertions start with the `expect` method exposed by [test controller](../test-code-structure.html#test-controller). | ||
This method accepts the actual value. You can pass an object, a [Selector's DOM node state property](../selecting-page-elements/selectors.md#define-assertion-actual-value) | ||
or a [client function](../obtaining-data-from-the-client.md). |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You can pass an object, a Selector's DOM node state property or a client function.
It seems like it's list all the possible types of the actual value. And though all is object in javascipt, may be better to rephrase?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
/r-
@@ -76,6 +76,7 @@ To stabilize such tests, you need to add a timeout that will guarantee that the | |||
Adding such timeouts can increase the test running time because of extra waiting. | |||
|
|||
If the TestCafe assertion receives a [Selector's DOM node state property](../selecting-page-elements/selectors.md#define-assertion-actual-value) | |||
or a [client function](../obtaining-data-from-the-client.md) | |||
as an actual value, TestCafe uses the smart assertion query mechanism: | |||
if an assertion did not pass, the test does not fail immediately. The assertion retries to pass multiple times and | |||
each time it requests the actual property value. The test fails if the assertion could not complete successfully |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
And one other place https://devexpress.github.io/testcafe/documentation/test-api/assertions/#optionstimeout
The amount of time, in milliseconds, allowed for an assertion to pass before the test fails if a selector property was used in assertion.
add please about client function too
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
And https://devexpress.github.io/testcafe/ in Smart Assertions
section :)
Use assertions with Selector's DOM node state properties to enable the Smart Assertion Query Mechanism
* [docs] Describe passing Client Functions to assertions * Fix remarks * Fix remarks part 2
\cc @DevExpress/testcafe-docs