Mochawesome does not generate bulk reports - testing

I installed the Mochawesome results reporting add-on to Cypress. The problem is that every time I finish all the tests, I only have the html file with the last one in the reports folder. Do you know how to make a report from the whole set of tests?
However, only one file is created each time, and it is the last one
and in my cypress.json I have this:
Code and tests in cypress.json:
{
"projectId": "fi4fhz",
"viewportHeight": 1080,
"viewportWidth": 1920,
"testFiles": [
"settings.js",
"test1.js",
"test2.js",
"test3.js",
"test4.js",
"test5.js",
"test6.js",
"test7.js",
"test8.js",
"test9.js",
"test10.js",
],
"env": {
"numTestsKeptInMemory": 0,
"projectUrl": "https://testlocal:6001/",
"settings": {
"SP": {
"tenant": "k.online",
"clientId": "3a15528c",
"clientSecret": ".u4L",
"administrationUrl": ""
}
},
"reporter": "mochawesome",
"reporterOptions": {
"charts": true,
"overwrite": false,
"html": false,
"json": true,
"reportDir": "cypress/report/mochawesome-report"
},

your configuration seems correct, but try to change reportDir to cypress/report and follow this steps:
After running all tests, you should find multiple "mochawesome.json" files, 1 for each spec. To create a single html report, you need one more package.
Install mochawesome-merge package (npm i mochawesome-merge)
Run mochawesome-merge "cypress/report/*.json" > mochawesome.json, this will create a single JSON file that contains all the tests.
Now run the command marge mochawesome.json (marge means MochAwesome Report GEnerator) and the mochawesome-report directory will be created where there will be an html with all your tests. Here you can see an example of my report

Related

How to exclude specific test in wdio.conf.js

I'm successfully excluding a whole feature file from my chrome runs, using the code below, but I have one specific test in a different feature file failing. I want to exclude the one failing scenario rather than the whole file. Is this possible?
capabilities: [
{
os: "Windows",
os_version: "10",
browser: "Chrome",
exclude: [
'features/myfeature.feature',
'my failing scenario',
],
},
],
No, it's not possible to exclude scenarios in that way. Instead, you could use tags to skip a particular scenario, similar to how it's done via the cucumber-boilerplate webdriverio project:
cucumberOpts: {
tagExpression: 'not #Pending',
},
You may add tag to this scenario e.g. #KnownIssue and exclude this tag by config
cucumberOpts:
{
....
tagExpression: "not #KnownIssue"
.....
}

Having trouble packaging node webkit app

I wrote a small app in node webkit, and am having trouble packaging it. My eventual goal is to have a .exe that I can give to other people.
I can run it from the command line with "nodewebkit".
I've tried zipping the files and saving the result as app.nw, but when I try to run that I just get the default node webkit screen. I've read through the docs on rogerwang github, but haven't gotten anywhere because I can't get through that first step.
The app consists of a few files: index.html, main.js, styles.css. It depends on a few node modules as well as jquery. The package.json file is pasted below... any suggestions would be much appreciated.
{
"name": "spl",
"version": "0.0.0",
"description": "",
"keywords": [],
"main": "index.html",
"homepage": "https://github.com/lpappone/spl",
"bugs": "https://github.com/lpappone/spl/issues",
"window": {
"title": "Splitter",
"toolbar": false,
"frame": true,
"width": 800,
"height": 500
},
"author": {
"name": "Lauren Pappone",
"email": "",
"url": "https://github.com/lpappone"
},
"repository": {
"type": "git",
"url": "git://github.com/lpappone/spl.git"
},
"dependencies": {
"fast-csv": "^0.5.3",
"recursive-readdir": "^1.2.0"
},
"devDependencies": {},
"engines": {
"node": ">=0.8.0"
}
}
The directory structure looks like this, and when I inspect the contents of the .nw, it is exactly the same:
You seem to be doing this on a Mac, so I'll cover that. Windows and Linux are slightly more complicated because they don't have App Bundles the way Mac OSX does.
Are you copying your app.nw to the right place? Are you sure you're including everything in app.nw?
Is this what you're doing?:
First you need to create app.nw, which is just a zip file of your entire project. If you go to your project dir (the one containing package.json) you can do this by typing
zip -r ../app.nw .
Now create a copy of node-webkit.app and copy app.nw into node-webkit.app/Contents/Resources/
cp app.nw node-webkit.app/Contents/Resources/
You should be able to run node-webkit.app now and it should run your app. (You might have some issues with security settings and such)
See https://github.com/rogerwang/node-webkit/wiki/How-to-package-and-distribute-your-apps#mac-os-x for further details.

Creating a Sublime Text Grunt Build System for a specific target

I'm new to Grunt (and fairly new to sublime Text), but I've downloaded the excellent grunt build system and it works well every time I save. I'm on Win8 by the way.
The only problem is that it runs all tasks/targets. I have separated my tasks into "dist" and "dev" targets and I would like it to run only the dev tasks when I use it on save.
I'd then like to create a separate build task which I would use when building for production. Is this a sensible strategy?
Anyway, I just need to know how to modify the following build system file to just run tasks with the "dev" target....
{
"cmd": ["grunt", "--no-color"],
"file_regex": "^(..[^:]*):([0-9]+):?([0-9]+)?:? (.*)$",
"working_dir": "${project_path:${folder:${file_path}}}",
"selector": "Gruntfile.js",
"windows":
{
"cmd": ["grunt.cmd", "--no-color"]
},
"variants":
[
{
"name": "Gruntfile",
"cmd": ["grunt", "--no-color"],
"windows":
{
"cmd": ["grunt.cmd", "--no-color"]
}
}
]
}
You first need to create an task that runs all the dev targets:
grunt.registerTask('dev', ['task:dev', 'task2:dev']);
This can be run from the command-line using: grunt dev
As for the Sublime build config, "cmd" is just an array of command-line arguments.
So it would end up like this:
{
"cmd": ["grunt", "dev", "--no-color"],
"file_regex": "^(..[^:]*):([0-9]+):?([0-9]+)?:? (.*)$",
"working_dir": "${project_path:${folder:${file_path}}}",
"selector": "Gruntfile.js",
"windows":
{
"cmd": ["grunt.cmd", "dev", "--no-color"]
},
"variants":
[
{
"name": "Gruntfile",
"cmd": ["grunt", "dev", "--no-color"],
"windows":
{
"cmd": ["grunt.cmd", "dev", "--no-color"]
}
}
]
}
All you need to do is call Grunt by specifying it's complete path. Calling grunt alone fails, even though you have the grunt-cli installed and working from the cmd prompt. Note you need to have the environment variable for nodejs set.
Windows users create your my-project.sublime-builder file and put it in C:\Users\yourname\AppData\Roaming\Sublime Text\Packages\User. Apple/Unix location will be different.
The my-project.sublime-builder file looks like:
{
"cmd": "C:\\Users\\ronni\\AppData\\Roaming\\npm\\grunt.cmd",
"working_dir": "C:\\Users\\ronni\\documents\\my-project"
}

Durandal.js optimizer not working (empty main-built.js)

I'm trying to get Durandal.js optimizer working on my test project, but it seems to generate nothing to main-built.js. I use the following command from node.js command prompt, in durandal/amd folder:
optimizer.exe --verbose true
Result is
Using default base configuration.
Configuring for deploy with almond (custom).
{
"name": "durandal/amd/almond-custom",
"inlineText": true,
"stubModules": [
"durandal/amd/text"
],
"paths": {
"text": "durandal/amd/text"
},
"baseUrl": "C:\\Users\\Tommi Gustafsson\\Documents\\Visual Studio 2012\\Projects\\DurandalTests\\DurandalTest1\\TestApp",
"mainConfigFile": "C:\\Users\\Tommi Gustafsson\\Documents\\Visual Studio 2012\\Projects\\DurandalTests\\DurandalTest1\\TestApp\\main.js",
"include": [
"main-built",
"main",
"bindings/tinymce-binding",
"durandal/app",
"durandal/composition",
"durandal/events",
"durandal/http",
"text!durandal/messageBox.html",
"durandal/messageBox",
"durandal/modalDialog",
"durandal/system",
"durandal/viewEngine",
"durandal/viewLocator",
"durandal/viewModel",
"durandal/viewModelBinder",
"durandal/widget",
"durandal/plugins/router",
"durandal/transitions/entrance",
"raphael-amd/eve.0.3.4",
"raphael-amd/raphael.2.1.0.amd",
"raphael-amd/raphael.2.1.0.core",
"raphael-amd/raphael.2.1.0.svg",
"raphael-amd/raphael.2.1.0.vml",
"viewmodels/flickr",
"viewmodels/modal1",
"viewmodels/myPage",
"viewmodels/shell",
"viewmodels/welcome",
"text!views/detail.html",
"text!views/flickr.html",
"text!views/modal1.html",
"text!views/myPage.html",
"text!views/shell.html",
"text!views/welcome.html"
],
"exclude": [],
"keepBuildDir": true,
"optimize": "uglify2",
"out": "C:\\Users\\Tommi Gustafsson\\Documents\\Visual Studio 2012\\Projects\\DurandalTests\\DurandalTest1\\TestApp\\main-built.js",
"pragmas": {
"build": true
},
"wrap": true,
"insertRequire": [
"main"
]
}
Deleting old output file.
Tracing dependencies for: durandal/amd/almond-custom
Then, when I check main-built.js, it is empty. Can anyone help me what is the problem? I have several AMD modules in the test project, including Raphael.js AMD modules.
My requirejs configuration looks like this:
requirejs.config({
paths: {
'text': 'durandal/amd/text',
'eve': './raphael-amd/eve.0.3.4',
'raphael.core': './raphael-amd/raphael.2.1.0.core',
'raphael.svg': './raphael-amd/raphael.2.1.0.svg',
'raphael.vml': './raphael-amd/raphael.2.1.0.vml',
'raphael': './raphael-amd/raphael.2.1.0.amd',
'tinymce': "../Scripts/tinymce/jquery.tinymce.min"
}
});
In the same amd folder, where optimizer is stored, try running node r.js -o app.build.js. I've seen r.js sometimes choke about some dependencies, which resolves without problem when loading via require.js. For whatever reason the error messages won't show up when using optimizer --verbose. Typically the error message provides enough information to see where this occurs and if you've to update require.contig.paths or a specific define dependency.

Create different versions form one bootstrap file with require.js

I develop an iPad/iPhone App web app. Both share some of the resources. Now I wanna build a bootstrap js that looks like this:
requirejs(['app'], function(app) {
app.start();
});
The app resource should be ipadApp.js or iphoneApp.js. So I create the following build file for the optimizer:
{
"appDir": "../develop",
"baseUrl": "./javascripts",
"dir": "../public",
"modules": [
{
"name": "bootstrap",
"out": "bootstrap-ipad.js",
"override": {
"paths": {
"app": "ipadApp"
}
}
},
{
"name": "bootstrap",
"out": "bootstrap-iphone.js",
"override": {
"paths": {
"app": "iphoneApp"
}
}
}
]
}
But this doesn't seems to work. It works with just one module but not with the same module with different outputs.
The only other solution that came in my mind was 4 build files which seems a bit odd. So is there a solution where i only need one build file?
AFAIK the r.js optimizer can only output a module with a given name once - in your case you are attempting to generate the module named bootstrap twice. The author of require.js, #jrburke made the following comment on a related issue here:
...right now you would need to generate a separate build command for each script being targeted, since the name property would always be "almond.js" for each one.
He also suggests:
...if you wanted just one build file to run, you could create a node program and drive the optimizer multiple times in one script file. This example shows using requirejs as a module and calling requirejs.optimize().
I took a similar approach in one of my projects - I made my build.js file an ERB template and created a Thor task that ran through my modules and ran r.js once for each one. But #jrburke's solution using node.js is cleaner.