Skip to content
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

Merged
merged 3 commits into from Jan 18, 2017

Conversation

VasilyStrelyaev
Copy link
Collaborator

\cc @DevExpress/testcafe-docs

Copy link
Collaborator

@kirovboris kirovboris left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lgtm

@testcafe-build-bot
Copy link
Collaborator

✅ Tests for the commit 4421ec5 have passed. See details.

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).
Copy link
Contributor

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?

Copy link
Collaborator Author

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.

Copy link
Collaborator

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?

Copy link
Collaborator

@helen-dikareva helen-dikareva left a 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...');
Copy link
Collaborator

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).
Copy link
Collaborator

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?

@testcafe-build-bot
Copy link
Collaborator

✅ Tests for the commit 68892f9 have passed. See details.

Copy link
Collaborator

@helen-dikareva helen-dikareva left a 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
Copy link
Collaborator

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

Copy link
Collaborator

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

@AlexanderMoskovkin AlexanderMoskovkin merged commit cf084db into DevExpress:master Jan 18, 2017
@VasilyStrelyaev VasilyStrelyaev deleted the gh1009-docs branch January 19, 2017 10:16
kirovboris pushed a commit to kirovboris/testcafe-phoenix that referenced this pull request Dec 18, 2019
* [docs] Describe passing Client Functions to assertions

* Fix remarks

* Fix remarks part 2
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

6 participants