cucumber-js: Prevent attachments swamping output - bdd

When working with web applications, in the event of a failed scenario, I sometimes want to record the HTML in my browser's body, along with a few other bits and pieces gathered using javascript to help diagnose what went wrong.
I usually do this by executeScript and grabbing document.body.outerHTML. I then attach the diagnostics using:
await this.attach( JSON.stringify( diagnostics ), "text/plain" );
This works great, but has the unfortunate side effect of dumping the attachment out when running the scenario with default runners (like the progress runner: https://github.com/cucumber/cucumber-js/blob/master/docs/support_files/attachments.md#readme )
How can I attach diagnostics like this (which are primarily for use in continuous pipeline runs) without them swamping my terminal output?

Granted I have not tested this myself but according to the documentation if you provide a path with the output formatter(in your case progress) then the output will be to a file instead of stdout
https://github.com/cucumber/cucumber-js/blob/master/docs/cli.md#formats
See the above docs for more info ^

Without any built-in support (yet) for fine-grained control of attachment output, I'm working around this issue by attaching the output using a custom content type. Anything other than text/plain isn't automatically output.

Related

How do I log to stdout or stderr from an Erlang common test suite?

I'm using common_test and just want to log values to stdout or stderr.
How????
I've tried:
ct:comment
ct:log
io:format
The state of the art seems to be manually combing through html files. But I'm on a server and I don't care about anything except my log line, I only want stdout. And I never want to look at an HTML file when writing tests, so advice on how to avoid that generally would be really helpful.
You should use ct:print or ct:pal (print and log), I'd recommend using the later, though.
(You can always use erlang:display, which is a low-level access to stdout)
Keep in mind that if you use Rebar3 with the default configuration and ct values. ct:print is only shown with --verbose, whereas, ct:pal is only shown if the test fails.

Why is my Dataflow pipeline not showing steps?

When I run the examples I get a pretty picture showing the flow and I can monitor as it executes. With my application it doesn't show the diagram and if I click on "Step" it displays nothing.
Adding screenshot of Job log. No warnings or errors. BTW, I assumed the icon on the log entry with an "i" stands for Info level, but when I change the level from BASIC to ALL many more entries are added and they all have the same icon. That is confusing. Icons should be more clear and should have hover tips, IMO.
I'm on the Dataflow team. I'm sorry that you are encountering this issue.
I believe this is occurring because of the custom step names you're code is using.
From your screenshot of the job logs, it appears that some of these steps have been given names that represent a GCS storage path location.
I noticed this from this message in the logs:
Executing operation "gs://datalake/landing/...."
This fails to render in the monitoring UI and likely hits an assertion because slashes are disallowed characters.
In order to work around this issue would you please try removing the custom step names used in your code. Which seems to be set to gs:// style paths. You could also try specifying names for each step, without using special characters.
Please try running the job again after that change and see if the graph renders properly in the dataflow UI.
I have created a github issue to track this bug and prevent these slash characters from sent in the future in the dataflow SDK code.
Please let me know if you encounter any more issues.

How to log from Javascript Module in Firefox extension

I'm modifying a Firefox extension that has been written by someone else, and I'm not very experienced with Javascript and Firefox, so my question is probably fairly simple.
I have a lot of code in a Javascript Module (.jsm file), and I want to produce some outputs form this module to help with debugging. I can't seem to use javascript alerts (alert("blah");) or log to the javascript console (console.log("blah");) as both of these give errors saying that console or alert cannot be found.
Is there any way to produce this sort of debugging output from code running in a Javascript Module? All I want is simple text output to help with my development/debugging process.
There are two common options:
Use dump(), the output will be printed to OS console (on Windows you need to run Firefox with -console command line option to see it).
Use Component.utils.reportError, the output will be printed to Error Console - use Ctrl-Shift-J to open it.

SAP adapter: disasembler problem "Unexpected end of stream while looking for:..."

Use WCF-SAP binding in WCF-Custom adapter, ReceiveIDOCFormat is set to 'String', in the pipeline component, we wrap and call a flat file disassembler to disassemble the SAP request to XML and process it later. We also have a log compnent which will log the SAP raw message prior to disassembler (the string version) to database (streaming way using CForwardOnlyStream)
Here is the problem, during the UAT testing with SAP, we find occasionally the flat file disassembler is complaining 'Unexpected end of stream while looking for:....', when we inspect the SAP message sent over the wire, we find the SAP request only contains the header (EDI_DC40), with emty content after that. What makes me worry is , when we go into SAP, resubmit the failed message using transaction WE19, disassembler has no problem parsing it.
I am totally lost, can someone please sugguest how to troubleshoot this?
Thanks a million!!
I think probably I found the problem now, SAP guys added a field, what I used to do (which I think is right but it may be the flaw) is, I didn't regenerate the schema, instead, I just manually added the field in Visual Studio and set the field length based on IDOC description.
I regenerated the IDOC using the WCF wizard, it seems it is not as same as added a field in visual studio, I just deployed this schema and hope it will address the problem, I'll post my findings later if it worked

Print from Chrome without the print dialogs? Using Greasemonkey userscript maybe?

We're developing a browser-based warehouse app that needs to print labels and invoices regularly. We want to be able to print to the local printer without clicking through the the usual browser print dialogs. Is this possible? Possibly using a greasemonkey userscript? We don't want to have to setup a whole CUPS printer network and deal with all that, but warehouse pickers having to click through a print dialog 1000 times a day isn't an option.
We're printing PDFs, not sure if that matters. If we could do this another way using HTML5 or something else I'm open to course changes or other ideas here.
You can do if you start your chrome (v18+) with the --kiosk --kiosk-printing switches.
You can see it from this video https://www.youtube.com/watch?v=1ewep-ZT64E
You can put a button on the form you are generating, then using embedded javascript in the pdf itself, cause printing to happen silently.
There are various ways to print a
document without requiring user
interaction. One way is to use the
doc object’s print method and set the
bSilent attribute to true, as shown
in “Printing PDF Documents” on page 79
and in the following example:
this.print({bUI: false, bSilent: true,
bShrinkToFit: true});
http://partners.adobe.com/public/developer/en/acrobat/sdk/AcroJSGuide.pdf
Take a look at the silent printing section under Print Production.
Here's a batch file example I've created based on the answer provided by #russenreaktor:
#echo off
start "Chrome" chrome --kiosk --kiosk-printing --url http://www.google.com
There's no way to do this with only JavaScript.

Resources