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
Element explorer doesn't work on Node 8 #4307
Comments
I don't think we are currently testing against node 8 so it makes sense that this may be broken. Thanks for bringing this up! |
I'll try to dig into this in the next few days but a PR to fix this would be very welcome! |
_debugger and the legacy CLI debugger were removed in Node 8: nodejs/node@90476ac6ee |
Any updates on this? |
Could we please know what are the plans for Node 8 support? :) |
With Node v8 set to enter LTS in October, maybe we could get an update? |
According to https://nodejs.org/en/docs/guides/debugging-getting-started/#legacy-debugger , |
Are there plans from the team to get this working again with either the inspect API or something other approach? |
Same error node-inspector/node-inspector#1025 (comment) Also https://stackoverflow.com/questions/44662442/node-inspector-not-starting |
I've started having a look into this. Here are a bunch of guesses about how updating this might work: As far as I can tell, the changes need to happen in debuggerCommons.js Rather than I'll have a crack at a PR when I get some time. |
@phenomnomnominal Hey that's great! May I know when you are available for making the PR? Since this functionality is so useful, would be great if it can be created soon. It will speed up our development so much. |
@phenomnomnominal Hi, we are planing to support node 8.0 recently, what's your current plan of fixing this issue? |
Only what I outlined above. I was planning on having a crack at it this evening. |
@phenomnomnominal that's great, thanks a lot! |
@phenomnomnominal Hi, any updates so far? |
I started having a go, but I was having issues with Selenium when trying to run the tests (any tips?). I’m going to have some more time Tuesday night. The new API is quite different, but I don’t foresee any real issues. |
ok, thanks a lot. I am supposed to have some time after Monday, maybe I can also look into it after that. |
I got... somewhere? Turns out debugging the debugger isn't as straightforward as I'd have hoped. @qiyigg did you have a chance to look at anything? |
I will look into it today, thanks! |
I’ll have some more time this evening too, we can compare notes later. |
Hi, any progress on this issue in the last week? It's still occurring. |
This issue has been open for almost a year. Still no progress? |
@ajklotz @monkpit @mraible If you are able to run with Node 8 or higher, I recommend that you try to do the following:
I have done this with my own Protractor tests and confirm that it works. |
@ajklotz @monkpit @mraible Here is an example where I converted Protractor tests to use async/await: https://github.com/buildbot/buildbot/pull/4074/files Anything that returns a Promise, you stick an
If a function has a call to If you call a function with It takes a while but once you do it, then it works. |
@rodrigc My tests area already using async/await, the point of this issue is that from the command line, |
FWIW, seems like a language feature like |
@monkpit Yes you are absolutely right. The root cause of your problem is that on this line: https://github.com/angular/protractor/blob/master/lib/debugger/debuggerCommons.js#L1 , the So, if you want to use node8 or higher and debug with protractor, the key is to use The old debugging stuff won't work. |
Either it’s not going to get fixed (that’s fine, I can use the workaround) or it will be updated to use node 8+ (that’s also fine). But I would love to see an official response one way or the other. |
I think the answer lies in this comment of @qiyigg.
From what I've heard from @qiyigg when I talked to him the current focus in the team is lying on disabling control flow in Protractor tests. I'm going to close this issue for now. It's still open for discussion. |
@qiyigg I have started using the new Can the protractor team start marking the documentation for the old debugging code which uses |
If you take a look at the debugging document, we have already mentioned the debugger won't work on Node 8 One thing to keep in mind is: not everyone is using Node 8+, we cannot say debugger is deprecated and enforce everyone to use async/await (Although we will do so inside google). Apparently, moving to Node 8+ and async/await have many benefits and we should move to it eventually, but it is not an easy job since we have to change lots of our existing code. We are working on this inside google and try to accumulate more experience about migration (even migration tools)and hope it could also help users outside google eventually. I think what we could do now is to make this error more clear, say, throw an exception: element explorer/debugger is not supported for Node 8+ instead of "Error: Cannot find module '_debugger'", A PR will be very welcomed. |
@qiyigg I would suggest to make that warning in bold and ALL CAPS. It is a bit hard to catch on that page, because there are a lot of words. |
i'm really happy with the new debugger because i can use intellij to run my tests. this is way better than the element explorer (which i rather liked) but using my IDE to debug tests is a huge win. |
@qiyigg I work at a company that makes large production pinters. Because we changed all our UI's to use Angular (hurray!) we decided to use Protractor for the UI E2E tests (also hurray). Apart from these E2E tests we also have real end to end tests that work on an actual running system. All the test cases for that test system are specified in the Microsft TFS testing framework and we use a DSL to write them. This DSL loads the page objects we wrote for our UI's through an interactively started protractor (so the element explorer) and calls methods on them to execute its tests. So far so good, you would say, we have thousands of these tests and they run really "as a user". What I make out of this conversation is that element explorer is dropped with the new node (and the new node is mandatory for upgrading Angular). This also means that all of a sudden our entire test base would stop working. I get the change with async / wait and we will rewrite our page objects obviously to support it, but there's no real alternative to remotely insert protractor commands, right? I will always have to pass in "a test" that only calls "debugger", and then directly communicate with chrome to call a command on my page objects and then run to the next "debugger" call which I then probably will have to run in a while loop. Were scenario's like these not supported? Won't they be? Or am I just missing something ... To me, debugging errors in your tests/code is entirely different from remotely instructing test commands. The latter is something element explorer used to facilitate :) |
To at least share what my current solution is, I have written this test, which is the only system test I run with protractor (CompletableFuture is a helper class obviously): jasmine.DEFAULT_TIMEOUT_INTERVAL = 3600000; // arbitrary large timeout
(global as any).systemTestsDone = new CompletablePromise<void>();
describe('TestHelper', () => {
it('should provide a way to interactively run tests', async () => {
await (global as any).systemTestsDone;
});
});
This test then keeps running while I connect my (C#) WS client that acts as a bridge between the test specs, and the page objects. This bridge then instructs the browser to load the page objects and the tests start executing. The last command I send to the browser is of course global.systemTestsDone.complete() so that the test completes normally. I don't think this is really awful, the only strange thing is that I now have to abuse a test to get into an interactive mode. If more people are missing functionality like this it might be a good idea to include it in protractor again. I don't mean an entire devtools protocol but the option to leave protractor running while you, for example, use the console of chrome or visual studio code as "element explorer". |
add @vikerman, who will take over the Protractor stuff. |
@vikerman Should I make a feature request out of the above comments? In short, what I would like to have in protractor (since |
this would be really good if someone fixes this. I am currently using nvm as a work around. |
I downgraded to node v6 to get this to work and now I can't run my Angular 6 app because node 6 isn't supported in Angular 6+. It looks like Angular now targets node >= 8.9.0. Is there a good work around that I can follow to get a protractor REPL w/o having to run two versions of node? |
I'm having the same error in the console. I'm following these instructions given here but still same error is coming 👎 |
So is this the end for browser.pause() / browser.debugger()? Appears we should be moving away from control flow and using node debugger. |
Using NVM to switch to node version 7.10.1 fixed the browser.pause() issue for me. |
I understand that async/await is the way forward, and using Webstorm to debug tests with breakpoints is absolutely seamless, but where I feel the absence of elementExplorer is its extended usage in the elementor package, which was a delightful way to interactively test out parts of code on the fly (in the omnibox) instead of running the entire test from scratch. |
@woppa684 Suggestion is working nicely for me. Thanks @woppa684. I just moved to node 10+ which has repl-await (so you can just await in the console) Added all my config files for reference, hopefully it helps someone: Special interactive debug spec - interactive.e2e.tsimport { LoginPage } from './src/pages/login.po';
import { AppPage } from './src/pages/app.po';
import { SwitchProfileSideSheet } from './src/side-sheets/switch-profile-side-sheet.po';
import { sel } from '../src/testing/get-component';
const login = new LoginPage();
const app = new AppPage();
const switchProfileSideSheet = new SwitchProfileSideSheet();
// add my own page objects to the global object so I can use them interactively.
global['sel'] = sel;
global['po'] = {
login,
app,
switchProfileSideSheet,
};
(global as any).systemTestsDone = new Promise(function(_resolve, _reject) {
global['finishInteractiveDebug'] = _resolve;
});
describe('TestHelper', () => {
it('should provide a way to interactively run tests', async () => {
await (global as any).systemTestsDone;
});
}); package.json "e2e-interactive": "node --experimental-repl-await --inspect-brk ./node_modules/.bin/protractor ./e2e/protractor.interactive.conf", protractor.interactive.conf.js// Protractor configuration file, see link for more information
// https://github.com/angular/protractor/blob/master/lib/config.ts
// standard protractor config
const baseConfig = require('./protractor.conf');
const configCopy = Object.assign({}, baseConfig.config);
const oneDayInMilliSeconds = 1000 * 60 * 60 * 24;
// set timeout to a huge number
// so it's not an issue when we pause in the debugger
configCopy.allScriptsTimeout = oneDayInMilliSeconds;
configCopy.jasmineNodeOpts.defaultTimeoutInterval = oneDayInMilliSeconds;
// just load our interactive specs
configCopy.specs = ['./interactive.e2e.ts'];
console.log('interactive config', configCopy);
exports.config = configCopy; |
I use |
Bug report
8.0.0
5.1.2
n/a
Chrome / chromedriver 2.29.0
Mac Sierra 10.12.5
n/a
After installing node v8.0.0 and npm v5.0.0, reinstalling protractor globally and running
webdriver-manager update
, I cannot runprotractor --elementExplorer
because I receive the following error:If I revert back to node 7.10.0 I don't get this error.
The text was updated successfully, but these errors were encountered: