-
Notifications
You must be signed in to change notification settings - Fork 1.4k
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
Fix static assertions / node assertion messages #4307
Comments
Can i work on this issue ? could you please assign me.. |
Sure @ansh7432, go ahead! I'll assign this issue to you once you come up with some solution to this problem. |
okay ! |
how to generate above messages, or assertion condition cause i'm running |
Heyyy @garg3133 i had checked the assertions i understood the problem of defining the error message and customizing the assertions message so can i work on this can you assign this issue to me ? |
I had made changes in the code and modified the assertions how to run the testcase now if its working now or not please guide |
@garg3133 I think we can make changes in the static.js file by writing more detailed messages for assertions Here is the code that i have written can you check and tell if any changes have to be made in this code and also assign the issue to me `const util = require('util'); let last_deferred = null; module.exports = class StaticAssert { static get lastDeferred() { static set lastDeferred(value) { constructor(nightwatchInstance) { static formatValue(value) { static formatMessage(propName, { passed, negate, actual, expected }) {
} createStaticAssertion(commandName, abortOnFailure, apiToReturn) {
} loadStaticAssertions(parent = null) {
} |
@garg3133 I think the approach to this solution would be to Enhance the Assertion Messages Example change ok(value, message = 'Testing the value to be truthy') {
this.assert(
value,
message,
`Expected value to be a truthy value, but got ${value}`,
`Expected value not to be a truthy value`
);
} Also we need to ensure that the interface NightwatchNodeAssertions<ReturnType> {
ok(value: any, message?: string): ReturnType;
notOk(value: any, message?: string): ReturnType;
} Is this approach correct or are there any other things that needs to be taken into consideration? |
assert(propName) { by changing the assertion code to this and others methods we can solve this @garg3133 |
@garg3133 If this approach is all right I would like to carry my work on with this issue. |
heyy @garg3133 should i start working on this issue.. just a friendly reminder... |
Description of the bug/issue
The pass/fail messages emitted by the node assertions (referred to as static assertions in Nigtwatch) are not ideal and should be fixed.
This is essential to get the correct assertion messages in the new Element API assertions.
Let's take the example of
.ok()
assertion:await browser.assert.ok(true)
-- seems okayish but could be improvedawait browser.assert.ok(false)
-- needs to be improved. Instead of the whole block inside()
, something simple could be used like: "Testing the value to be truthy". Also, instead ofexpected "true"
, this could beexpected "a truthy value"
.await browser.assert.not.ok(false)
-- needs to be improved. Instead of the whole block inside()
, something simple could be used like: "Testing the value to be not truthy".browser.assert.not.ok(true)
-- MOST IMPORTANT - the message should show the correct expected and actual values instead of "null".Additional information
The code for the static assertions is present in
lib/_loaders/static.js
file.All available Node Assertions in Nightwatch can be found here:
nightwatch/types/assertions.d.ts
Line 544 in 8f4a330
The text was updated successfully, but these errors were encountered: