nightwatchjs saveScreenshot giving TypeError: The "data" argument must be of type string or an instance of Buffer, TypedArray, or DataView - nightwatch.js

I am working on an automation prototype using Nightwatch js and when I am trying to save screenshot, it is giving below error
Error while running .getScreenshot() protocol action: An unknown
server-side error occurred while processing the command. – An unknown
server-side error occurred while proces...
TEST FAILURE: 1 error during execution; 0 tests failed, 0 passed
(10.032s)
TypeError: The "data" argument must be of type string or an instance
of Buffer, TypedArray, or DataView. Received an instance of Object
at Object.writeFile (fs.js:1487:5)
at FSReqCallback.oncomplete (fs.js:180:23)
FAILED: 1 errors and 1 passed (9.662s)
relevant data for nightwatch.config.js:
test_settings: {
"screenshots": {
"enabled": true, // if you want to keep screenshots
"path": './screenshots' // save screenshots here
},
test file data:
.pause(3000).saveScreenshot('./screnshots/test.png');
Nightwatch version: "1.5.1"
please note that due to office policy cannot paste complete testcase data here.

Related

How do you catch NEAR json RPC Errors

I'm creating accounts using the json rpc for NEAR but when things fail, there isn't really an error that is passed back, so I'm unable to catch anything.
The object with key status is a test, this is returned after the function call has finished, but if there are no errors to catch, I can't tell if anything failed.
How are you catching errors here.
Receipts: 4epNvrYNDK2u4p7K4RKMqbqmoV6WMKjCFtE926uiTQEu, HMnN8FXcJVT4PjQxi5RAmBLLRn2gNaZwgDkNKXX66jj5
Failure [myaccount.mintspace2.testnet]: Error: {"index":0,"kind":{"ExecutionError":"Smart contract panicked: panicked at 'Failed to deserialize input from JSON.: Error(\"missing field `receiver_id`\", line: 1, column: 79)', store/src/core.rs:41:1"}}
{
status: 'success',
}

Error on returning environmental account id's

If I have the following method to test predecessor_account_id behaviour
pub fn get_pred_acc(&self) -> (String {
let prev_acc = env::predecessor_account_id().to_string();
return prev_acc;
}
And try to call this from frontend
const contract = await this.near.loadContract(window.nearConfig.contractName, {
viewMethods: ["get_pred_acc", ],
changeMethods: [],
sender: this.accountId,
});
const acc = await contract.get_pred_acc();
I get the following error:
Uncaught (in promise) Error: Querying call/flux-protocol/get_account_id failed: wasm execution failed with error: FunctionCallError(HostError(ProhibitedInView("predecessor_account_id"))).
{ "error": "wasm execution failed with error: FunctionCallError(HostError(ProhibitedInView(\"predecessor_account_id\")))",
"logs": []
}
That's expected behavior for the view calls.
The view calls don't have certain context information such calls are not part of an actual transaction.
Currently, the best option to see which methods are prohibited in the view calls is to take a look at the test: https://github.com/nearprotocol/nearcore/blob/master/runtime/near-vm-logic/tests/test_view_method.rs#L19-L43
To summarize:
previous account information and keys (signer, predecessor and signer_public_key)
gas information
all promise methods, cause they involve other contracts

Unable to set cookie in page object command

I'm trying to set a cookie in a page object command, but it fails.
Here is the page object command:
setThingTypeCookie: function() {
return this.api.setCookie({
name : "thingType",
value : "I am a thingType ID"
})
.pause(1);
},
When running the test, I receive the following error:
Error while running .setCookieString() protocol action: unable to set cookie
Can someone please point out what I'm doing wrong?
Thanks!
Butch

Changing the "Upload failed" Message

I would like to change the "Upload failed" message to one returned from my server-side processing.
I can see the message I want in the onError callback but I'm not sure how to used that instead of the default message.
Thoughts, examples or further reading advice welcome (new here).
The implementation of what you're trying to do depends on whether you are using Fine Uploader Basic/Core or Regular/UI. This is because UI mode offers some extra goodies for displaying error messages and such.
A few properties/options that may benefit you:
Fine Uploader Basic/Core mode
text.defaultResponseError
Message sent to the onError callback if no specific information about the error can be determined. This is used if the server indicates failure in the response but does not include an “error” property in the response and the error code is 200 (XHR only)
var uploader = new qq.FineUploaderBasic({
/* ... */
text: {
defaultResponseError: "Oh noes! Upload fail."
}
});
The documentation on 'text'
Fine Uploader Regular/UI mode
failedUploadTextDisplay.mode option
Valid values are “default” (display the text defined in failUploadText next to each failed file), “none” (don’t display any text next to a failed file), and “custom” (display error response text from the server next to the failed file or Blob).
failedUploadTextDisplay.responseProperty option
The property from the server response containing the error text to display next to the failed file or Blob. This is ignored unless mode is “custom”.
var uploader = new qq.FineUploader({
/* ... */
text: {
defaultResponseError: "Oh noes! Upload fail."
},
failedUploadTextDisplay: {
mode: 'custom', // Display error responses from the server.
responseProperty: 'errorMsg' // Default is 'error', change this to match the
// property that contains the error message from
// your server
}
});
The documentation on failedUploadTextDisplay
For people who still use FineUploaded and above does not work, that is because the key is not changed to failUpload.
Usage for a custom message on UI end would be
text: {
failUpload: 'Your upload faile message goes here
},
More details can be found here - https://docs.fineuploader.com/branch/master/upgrading-to-4.html
If you want to display the server-side message, you can do it the below way:
failedUploadTextDisplay {
mode: 'custom',
responseProperty: 'server side error key goes here'
}
If you wish to completely remove it, i.e, not show the message below file if file upload has failed, use below
failedUploadTextDisplay {
mode: 'none'
}

Why am I consistently getting these 2 errors in my Google Closure code?

I am using Plovr to compile my javascript with this config file.
// File: config.js
{
"debug": true,
"id": "myfirstapp",
"paths": ".",
"inputs": "main.js",
"level": "VERBOSE",
"mode": "ADVANCED",
"pretty-print": true
}
Strangely, my app works, but I am consistently getting these 2 errors in Chrome Console.
GET http://www.myunreleasedapp.com/deps.js 404 (NOT FOUND) a.js:181
Uncaught TypeError: Cannot read property 'debug' of undefined
I examined the second error and discovered that the property Params.settings is undefined, so calling Params.settings.debug produces this error. However, I am not sure where in my Closure code to resolve either of these two errors. Any advice on what to look out for in my code?
The second error (Uncaught TypeError: Cannot read property 'debug' of undefined
) oddly occurs on this really long line in 58852.user.js:
saveSettings();Extend(that,Params);Params.enabled=
(Registry.getKey("enabled","enabled")=="enabled"?true:false);Params.isPage=
(getFromId("jewelFansTitle")?
true:false);Params.debug=Params.settings.debug;try{Params.iFrame=
(window.top!=self)}catch(exception){new ErrorHandler(exception)}try{if(Params.mobile)
{Params.mobileId=getFromId("m_user_DEPRECATED").value}}catch(exception){new
ErrorHandler(exception)}function trace(){if(!Params.dev)
{return}try{if(!traced[arguments.callee.caller.name]){traced[arguments.callee.caller.name]=0
Again, Params.settings seems to be undefined. This is a Facebook app, so I think this code may be relevant to Facebook.

Resources