Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Unable to see the execution in vs code. #26193

Closed
PradeepHebbar opened this issue May 8, 2017 · 12 comments
Closed

Unable to see the execution in vs code. #26193

PradeepHebbar opened this issue May 8, 2017 · 12 comments
Assignees
Labels
debug Debug viewlet, configurations, breakpoints, adapter issues info-needed Issue requires more information from poster

Comments

@PradeepHebbar
Copy link

PradeepHebbar commented May 8, 2017

the test cases are shown as passed but i cant see the execution.
I can see that browser is launched but no Url is loaded.

But when i run the same project in command promt i can see the URL getting loaded and the execution of the test case as well.

I am pasting my launch.json and config file below::

{

"version": "0.2.0",
"configurations": [{
        "type": "node",
        "request": "launch",
        "name": "Launch Program",
        "program": "${workspaceRoot}/node_modules/protractor/bin/protractor",
        "args": ["${workspaceRoot}/config.js"]
    },
    {
        "type": "node",
        "request": "attach",
        "name": "Attach to Process",
        "address": "localhost",
        "port": 5858
    }
]

}

config.js

var Jasmine2HtmlReporter = require('protractor-jasmine2-html-reporter');
var jasmineReporters = require('jasmine-reporters');
exports.config = {
seleniumAddress: 'http://localhost:4444/wd/hub',
specs: ['spec/Calculator.js'],
capabilities: {
'browserName': 'chrome'
},
jasmineNodeOpts: {
showColors: true
},

onPrepare: function() {
	console.log("inside config");
    jasmine.getEnv().addReporter(
        new Jasmine2HtmlReporter({
            savePath: 'target/screenshots'
        })
    );
}

};

These are the logs printed in vscode console window:::

node --debug-brk=48235 --nolazy node_modules\protractor\bin\protractor c:\Users\dipika.gusain1\Desktop\Jasmine/config.js
Debugger listening on [::]:48235
Using the selenium server at http://localhost:4444/wd/hub
[launcher] Running 1 instances of WebDriver
inside config
3.
Finished in 0.13 seconds
3 tests, 3 assertions, 0 failures
[launcher] 0 instance(s) of WebDriver still running
[launcher] chrome #1 passed

@egamma egamma added the info-needed Issue requires more information from poster label May 8, 2017
@egamma
Copy link
Member

egamma commented May 8, 2017

@pradeep-kumar-JP please provide more context, what are you trying to do when the problem occurrs? What is your setup. Do you want to debug a protractor test case?

@PradeepHebbar
Copy link
Author

@egamma
Its a protractor-jasmine framework. I am just trying to run my test cases in the vscode.

When i run my test cases in command promt, i face no issue i.e.

  1. I can see the URL getting loaded each time my test cases are run.
  2. I can see the execution on the browser.

But when i run the same test cases in vs code, i can't see any of those 2 happening . Also i dont understand how the test cases are reporting to be passed in console window.

i have shared my launch.json , config,js, and reports on the console in the previous comment box.

@egamma egamma removed the info-needed Issue requires more information from poster label May 8, 2017
@egamma egamma added debug Debug viewlet, configurations, breakpoints, adapter issues info-needed Issue requires more information from poster labels May 8, 2017
@egamma
Copy link
Member

egamma commented May 8, 2017

@pradeep-kumar-JP thanks for the additional information, but the launch.json is not sufficient for us to reproduce the problem, can create or point to a setup (e.g. github repository) that we can use to reproduce the problem.

@weinand
Copy link
Contributor

weinand commented May 8, 2017

@pradeep-kumar-JP are you following the (VS Code) steps listed here: https://github.com/angular/protractor/blob/master/docs/debugging.md ?

@PradeepHebbar
Copy link
Author

PradeepHebbar commented May 8, 2017

@egamma
Do you mean I should push my project folder in github repository ?

@PradeepHebbar
Copy link
Author

@weinand
I am not debugging. I am simply trying to run my test cases in vs code

@weinand
Copy link
Contributor

weinand commented May 8, 2017

@pradeep-kumar-JP configuring a launch.json is typically used for debugging, but of course, using it for running tests should work too.

Could you please try to run your tests from the command line but inside VS Code. For this open the integrated terminal and use the same command that you would use when running the tests ouside of VS Code.

Does this work?

@PradeepHebbar
Copy link
Author

@weinand
Thank you for the solution. I am able to run the test cases from the integrated terminal.
Could u please suggest a way to debug .?

@weinand weinand added question and removed info-needed Issue requires more information from poster labels Mar 2, 2018
@weinand
Copy link
Contributor

weinand commented Mar 2, 2018

@PradeepHebbar is this still a problem in recent versions of VS Code and Node.js?

@weinand weinand added info-needed Issue requires more information from poster and removed question labels Mar 2, 2018
@aj-r
Copy link

aj-r commented Mar 2, 2018

@PradeepHebbar @weinand I was having a similar issue trying to debug tests with plain jasmine (no protractor). The issue was that Jasmine's default reporter writes to stdout, not necessarily to the console. Adding "console": "integratedTerminal" to my launch config fixed the problem.

@pavelstudeny
Copy link

pavelstudeny commented Mar 27, 2018

@weinand, yes. Redirecting the output to the terminal as suggested above didn't look that great, but
"outputCapture": "std" does show the output, but then I don't see the line numbers saying where the output comes from.
To reproduce, you can use any project with Jasmine tests that use the default reporter.

@weinand
Copy link
Contributor

weinand commented Mar 27, 2018

So there seem to be enough ways to get this to work. Closing.

@weinand weinand closed this as completed Mar 27, 2018
@vscodebot vscodebot bot locked and limited conversation to collaborators May 11, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
debug Debug viewlet, configurations, breakpoints, adapter issues info-needed Issue requires more information from poster
Projects
None yet
Development

No branches or pull requests

5 participants