Not getting SKIPPED test-cases in cucumber html report - cucumber

I'm using "cucumber-html-reporter" for my Appium, Pytest-BDD automation. For some reason, I'm not getting skipped test cases in my html report.
Below is my report generation script
var reporter = require('cucumber-html-reporter');
var date = new Date().getTime()
var options = {
theme: 'bootstrap',
jsonFile: __dirname + '/reports/JsonReport.json',
output: __dirname + '/reports/htmlReport/report.html',
reportSuiteAsScenarios: true,
scenarioTimestamp: true,
launchReport: false,
metadata: {
"App Version": "app_version",
"Test Environment": "Local",
"Device": "DeviceName",
"Platform": "DevicePlatform",
"App-Instance-Id" : "appInstanceId"
}
};
reporter.generate(options);
I'm using #skip explicitly to skip the test cases. I want to see those cases in html report. I couldn't find any resource to solve this issue. Any help would be appreciated.
Below is my sample code
#fire #smoke #android #testCoupe
Feature: Fire Screen
Verifying Fire Screen Functionality
#skip
Scenario: Tapping on an news article under fire card
When Scroll to "SPOTLIGHT_FIRE_CARD" CARD
And The user has clicked on the "SPOTLIGHT_FIRE_CARD" button
Then The user can view "FIRE_STORY_ARTICLE" by clicking "FIRE_STORY_TITLE" in "FIRE_CENTER_SCREEN"
After automation run, I can't see any skip test cases, I can only see passed or failed test case.
My execution script
python3 -m pytest --disable-pytest-warnings -vv --gherkin-terminal-reporter --cucumberjson=$REPORT_PATH -k "fireTest" -s

Related

Playwright - JS - cucumber-html-report: Is there a way to display the Metadata and Scenarios without clicking the report?

I'm facing the next situation:
After the npm run report, The report is generated, but the metadata comes collapsed by default (The same with the Features and Scenarios)
Is there a way to show this expanded instead of collapsed by default?
And another question: Is it possible to generate this same report (expanded) in PDF?
I already tried with npx playwright pdf reports/cucumber_report.html report.pdf, but the report comes with the Metadata, Features and Scenarios collapsed (Impossible to expand in the same PDF )
This is my reporter file:
reporter.js
const reporter = require('cucumber-html-reporter')
// These options will be used at the time of HTML Report generation
const options = {
theme: 'bootstrap',
jsonFile: 'cucumber_report.json',
output: 'reports/cucumber_report.html',
reportSuiteAsScenario: true,
scenarioTimestamp: true,
launchReport: false,
metadata: {
'App Version': '1.0.0',
'Test Environment': 'TEST',
Browser: 'Chrome 107.0.5304.18',
Platform: 'MacOS Monterey - Version: 12.6',
},
}
reporter.generate(options)

Chrome DevTools Protocol: control new tabs

Need to be done: I need to simulate user interactions (journeys) across a chain of sites.
Question: Do you have any tips how to programatically controll a tab opened as a result of a simulated click?
My experience:
I'm using the chrome-remote-interface npm package.
I'm able to simulate a click with a custom ChromeController class which initializes the chrome-remote-interface and these methods:
async simulateClick(selector) {
return await this.evaluate(function (selector) {
document.querySelector(selector).click()
}, selector);
}
/**
* Shamelessly stolen from simple-headless-browser
*/
async evaluate (fn, ...args) {
const exp = args && args.length > 0 ? `(${String(fn)}).apply(null, ${JSON.stringify(args)})` : `(${String(fn)}).apply(null)`
const result = await this.client.Runtime.evaluate({
expression: exp,
returnByValue: true
})
return result
}
Now I would like to interact with the recently opened tab. I can get the targetId of the new tab with the experimenetal Target Domain (prototyping in node cli):
var targets;
chromeController.client.Target.getTargets().then(t => targets = t);
Which results in:
{ targetInfos:
[ { targetId: '97556479-cdb6-415c-97a1-6efa4e00b281',
type: 'page',
title: 'xxx/preview/239402/',
url: 'xxx/preview/239402/' },
{ targetId: 'bbfe11d5-8e4a-4879-9081-10bb7234209c',
type: 'page',
title: 'Document',
url: 'xxx/preview/239402/teaser/0/' } ] }
I am able to switch between the tabs with:
chromeController.client.Target.activateTarget({targetId:'xxx'})
However I'm not able to get any interaction with this, I can't find the connection, how to load it into the Page and Runtime objects.
I've searched in the docs and also tried googling: 'site:chromedevtools.github.io targetId' which only lead me to
> chromeController.client.Browser.getWindowForTarget({targetId: '97556479-cdb6-415c-97a1-6efa4e00b281'}).catch(e => console.log(e.message));
Promise { <pending> }
> 'Browser.getWindowForTarget' wasn't found
I've also tried to Target.setDiscoverTargets({discover: true}) and to close the original tab.
Thanks for any help!
Recently faced this same issue and in short I had to create a new dev tools protocol client for each new target I wanted control over.
My experience is with dev tools protocol using direct communication with websocket but the api is the same so it should be similar. So here is a summary of what I had to do.
Initially looking at the docs I would have assumed Target.attachToTarget should give us control of the new tab but I found that it didn't work.
My workaround was to create a listener that listened for the Target.targetCreated event which provides a targetInfos just like you found with Target.getTargets but for every new target created like a new tab, page, or iframe. Note: you need to enable Target.setDiscoverTargets in order to receive these events over the protocol.
[ { targetId: '97556479-cdb6-415c-97a1-6efa4e00b281',
type: 'page',
title: 'xxx/preview/239402/',
url: 'xxx/preview/239402/' },
{ targetId: 'bbfe11d5-8e4a-4879-9081-10bb7234209c',
type: 'page',
title: 'Document',
url: 'xxx/preview/239402/teaser/0/' } ] }
With that listener I looked for targets that were of type page, you could filter on a specific url if you know what the page will be. With the targetId in hand I requested available websocket targets following the HTTPEndpoints section near the bottom of the devtools home page.
GET /json or /json/list
A list of all available websocket targets.
[ {
"description": "",
"devtoolsFrontendUrl": "/devtools/inspector.html?ws=localhost:9222/devtools/page/DAB7FB6187B554E10B0BD18821265734",
"id": "DAB7FB6187B554E10B0BD18821265734",
"title": "Yahoo",
"type": "page",
"url": "https://www.yahoo.com/",
"webSocketDebuggerUrl": "ws://localhost:9222/devtools/page/DAB7FB6187B554E10B0BD18821265734"
} ]
I could then launch a new dev tools protocol client using the webSocketDebuggerUrl and have full control over the tab.
I know this is a pretty round about way but, its the only way I was able to make if work.
Although these days it's probably easier to use something like puppeteer to interface with multiple tabs in chrome if you can. Here is the source code to a puppeteer module that follows new tabs that could be good reference for trying to replicate it pageVideoStreamCollector.ts
This is a very late answer but just putting this here if anyone else has the same issue as help on chrome dev tools is very hard to come by. Hope it helps someone out.
I also am getting "Browser.getWindowForTarget wasn't found" on debian, google-chrome-unstable version 61

FineUploaderBasic for Azure nothing shows up

var uploader = new qq.azure.FineUploaderBasic({
debug: true,
element: document.getElementById("fine-uploader-gallery"),
signature: {
endpoint: '#Url.Action("GetUploadSASUrl", "Upload")'
},
uploadSuccess: {
endpoint: '#Url.Action("ProcessImage", "Upload")'
},
scaling: {
sendOriginal: false,
sizes: [
{ name: "", maxSize: 800 }
]
},
validation: {
allowedExtensions: ['jpeg', 'jpg', 'png']
}
});
</script>
Trying to create a FineUploader Basic instance for Azure but nothing shows up. What am I doing wrong?
I've added a debug: true directive but nothing shows up in the console. The initial script tag is there and a div with the id of "fine-uploader-gallery" is there. All the scripts and CSS are on the page.
Why would you expect something to "show up"? You are using Fine Uploader's "core" mode, which assumes you are providing the entire UI yourself and simply making use of the API, options, and events to drive it. If you want to render a default but customizable UI, you should use UI mode instead. More information about all of these can be found on the docs site at http://docs.fineuploader.com. Before you go any further, you should spend some time familiarizing yourself with these options.

Modifying Response Headers in Chrome [duplicate]

In my chrome extension I need to add a line to header of every site browsed. In background.js file I add such code:
var responseListener = function(details){
var rule = {
"name": "Access-Control-Allow-Origin",
"value": "*"
};
details.responseHeaders.push(rule);
return {responseHeaders: details.responseHeaders};
};
chrome.webRequest.onHeadersReceived.addListener(responseListener,
{urls: [ "*://*/*" ] },
["blocking", "responseHeaders"]);
While debugging the handler is called and newly added header successfully passes any filters I have found upper in the stack. But it is not seen on network tab's Response headers section and does not effects any code. I use these permissions:
"tabs","<all_urls>", "http://*/*" ,"webRequest","webRequestBlocking", "webNavigation"
Is there a new policy or API changed which disallow to do such things or there is some bug in my 10 lines of a code?
The Network tab of the Chrome Developer tools does not show the modifications from extensions. See https://crbug.com/258064
If you wish to see whether your extension has successfully modified a request, visit chrome://net-internals/#events, click on a request of type URL_REQUEST and look for URL_REQUEST_DELEGATE entries, e.g. URL_REQUEST_FAKE_RESPONSE_HEADERS_CREATED (this is an example of a log entry generated via the chrome.declarativeWebRequest API) or "delegate_info = "extension [extension name]" (generated by chrome.webRequest).

Gradle: how to get user input

I'm currently using the Gradle Plugin for Eclipse (STS). I'm trying to get some user input to configure a task. With the daemon, there are problems to read user input. So, I tried to use a Groovy Pop up.
I've got one task which is call to build and show the pop up.
task getUserInfo << {
def sb = new SwingBuilder()
sb.frame(title: 'Info',
location: [400, 50],
pack: true,
show: true,
defaultCloseOperation: JFrame.EXIT_ON_CLOSE) {
gridLayout(columns: 2, rows: 4)
label('First name:')
textField(id: 'firstName')
label('Last name:')
textField(id: 'lastName')
button(text: 'Enter', actionPerformed: {
myGlobalVariable = "info: ${firstName.text} ${lastName.text}"
}
Also, I create another task:
task deploy(dependsOn: getUserInput) { doLast {...} }. In this task, I try to read the global variable containing the result of the user input.
But the problem is that Gradle continue to the deploy task without waiting for my input.
How can I fix that to read user input before doing other tasks?
Thanks for any help.
It's really a Swing question, namely how to create a modal dialog. Getting the User's Input from a Dialog has an example.

Resources