Comments (15)
The library I was talking about on twitter - https://github.com/defunctzombie/zuul - it's my favorite runner, supporting mocha, jasmine, qunit frameworks, using the --electron
flag will give you an electron instance to run your tests in and (I believe) gives you all of the stuff needed for your integration tests. Changing the location doesn't seem to affect the reporter, so that's a plus.
from history.
I don't think you should use intern, I've been following it since release and it was promising but it is very inflexible and have heard nothing but complaints from anyone that tries to use it.
from history.
Also, you can use your webpack config as part of zuul using https://www.npmjs.com/package/zuul-builder-webpack
from history.
I'm biased (current maintainer of Karma) but I will suggest to use Karma. There is an issue with changing urls when using Karma, which I'm currently investigating and hope to have a fix for soon (Ref: karma-runner/karma#1101) so after that you should be good to go
from history.
Thanks for the input @dignifiedquire. The reason I'm questioning if karma would be a good fit here is because it seems like karma doesn't want me to ever refresh the page, which is exactly the kind of thing we need to do every so often in a thorough test suite for a history lib. :)
For example, we currently have a beforeEach
hook that does window.location.href = '/'
. This hook is designed to give each test a clean history slate to start with. It would be better if we had a brand new session (i.e. browser tab) to work with in each test, but I'm currently working within the constraints of jsdom's "global" mode.
I guess my question for you is, is this the kind of thing that is within karma's expectations? Or has karma loaded code in the browser that will screw up the test if we do a page refresh?
@phated Thanks for the link to zuul (and bonus points for the Ghostbusters reference!). I'll add it to the list of possible candidates and give it a whirl.
from history.
@mjackson I started a similar search last week and Zuul made it to the top of my list as well, followed by Karma (mostly due to mindshare & my history with Angular).
Intern went through just the "R" of "R & D" before I decided to try out Zuul first.
I've subscribed to this thread so I can share my findings with the group as well. See you on the other side! :)
from history.
As the maintainer of WebdriverIO I can confirm that all of the above mentioned requirements would work since you can execute any arbitrary JS using execute
or executeAsync
. However I think you should go with zuul as it runs your tests directly in the browser. This makes them execute a lot faster and you don't work in two different environments (browser & node context) which makes it less confusing.
from history.
I'm not sure if you've already settled on zuul, but https://github.com/hughsk/smokestack has served me well β I'd recommend taking a look.
from history.
Thanks for the insight @christian-bromann. I still think that WebdriverIO could be a slightly better fit than zuul because it controls a client instance from the outside. It seems like this would be a huge benefit when testing a history lib because we can essentially start with a clean browser session with each test.
For example, if I pushState
in an in-browser testing framework like karma/zuul I've already permanently modified certain aspects of window.history
(like window.history.length
) that cannot be undone unless I start a new browser session, so I'll end up with tests that leak state. For this reason, I'd like to do something like this (in mocha):
beforeEach(function (done) {
client = webdriverio.remote(...); // Create a brand new client instance.
client.init(done); // Start a new browser session.
});
afterEach(function (done) {
client.end(done); // Destroy the browser session.
});
@christian-bromann Is there anything about creating and destroying multiple client
instances in WebdriverIO that would prevent me from doing this? Or is this totally unnecessary for some reason?
from history.
@joeybaker Thanks for the recommendation, but unless I'm mistaken smokestack follows more or less the same process model as karma/zuul (runs everything in the same tab), right?
from history.
Yea, it does. :(
A possible solution would be to separate your tests into many files and launch a new smokestack instance for each file. That's basically what webdriver will do for you, but might make for a complicated test launch script.
from history.
It seems like this would be a huge benefit when testing a history lib because we can essentially start with a clean browser session with each test.
True.
Is there anything about creating and destroying multiple client instances in WebdriverIO that would prevent me from doing this? Or is this totally unnecessary for some reason?
You should use the wdio runner. Like in protractor you define a set of capabilities + the test spec that the capability should test. You should also be able to recreate the Selenium session during a wdio test run.
from history.
Man, spent most of today trying to put together a branch that uses WebdriverIO for testing, but it's a lot of work. Basically, the flow ended up like this:
- Install & boot selenium
- Bundle my library + tests to a
test/bundle.js
file - Boot an HTTP server that serves
test/index.html
.test/index.html
has a<script>
tag that includestest/bundle.js
- From my test suite, use WebdriverIO's
execute
method to execute test methods on the client
But it feels clunky. Maybe a single process suite is the way to go...
from history.
Whatever works is good, but for what it's worth, the reason I suggested smokestack is because eveytime I touch selenium I get the same reaction.
You might look into saucelabs. It's free for OSS
from history.
Well, as of 3dde5ce our testing story is to use zuul to run our tests locally, on sauce labs, and even on Travis. It was really easy to get everything setup, so that's what we'll go with for now.
If someone gets some time/ambition to dig into this further in the future, we can reopen this ticket. But I'm closing for now.
from history.
Related Issues (20)
- Named exports donβt work with Node.js ESM support HOT 1
- Sourcemaps are blank HOT 1
- Use History in redux actions HOT 2
- Location type should have template for unknown for state HOT 3
- doing history.go() does NOT trigger a blocker callback handler HOT 1
- Did TS declaration file disappear for v4? HOT 4
- Wrong action after clicking on Forward button in browser HOT 3
- Need history.BackTo(string)
- Is it possible to access the history bundled into React Router? HOT 1
- globalHistory.pushState function excuted failed in baidu.app
- [v6] Missing hashType={"noslash"} of HashRouter HOT 3
- [react-router-dom v6] HashRouter support HOT 1
- Add index property to BrowserHistory, HashHistory and corresponding Update
- Why `history.length` is gone? HOT 7
- createBrowserHistory() breaks history URL on iOS 11
- history
- is this project abandoned? HOT 2
- Navigate replace without generate new location.key
- hash history url is not parsed correctly with query params
- ReferenceError: document is not defined in Next.JS HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
π Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. πππ
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google β€οΈ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from history.