WebStorm not able to change default mocha reporter - webstorm

I am passing in --reporter Mochawesome in 'Edit Configuration'.
But WebStorm console shows both the reporters.
--reporter mochawesome as well as
--reporter /Applications/WebStorm.app/Contents/plugins/NodeJS/js/mocha-intellij/lib/mochaIntellijReporter.js
No mochawesome report is created.
How to generate Mochawesome reports using WebStorm?

WebStorm uses its own reporter to represent test results as a tree view with filters/navigation etc. So you can't use other reporters when using Mocha integration. If you prefer getting output produced by other reporters instead, you have to run Mocha with Node.js run configuration

Related

Postman - Runner - How to View Exported Results - Fail to import collection run

I have run my Collection.
I have Exported results "***API.postman_test_run.json" file using Export Results option into my local folder:
I closed the Runner tab (Run Summary) on Postman.
And then I tried to open (to Import) this json file somewhere in Postman in order to view these results again and I do not see how I can do that.
My question is - how I can view exported results in Postman?
Is it possible at all or I need to open results in some other application like Visual Studio Code?
Here is an update: I have found the icon Runner in the right bottom part of my Postman desktop.
I clicked on it and got an interface to import the previous collection runs:
However, when I click on button Import I am getting an error: Failed to import collection run.
What could be the reason of it?
Open Postman
Click Import, click Choose Files and specify "***API.postman_test_run.json" from your pc.
-An import success message appears for each collection imported
-Click the Eye icon to setup an Environment
Click Add
-Enter an Environment name. for example, FTAPI
-Copy your API Key from the email sent to you in the previous step
-Enter a Key and a Value
-Click Add
I have written to the Postman Support and got an answer that this issue that I noticed of getting an error on importing of the run results (postman_test_run.json) is the one which exists on Postman. They are working on it now.

EmberJS: `ember serve --environment=test` renders blank page

My team is moving to use Cypress for integration testing rather than Embers Acceptance tests. Before, we would just run ember test which set the environment to "test". Now, I don't want to run embers testing suite but I still want the "test" version of our app. So I want to be able to run ember serve --environment=test. However, I noticed that when I did this, I just get a blank screen. The weirdest thing is that when I change it to ember serve --environment=haha (haha being a random environment name that never existed before), I start seeing the app hit my routes like I would expect. I start actually getting application errors in code we wrote in the source, whereas with the test environment, I couldn't even hit a console.log in the application route.
I want to be able to serve my app with the test environment because we're using it for testing. Is this possible? I'm specifically wondering if there's a bunch of magic under the hood with that environment that makes this impossible or if it's just something else I need to do that I'm missing.
I'm not sure what side effects this would have, but you can get your app running with ember serve --environment=test if you comment out two lines in your config/environment.js file:
if (environment === 'test') {
// ENV.APP.rootElement = '#ember-testing'
// ENV.APP.autoboot = false
}

Generate HTML Report after running django unit testing testcases

I am newbie to djnago and python, I want to generate the report of testcases run by djnago and send in mail to team.
Please help me
Django coverage package make a html file.
If you have multiple settings for your project you should run tests for each setting then combine result with (coverage combine) command then you can get a html file and attach the file in email even you can render result like django html templates.
With python subproccess you can run shell command in django.

Adding React inside a Django project

I am a Django developer just getting started with adding React to one page of my app, and really enjoying it so far. (It's a normal Django app with a home page, an about page, etc, but also a "chart" page with an interactive chart, and I want to build the interactive part in React.)
The problem is that I've started with the downloadable React starter kit and I'm not sure how to do things the 'right' way, and it's complicated by using Django to serve my project (all the tutorials seem to assume you're using node, which I'm not).
Right now I just have this in my Django template:
<div id="myapp"></div>
<script src="/static/js/vendor/react.js"></script>
<script src="/static/js/vendor/JSXTransform.js"></script>
<script src="/static/js/myapp.js"></script>
And myapp.js has all the React code. I'm aware this isn't really the grown-up modern JS way of doing things.
Now I want to use React Bootstrap, but it seems that the only sensible way to do that is with npm. So it's time to make the switch, but I'm not completely sure how.
I have run npm install react and npm install react-bootstrap from inside my static/js directory in Django. This has created a node_modules folder with various files inside.
So three questions from a confused newbie:
Where should I put my React code to work with these npm modules (should I use var React = require('react')?
Do I need to compile this code somehow (using webpack?)
How do I then integrate this with Django? Should I compile it all to myapp.js and just include that in my HTML template?
I'm also doing the same thing right now - moving away from embedded HTML script tags into require land. Here is the tutorial I am following, and here is my file system so far. I am doing it in Node but it shouldn't be that different for a Django project as the React frontend code is decoupled from any backend other than API URL's.
Your node_modules folder contains react-bootstrap. In your myapp.js, use the require('react-bootstrap') to load up the library which is contained in your node_modules folder.
Where should I put my React code to work with these npm modules (should I use var React = require('react')?
You can put the code anywhere. If your file system looks like this:
project/
react/
myapp.js
node_modules/
react source code
react bootstrap stuff
Then you can just do var React = require('react'); in myapp.js.
Do I need to compile this code somehow (using webpack?)
Yes, I would consult the webpack tutorial I linked earlier, it should explain how to compile all your React code into a single bundle.js. Here is also another good tutorial. This bundle.js file contains all the source code of your requires. So if your myapp.js looks something like
var React = require('react');
var ReactBootstrap = require('react-bootstrap');
then the bundle.js now contains all of the React and react-bootstrap javascript code, along with the myapp.js source code.
How do I then integrate this with Django? Should I compile it all to myapp.js and just include that in my HTML template?
I've only done work on Nodejs, but my React code so far hasn't touched any Node code, and I don't think it will touch any Django code (again I've never done Django so I might be wrong). All you need to do is compile with webpack, which spits out a bundle.js. You put that bundle.js in your HTML and it'll load up myapp.js.
ReactJS code is still JS code. Even though you do require/import/other module based syntax when coding, in browser you will still load the JS code by a script tag.
The problem is how to let the script generated by webpack(bundle.js) to work with other 'VanillaJS' script. For example, if you only write an individual component using React, like a small table. And its data(props/state) will depend on another element/event written in VanillaJS, e.g, a click listener on a button render by django template. Then the question is, how they communicate with each other.
So far, the solution I know is:
when you write React Code, instead of calling ReactDOM.render explicitly with preset props/state, you can store that in a global function, the arguments could be the props. You load this script first, then the other script can use this global function to trigger the React render Component.
I'm using Django Rest Framework to build an API and then connect to that API from React (using simple Create react app), this way the front end and back end are separated and the application is very scalable. The second way to do this, is call create react app then run build and point your django settings to that react build, this way the front end is not separated from the backend. I hope this helped, good luck.

How to perform integration test of a backbone app

I want to perform integration testing i.e. automated testing for my backbone app using Selenium and Mocha but the problem I am encountering is that the selenium's webdriver looks for the html elements in the source code of the page, but in my app I am rendering the page using the views so there is no information of the elements in the source code of the particular page.
Like this: driver.findElement(webdriver.By.id('password')).sendKeys("password");
Consider the login functionality: I have two text fields, username and password with the same id, webdriver tries to look for these elements through the id in the source code but that is not present, and hence my test fails citing "No such element".
How should I move forward in order to perform integration test for my app?