How to debug protractor in VS CODE?
.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty,.everyoneloves__bot-mid-leaderboard:empty{ height:90px;width:728px;box-sizing:border-box;
}
I'm trying to debug protractor test script but I'm not able to find good source to understand how to debug, can any one suggest me few best sites to refer and how many ways can we debug the protractor test script.
protractor web-testing
add a comment |
I'm trying to debug protractor test script but I'm not able to find good source to understand how to debug, can any one suggest me few best sites to refer and how many ways can we debug the protractor test script.
protractor web-testing
Possible duplicate of How to debug component/typescript code when running Protractor
– Bharath Kumar S
Jan 3 at 4:26
1
Not a duplicate. Element explorer is going to be deprecated. This is (hopefully) going to use the--inspect-brk
. See the following answer stackoverflow.com/questions/53986770/…. Also we have a youtube vid of this: youtube.com/watch?v=6aPfHrSl0Qk&t=1208s
– cnishina
Jan 3 at 6:49
you can add the launch.json and debug. check this blogs (blogs.msdn.microsoft.com/wushuai/2016/08/24/…) (lukasbehal.com/2017-06-16-ts-protractor-tests-debugging)
– anandks
Jan 3 at 9:11
add a comment |
I'm trying to debug protractor test script but I'm not able to find good source to understand how to debug, can any one suggest me few best sites to refer and how many ways can we debug the protractor test script.
protractor web-testing
I'm trying to debug protractor test script but I'm not able to find good source to understand how to debug, can any one suggest me few best sites to refer and how many ways can we debug the protractor test script.
protractor web-testing
protractor web-testing
asked Jan 3 at 3:47
AnilAnil
32
32
Possible duplicate of How to debug component/typescript code when running Protractor
– Bharath Kumar S
Jan 3 at 4:26
1
Not a duplicate. Element explorer is going to be deprecated. This is (hopefully) going to use the--inspect-brk
. See the following answer stackoverflow.com/questions/53986770/…. Also we have a youtube vid of this: youtube.com/watch?v=6aPfHrSl0Qk&t=1208s
– cnishina
Jan 3 at 6:49
you can add the launch.json and debug. check this blogs (blogs.msdn.microsoft.com/wushuai/2016/08/24/…) (lukasbehal.com/2017-06-16-ts-protractor-tests-debugging)
– anandks
Jan 3 at 9:11
add a comment |
Possible duplicate of How to debug component/typescript code when running Protractor
– Bharath Kumar S
Jan 3 at 4:26
1
Not a duplicate. Element explorer is going to be deprecated. This is (hopefully) going to use the--inspect-brk
. See the following answer stackoverflow.com/questions/53986770/…. Also we have a youtube vid of this: youtube.com/watch?v=6aPfHrSl0Qk&t=1208s
– cnishina
Jan 3 at 6:49
you can add the launch.json and debug. check this blogs (blogs.msdn.microsoft.com/wushuai/2016/08/24/…) (lukasbehal.com/2017-06-16-ts-protractor-tests-debugging)
– anandks
Jan 3 at 9:11
Possible duplicate of How to debug component/typescript code when running Protractor
– Bharath Kumar S
Jan 3 at 4:26
Possible duplicate of How to debug component/typescript code when running Protractor
– Bharath Kumar S
Jan 3 at 4:26
1
1
Not a duplicate. Element explorer is going to be deprecated. This is (hopefully) going to use the
--inspect-brk
. See the following answer stackoverflow.com/questions/53986770/…. Also we have a youtube vid of this: youtube.com/watch?v=6aPfHrSl0Qk&t=1208s– cnishina
Jan 3 at 6:49
Not a duplicate. Element explorer is going to be deprecated. This is (hopefully) going to use the
--inspect-brk
. See the following answer stackoverflow.com/questions/53986770/…. Also we have a youtube vid of this: youtube.com/watch?v=6aPfHrSl0Qk&t=1208s– cnishina
Jan 3 at 6:49
you can add the launch.json and debug. check this blogs (blogs.msdn.microsoft.com/wushuai/2016/08/24/…) (lukasbehal.com/2017-06-16-ts-protractor-tests-debugging)
– anandks
Jan 3 at 9:11
you can add the launch.json and debug. check this blogs (blogs.msdn.microsoft.com/wushuai/2016/08/24/…) (lukasbehal.com/2017-06-16-ts-protractor-tests-debugging)
– anandks
Jan 3 at 9:11
add a comment |
1 Answer
1
active
oldest
votes
you have 2 best ways.
Method A:
1) Configure VSCode.
This is my launch configuration: (change the folder path and files as needed).
{
"version": "0.2.0",
"configurations": [
{
"name": "Launch Backoffice",
"type": "node",
"request": "launch",
"program": "${workspaceRoot}/node_modules/protractor/bin/protractor",
"stopOnEntry": false,
"args": ["${workspaceRoot}/e2e/backoffice/protractor_backoffice.js"],
"sourceMaps": true,
"outFiles": [ "${workspaceRoot}/e2e/backoffice/**/*.js" ],
"smartStep": true
}
]
}
2) Once you have done this you just can run the debugger and it should work.
INFO: To add breakpoints just write in your code "debugger;" (without quotes).
VERY IMPORTANT!!!!
To syncronize your code with your browser you have use async functions and await methods.
example of async/await and breakpoint:
async myFunction() {
debugger;
await this.myElement.click();
}
Method B:
Open a terminal in VSCode and write:
node --inspect-brk path/to/protractor/bin/protactor
path/to/protractorconfig.js
example:
node --inspect-brk .node_modulesprotractorbinprotractor
.e2ebackofficeprotractor_backoffice.js
It opens dev chrome tools, in there is pretty much as VSCode debugger, but it gives a bit more information.
Good luck!
PS: You can also use .then() to solve promises, but I prefer async/await.
– Artyk
Jan 3 at 14:36
add a comment |
Your Answer
StackExchange.ifUsing("editor", function () {
StackExchange.using("externalEditor", function () {
StackExchange.using("snippets", function () {
StackExchange.snippets.init();
});
});
}, "code-snippets");
StackExchange.ready(function() {
var channelOptions = {
tags: "".split(" "),
id: "1"
};
initTagRenderer("".split(" "), "".split(" "), channelOptions);
StackExchange.using("externalEditor", function() {
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled) {
StackExchange.using("snippets", function() {
createEditor();
});
}
else {
createEditor();
}
});
function createEditor() {
StackExchange.prepareEditor({
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader: {
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
},
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
});
}
});
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f54016095%2fhow-to-debug-protractor-in-vs-code%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
1 Answer
1
active
oldest
votes
1 Answer
1
active
oldest
votes
active
oldest
votes
active
oldest
votes
you have 2 best ways.
Method A:
1) Configure VSCode.
This is my launch configuration: (change the folder path and files as needed).
{
"version": "0.2.0",
"configurations": [
{
"name": "Launch Backoffice",
"type": "node",
"request": "launch",
"program": "${workspaceRoot}/node_modules/protractor/bin/protractor",
"stopOnEntry": false,
"args": ["${workspaceRoot}/e2e/backoffice/protractor_backoffice.js"],
"sourceMaps": true,
"outFiles": [ "${workspaceRoot}/e2e/backoffice/**/*.js" ],
"smartStep": true
}
]
}
2) Once you have done this you just can run the debugger and it should work.
INFO: To add breakpoints just write in your code "debugger;" (without quotes).
VERY IMPORTANT!!!!
To syncronize your code with your browser you have use async functions and await methods.
example of async/await and breakpoint:
async myFunction() {
debugger;
await this.myElement.click();
}
Method B:
Open a terminal in VSCode and write:
node --inspect-brk path/to/protractor/bin/protactor
path/to/protractorconfig.js
example:
node --inspect-brk .node_modulesprotractorbinprotractor
.e2ebackofficeprotractor_backoffice.js
It opens dev chrome tools, in there is pretty much as VSCode debugger, but it gives a bit more information.
Good luck!
PS: You can also use .then() to solve promises, but I prefer async/await.
– Artyk
Jan 3 at 14:36
add a comment |
you have 2 best ways.
Method A:
1) Configure VSCode.
This is my launch configuration: (change the folder path and files as needed).
{
"version": "0.2.0",
"configurations": [
{
"name": "Launch Backoffice",
"type": "node",
"request": "launch",
"program": "${workspaceRoot}/node_modules/protractor/bin/protractor",
"stopOnEntry": false,
"args": ["${workspaceRoot}/e2e/backoffice/protractor_backoffice.js"],
"sourceMaps": true,
"outFiles": [ "${workspaceRoot}/e2e/backoffice/**/*.js" ],
"smartStep": true
}
]
}
2) Once you have done this you just can run the debugger and it should work.
INFO: To add breakpoints just write in your code "debugger;" (without quotes).
VERY IMPORTANT!!!!
To syncronize your code with your browser you have use async functions and await methods.
example of async/await and breakpoint:
async myFunction() {
debugger;
await this.myElement.click();
}
Method B:
Open a terminal in VSCode and write:
node --inspect-brk path/to/protractor/bin/protactor
path/to/protractorconfig.js
example:
node --inspect-brk .node_modulesprotractorbinprotractor
.e2ebackofficeprotractor_backoffice.js
It opens dev chrome tools, in there is pretty much as VSCode debugger, but it gives a bit more information.
Good luck!
PS: You can also use .then() to solve promises, but I prefer async/await.
– Artyk
Jan 3 at 14:36
add a comment |
you have 2 best ways.
Method A:
1) Configure VSCode.
This is my launch configuration: (change the folder path and files as needed).
{
"version": "0.2.0",
"configurations": [
{
"name": "Launch Backoffice",
"type": "node",
"request": "launch",
"program": "${workspaceRoot}/node_modules/protractor/bin/protractor",
"stopOnEntry": false,
"args": ["${workspaceRoot}/e2e/backoffice/protractor_backoffice.js"],
"sourceMaps": true,
"outFiles": [ "${workspaceRoot}/e2e/backoffice/**/*.js" ],
"smartStep": true
}
]
}
2) Once you have done this you just can run the debugger and it should work.
INFO: To add breakpoints just write in your code "debugger;" (without quotes).
VERY IMPORTANT!!!!
To syncronize your code with your browser you have use async functions and await methods.
example of async/await and breakpoint:
async myFunction() {
debugger;
await this.myElement.click();
}
Method B:
Open a terminal in VSCode and write:
node --inspect-brk path/to/protractor/bin/protactor
path/to/protractorconfig.js
example:
node --inspect-brk .node_modulesprotractorbinprotractor
.e2ebackofficeprotractor_backoffice.js
It opens dev chrome tools, in there is pretty much as VSCode debugger, but it gives a bit more information.
Good luck!
you have 2 best ways.
Method A:
1) Configure VSCode.
This is my launch configuration: (change the folder path and files as needed).
{
"version": "0.2.0",
"configurations": [
{
"name": "Launch Backoffice",
"type": "node",
"request": "launch",
"program": "${workspaceRoot}/node_modules/protractor/bin/protractor",
"stopOnEntry": false,
"args": ["${workspaceRoot}/e2e/backoffice/protractor_backoffice.js"],
"sourceMaps": true,
"outFiles": [ "${workspaceRoot}/e2e/backoffice/**/*.js" ],
"smartStep": true
}
]
}
2) Once you have done this you just can run the debugger and it should work.
INFO: To add breakpoints just write in your code "debugger;" (without quotes).
VERY IMPORTANT!!!!
To syncronize your code with your browser you have use async functions and await methods.
example of async/await and breakpoint:
async myFunction() {
debugger;
await this.myElement.click();
}
Method B:
Open a terminal in VSCode and write:
node --inspect-brk path/to/protractor/bin/protactor
path/to/protractorconfig.js
example:
node --inspect-brk .node_modulesprotractorbinprotractor
.e2ebackofficeprotractor_backoffice.js
It opens dev chrome tools, in there is pretty much as VSCode debugger, but it gives a bit more information.
Good luck!
answered Jan 3 at 14:33
ArtykArtyk
262
262
PS: You can also use .then() to solve promises, but I prefer async/await.
– Artyk
Jan 3 at 14:36
add a comment |
PS: You can also use .then() to solve promises, but I prefer async/await.
– Artyk
Jan 3 at 14:36
PS: You can also use .then() to solve promises, but I prefer async/await.
– Artyk
Jan 3 at 14:36
PS: You can also use .then() to solve promises, but I prefer async/await.
– Artyk
Jan 3 at 14:36
add a comment |
Thanks for contributing an answer to Stack Overflow!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f54016095%2fhow-to-debug-protractor-in-vs-code%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Possible duplicate of How to debug component/typescript code when running Protractor
– Bharath Kumar S
Jan 3 at 4:26
1
Not a duplicate. Element explorer is going to be deprecated. This is (hopefully) going to use the
--inspect-brk
. See the following answer stackoverflow.com/questions/53986770/…. Also we have a youtube vid of this: youtube.com/watch?v=6aPfHrSl0Qk&t=1208s– cnishina
Jan 3 at 6:49
you can add the launch.json and debug. check this blogs (blogs.msdn.microsoft.com/wushuai/2016/08/24/…) (lukasbehal.com/2017-06-16-ts-protractor-tests-debugging)
– anandks
Jan 3 at 9:11