Comments (10)
@christian-bromann I hate coffeescript with a passion, but I thought it would be a "easy fix".
I'm gonna re-do this module in ES6 only using the chai-webdriver module as inspiration.
None of the assertions would need a DOM flag perse, it only results in a more explicit API, but I think in most cases it makes sense to get rid of it, but in others it doesn't. For example if you where to implement exist
expect('.some-selector').to.exist;
expect('invalidselector').to.exist;
It becomes hard to tell what exactly you want to assert, because if you check if something is a css selector the 2nd example will return true, because when overriding existing assertions you call the super if it doesn't match your current. But then again the other way of looking at it is that if you add the chai-webdriverio assertion helpers you're going to be using chai in a UI testing way so it might be okay to change some existing behaviour of chai.
I just have 1 question for you, how would you recommend finding out if the current mode is promise or sync based? I'd rather not just look for .then, so if there's another way please let me know
from chai-webdriverio.
@christian-bromann Finished the rewrite, I've only implemented the methods I need right now but everything is ES6 and properly unit tested.
I think I'll implement promise based use later when I have the time. I'm thinking of wrapping the client with a fibers layer so it behaves synchronous in my tests. What do you think? I haven't looked at the wdio cli tool yet but I'd assume that's how it works
from chai-webdriverio.
promise or sync based?
it is sync based when there is a global browser
object that is an instance of WebdriverIO and the following is true
: `.options.sync.
wrapping the client with a fibers layer
I am not sure if this is possible. To do so you need to also overwrite the it
method or at least something that you can give a promise (a future object) and the execution stops until that is resolved.
In general having that plugin for sync mode only is absolutely fine. Remember that for async you can still transfer promises to chai and use chai-promise to write code like:
it('should contain a certain text after clicking', function() {
return client
.click('button=Send')
.isVisible('#status_message').should.eventually.be.true
.getText('#status_message').should.eventually.be.equal('Message sent!');
});
which is basically the same.
from chai-webdriverio.
@christian-bromann I'm confused about the chai-as-promised
chains in your example. You're chaining them onto a webdriverio
client
object, right? I don't see how they would work without being chained onto expect
.
I hate node-fibers
with a passion, so I may at some point work on my own chai plugin for doing async webdriverio assertions.
from chai-webdriverio.
@jedwards1211 I would recommend to use expect-webdriverio
from now on. It also supports async command execution.
from chai-webdriverio.
sigh, I'm using chai
though, not expect
from chai-webdriverio.
I often end up wishing a lot of assertion utilities like this were standlone libs instead of plugins for the disparate assertion frameworks out there
from chai-webdriverio.
Okay I made an async fork of this: https://github.com/jcoreio/chai-webdriverio-async
from chai-webdriverio.
so there is no chance to incorporate it into this library?
from chai-webdriverio.
it's certainly possible, I just have so much work to get done ATM I didn't want to make a PR and wait for it to get approved. I found out recently that Chai/Mocha's not as popular as Jest/Expect these days, and this package doesn't have many stars...anyone who needs async (which is more of a minority I assume) can now use my fork anyway, so I just didn't think it was the best use of my time making a PR to this package
from chai-webdriverio.
Related Issues (20)
- Add documentation page for webdriver.io website HOT 2
- Replace the `immediately` flag? HOT 4
- Additional matchers HOT 1
- Change regex assertion to `.match` and add `contain` flag?
- An in-range update of mocha is breaking the build 🚨 HOT 2
- Dev and peer dependencies are not right HOT 1
- Publish 0.4.3 to npm HOT 4
- Read me misleading? HOT 6
- Use already selected elements instead of string HOT 15
- False Positives HOT 1
- Add a 'dom' or 'elements' method to qualify assertions?
- support for have.selector
- support for scoping selectors
- Version 10 of node.js has been released
- Make chai-webdriverio compatible with WebdriverIO v5 HOT 3
- Help Wanted! (i.e. new maintainers) HOT 4
- chai-webdriverio throws an exception anytime an expect clause with displayed is fired HOT 5
- Negated "text" and "value" assertions are always wating for defaultWaitTime
- Add "class" assertion
- Add an "exist" assertion 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 chai-webdriverio.