I have a cypress spec.js and I would like to take several screenshots after particular assertion of the whole page several times. I want the screenshot to be available on a folder or in the report.
I have mochawesome and Junit reporter. What is the best screenshot tool I can use?
You can use the cy.screenshot() command to take screenshots in cypress. You can read more about it from here.
After assertion you can do like this:
cy.get('selector').should('have.text', 'some text').screenshot()
You can also directly use the command without chaining into any previous commands like this:
cy.screenshot()
You can also add the screenshot name as well like this:
cy.get('selector')
.should('have.text', 'some text')
.screenshot('name') //will save screenshot with name.png
You can also save the screenshot as per your desired directory as well like this:
cy.get('selector')
.should('have.text', 'some text')
.screenshot('path to folder/name')
Now you can pass the capture options to let cypress know Which parts of the Test Runner to capture. This value is ignored for element screenshot captures.
cy.get('selector')
.should('have.text', 'some text')
.screenshot('name', {capture: 'fullPage'})
viewport - The application under test is captured in the current viewport.
fullPage - The application under test is captured in its entirety from top to bottom.
runner - The entire browser viewport, including the Cypress Command Log, is captured.
Related
I'm working on a flow to take data from a SharePoint list, and add it to a specific point in HTML. I am just saving the outputted HTML file to my OneDrive whilst testing.
I have found that when pasting my HTML code into a compose block, then outputting this, it works fine and I'm left with a normal looking HTML page when opened in a browser.
However, as soon as I add dynamic data in place of certain HTML elements it all seems to go wrong.
Firstly, the outputted HTML file now contains '/n' in place of every line break. I have also noticed that the outputted HTML code has now been changed to an array.
I've attached screenshots of my flow below.
Get Items:
Compose:
Create File:
Create File Peek Code:
Compose Output:
Create Output:
Create Output Raw:
Outputted HTML File:
Are you processing the output from that Compose action?
What you are doing is correct and it would not matter if you are using a single or multiple lines of text.
It seems to me that you are using the output of the compose somewhere else or maybe the file content box in the OneDrive action has an expression?
Please check the following:
The output of the compose should look normally
Make sure your OneDrive's action parameters look like this when you "Peek code" (Click on the action's ellipses). If it looks different, you'll have to track the variable/output you are using or review the expression.
I have replicated what you are doing and it is working fine, see attached images.
Edit mode:
Run:
Compose action
OneDrive action
Created File in OneDrive:
EDIT: Update response to use the result from SharePoint in two different ways.
Use the OneDrive action inside the 'Apply to each' if there is only 1 result, it will run once anyway.
You can omit the 'Apply to each' action using the expression box to set the values in the Compose, this is the syntax you can use.
outputs('Get_items')?['body']?['value']?[rowIndex]?['ColumnName']
In case there are several rows in the result, you'll have to validate which is the one you need.
I'm using Cypress to run a suite of automated tests.
The current version of cypress provides mocha-junit-reporter out of the box, and provides configuration options to pass to the reporter. One of the options is the 'mochaFile'.
I'm using the recommended [hash] tag to output reports across multiple spec files.
this results in a flat mess of files that look like 'results/test-output-abc12345.xml'.
What I want instead is for the test file's relative path and filename to be pass in as the reporter's output file path.
This would give me a structured, feature first view of the output, and in Azure Dev Ops, which aggregates the test output, it would give me correct filenames to detect intermittently failing tests.
Things I've tried that haven't worked:
I've tried to use hooks to modify Cypress's config or set environment variables to try to override the reporterOptions/mochaFile per test at (hopefully) the right time.
I've tried to grab the outputted defaultly-named xml file, and copy it to the correct path+filename given the Cypress.spec.name context, but I can't seem to find the right hook or time to do this.
after and afterEach don't work - I don't think the test report has saved the file yet.
Using a plugin, hooking to some event on test:before:run or test:after:run seem promising, but I'm flying blind since I can't debug into it, so I've been unsucessful in modifying the reporter's output path or copying the file.
I'd love it if someone could show a working example using mocha-junit-reporter, or even a different mocha compatible reporter, if the reporter would play well with Azure Dev Ops, and can help me discover intermittently failing tests.
When i select any class and testmethod as Junit 4 test case, it disapears as soon as i click something else and a default test case comes up that gives me a null exception,for eg: groovy test case/Selenese Test Case. I require the Groovy Library for my test case.
This happens only in Jmeter 2.13, but this unchecking thing does not happen in Jmeter 2.11, but i need to use the Backend Listener that is only in Jmeter 2.13.
Image that shows the selection of the junit testcase
Image that shows that the test selected is rechecked by some default groovy test case/Selenese Test case
Screenshot of jmeter using Nightly Build
I need a solution to this, please help me out. Thank you
It appears you are facing a NPE in a process related to undo/redo feature:
https://github.com/apache/jmeter/blob/v2_13/src/core/org/apache/jmeter/gui/GuiPackage.java#L853
Could you try to remove jmeter-plugins 1.4.0 which is a developer snapshot.
Try without it, and if it works report a bug to jmeter-plugins.org
Then try with jmeter-plugins-1.3.1 which is the stable version, it might work but the bug might also be in it.
I created bug:
- https://bz.apache.org/bugzilla/show_bug.cgi?id=58795
It is now fixed in nightly build so you will have more informations to provide to jmeter-plugins or jmeter.
To use nightly build:
http://jmeter.apache.org/nightly.html
Download the _bin and _lib files
Unpack the archives into the same directory structure
The other archives are not needed to run JMeter.
I am running a bunch of Java/JUnit/Selenium tests via a Jenkins build and it works great. I was wondering, however, how I can spice up the console output with simple things like bold text and that sort of thing.
To be clear, by 'output' I mean the Jenkins console output. My tests write some simple messages for troubleshooting, and also for listing when a test begins and ends. I'd like to use html or similar formatting for some of these messages. Is that possible?
I'm using Maven to run the tests in the build and I see that Maven outputs color and bold text. How can I do that?
I'm hoping to do this without a plugin if possible.
Beside trying to spice up the look of the console line for example using * or =-=---=-=-= or others you can install couple of plugins and experiment with them.
One is called "Ansi color plugin" which brings some coloring in.
here is the link : https://wiki.jenkins-ci.org/display/JENKINS/AnsiColor+Plugin
and the other one is called "Log parse plugin" for formatting the warnings and errors and so on...
here is the link : https://wiki.jenkins-ci.org/display/JENKINS/Log+Parser+Plugin
Enjoy ! :)
Howto set the output in test console? When i run test by default the output is replaced by the summary of the test, and System.outs are lost.
In IDEA 12,13 and 14 (also maybe other versions), there is a button "Hide passed tests" and is pressed by default:
The console output is missing some of the printed strings (the last ones).
When you uncheck the button and click on the test:
Then the output is shown in the console.
I got it! There is an configuration option in bottom run panel, and by default "Track running test" is checked, when I unchecked it the output stays and is no more replaced by summary.
Another possibility is that your logging is maybe configured to be written to a file. If this is the case, you can uncheck the 'Save console output to file' option.
What version of IntelliJ are you using? Normally when running a unit test, you have a Run tab at the bottom of your application and you see appear your test logging (System.outs) in there...
If your test output disappear when the test finish to run (and failing),
Disable "Select First Failed test When Finished" in order to see all prints
In the 2016.x versions, you need to change so that your launch configuration has "Activate Tool Window" unchecked (at the bottom).
It's different for tests that failed and tests that works.
If no test fails you'll have to click the top level of all tests that ran you'll see the output.
If you click on any specific working test they'll be empty, even if they printed something.
If you click on any specific failing test they'll show the output from all previous tests, including the one that failed.