segment-boneyard / nightmare

A high-level browser automation library.
https://open.segment.com
19.54k stars 1.08k forks source link

Will this project be updated for the latest version of Electron? #1539

Open ashleydavis opened 5 years ago

ashleydavis commented 5 years ago

Nightmare is dependent on Electron 1.8.4.

The latest version of Electron is 4.1.4.

Will Nightmare be updated to the latest Electron?

honga commented 5 years ago

+1 please update to the latest electron

netsgnut commented 5 years ago

Now with #1534 merged, the latest version is 3.0.2 (as of writing), using an Electron version of 2.0.18, with Chrome 61 at its core.

For the long term development of the project, I believe it is inevitable to have an upgrade plan for Electron dependencies, e.g. a major version bump of Nightmare to track a major version bump of Electron. While I would love to fiddle around with the latest version of Electron myself as well (it seems now even v5.0.2 is out with Chrome 73), I guess it is OK too if we are to use v3 (Chrome 66) or v4 (Chrome 69).

Now given our current version is v3.0.2, perhaps from the next release, we could try to see if Nightmare v4 could track Electron v4 (e.g. 4.2)? It might be a good idea for Nightmare major version to be in sync with Electron major version, and Nightmare's own API changes (if small) and changing of Electron dependency within the same major branch (e.g. 4.1 -> 4.2) would bump a minor version.

In that case, existing apps would need to follow more closely to Electron's API breakages if they are to use some of Electron's APIs, though they can always be locking on a specific major version to avoid massive code changes.

Any ideas, @matthewmueller, and anything we the community could be of help?

It is a pity that this project, while still super useful and powers a few of my pet projects, gets stuck in quite an old underlying engine. Currently, I am hacking a local copy of Nightmare to see if I could get it to work with Electron 4.2.2. I am still midway through and not quite sure of the implications of the architecture change underneath yet, but I will try my best there.

matthewmueller commented 5 years ago

We'd happily accept a PR for bringing Electron up-to-date in Nightmare!

codebling commented 4 years ago

Sorry for bumping an old issue. Not sure where to put this.

Versioning

a major version bump of Nightmare to track a major version bump of Electron

@netsgnut I disagree. Most users don't care what version of Electron is used by Nightmare under the hood, and shouldn't have to. I know that the subject is more complicated than that because some code has to be run directly by Electron.

Tying Nightmare's version to Electron really complicates things and still seems like a bad idea.

Old Electron issues (nothing you haven't heard before)

Agree that Electron needs to be updated, though. On Arch, Nightmare currently won't run. The version of Electron used by Nightmare right now relies on GConf, a library which was discontinued over 7 years ago. Arch got rid of the package. So now I'm stuck until a newer version of Electron is used.

Electron 8 work

To that end, I started working on integrating Electron 8. Branch here.

I took this up about a week and a half ago and have since had some other work to do. I cleaned up a few broken tests. At this point, the following 10 tests are still failing.

From navigation:

1) should succeed properly if request handler is present 2) should support javascript URLs that load pages 3) should fail immediately/not time out for 304 statuses

From navigation/timeouts:

4) should allow actions on a hanging page 5) should allow loading a new page after timing out

From referer:

6) should return referer from headers

From options:

7) should set a single header 8) should set all headers 9) should set headers for that request 10) should allow webPreferences settings

I could use some help on these. First step is to fix these tests. This is kind of a first "naive" pass at migrating. Since test coverage is quite good for this project, this might actually be all that is needed, but I'd still want to go over the list of breaking changes one by one to make sure each change has been accounted for.

p.s. hi @matthewmueller, I've used X-ray a couple of times and loved it, thanks for that!

netsgnut commented 4 years ago

Hi @codebling, while I still think Nightmare should bump its major version when the underlying Electron version is upgraded, I think I can understand your perspective there. However, seeing that quite a number of the issues (at least at that time I made that comment) are sometimes caused by a dated version of Electron (or Chromium to be exact) underneath, it probably is a good idea to bump it.

And by the way, great job you had there :) I couldn't get past many of the tests there and, shamefully, I gave up and moved to Puppeteer instead. In my case, it seems a better match, but I still stand by the statement that Nightmare has its charm and I really hate to see it collecting dust at an old Electron version.

eklem commented 4 years ago

Will Playwright be a good fit?

codebling commented 4 years ago

@eklem thanks, that or Puppeteer both look like acceptable substitutes, but does that mean that everyone has given up on Nightmare?

eklem commented 4 years ago

@codebling Not sure? Guessing the ones needing an updated version and doesn't find it, figures out other solutions. Either Segment needs to put some effort into it again, or someone else with a lot of resoiurces needs to fork and update.

And my comment is in no way negative to Segment. They have made life simpler for a lot of people and businesses. It may just be that nightmare is not part of their business model any more? Or other things are more pressing?