dalekjs / dalek-internal-assertions Goto Github PK
View Code? Open in Web Editor NEW[unmaintained] DalekJS internal module for assertions
[unmaintained] DalekJS internal module for assertions
Certain assertions will just hang indefinitely if the selector does not return a element. Certain asserts work fine with a selector returning no elements like exists() and doesntExist however 2 that hang that I have tested are attr() and text().
The to.contain() test helper helps with a lot of cases where the value is dynamic and you can't know what the exact value with be (as it might change) however there is still some cases where to.contain() will not work.
I think adding a to.match() test helper that uses regular expressions will help fill in that gap. This will give the user the ultimate power in making sure a certain value match and certain structure.
I will work on this feature.
While my specific use case related to doesntExist, I can't see any reason not to expose this functionality to all assert methods.
Right now when using assert.doesntExist(), it seems to wait a few seconds before it either passes of fails the test but there is no control over what the wait time is. I think the default wait time should be instant 0 milliseconds) but allow the user to be able to override that.
The use case for me is I have this component that will wait X milliseconds after the user has stops typing before performing an ajax request and insert that data from the ajax request. If that time is set to 350 milliseconds, right now I can't test that because doing this:
test.assert.doesntExist('selector')
will wait more that 350 milliseconds. What would be nice is to be able to do something like this:
test
//should not exists yet, only 200 milliseconds passed
.assert.wait(200).doesntExist('selector')
//not it should exists as 400 milliseconds has passed, more than the configured 350 milliseconds)
.assert.wait(200).exists('selector');
I'm getting an issue where I can't select a new tab that opens up via toWindow() function. If I have an anchor that has target="_blank", how do I select that new tab? Everything I try just makes DalekJS freeze up.
It would be nice if there would be assertions that let you execute a js on the page and asserts the return value with a value to check if the js works correctly.
I ๐ Dalek's API.
One thing that'd I'd like to do is this:
test.open( url ).assert( userIsSignedOut ).done()
function userIsSignedOut() {
this.assert.chain()
.visible('.accountBar')
.text('.username', '')
.end()
}
That would allow me to define reusable steps / assertion groups. I'd like to have the same for steps, like so
test.open( url ).then( takeScreenshots ).done()
function takeScreenshots() {
this.resize({width: 320, height: 480})
this.screenshot('/screenshots/:viewport')
this.resize({width: 768, height: 1024})
this.screenshot('/screenshots/:viewport')
this.resize({width: 1280, height: 800})
this.screenshot('/screenshots/:viewport')
this.resize({width: 1680, height: 1050})
this.screenshot('/screenshots/:viewport')
}
This would make the actual test files very consize and even more readable, at the same time allow for better code reuse. Happy to help building this if you like it
Right now we can do something like:
assert.attr('selector', 'class').is('class1 class2 class3', 'has class2');
but it would be much better to be able to do (and it would also allow other things that are currently impossible):
assert.attr('selector', 'class').contains('class2', 'has class2');
i have an html element like this:
<input id="blub" class="ember-view ember-text-field form-control" placeholder="-" disabled="disabled" type="text" data-testid="foo">
I want to assert the disabled attribute as it is described in the docs with:
.attr('[data-testid="foo"]').is('disabled', 'disabled', 'Textfield blub is disabled.')
but it fails saying:
-->0 EXPECTED: disabled
-->0 FOUND: null
-->0 MESSAGE: disabled
Any ideas?
versions:
Win7
dalek-cli 0.0.4
dalekjs local install: 0.0.8
cheers izocan
If a test fails, there is a good chance you want to see what the site/application looked like for that failure. It would be nice to be able to have a configure that would allow on a global level to enable or disable such a feature.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.