Comments (5)
I have no idea I don't use jstestdriver, post a whole piece of code to look at and make sure you're not doing something wrong at least.
from jasmine-jquery.
I have used jsTD with jasmine, jasmine-jquery to test website, and it works OK. I use jstd-maven-plugin to run jstd, but I also tried to use java command line, they are both ok. Here is my src/test/
directory tree:
test
├── js
│ ├── fixtures
│ │ ├── css
│ │ │ └── bootstrap.min.css
│ │ └── index.html
│ └── testSpec.js
└── resources
├── jasmine
│ ├── jasmine.css
│ ├── jasmine-html.js
│ ├── jasmine-jquery.js
│ ├── jasmine.js
│ └── MIT.LICENSE
├── jstd
│ ├── coverage-1.3.4.b.jar
│ ├── JasmineAdapter.js
│ └── JsTestDriver-1.3.4.b.jar
└── jsTestDriver.conf
jsTestDriver.conf:
server: http://localhost:4224
load:
- src/test/resources/jasmine/jasmine.js
- src/test/resources/jstd/jasmineAdapter.js
- src/main/webapp/js/lib/require-jquery.js
- src/test/resources/jasmine/jasmine-jquery.js
- src/main/webapp/js/lib/*.js
test:
- src/test/js/*.js
serve:
- src/test/js/fixtures/*.html
- src/test/js/fixtures/css/*.css
plugin:
- name: "coverage"
jar: "src/test/resources/jstd/coverage-1.3.4.b.jar"
module: "com.google.jstestdriver.coverage.CoverageModule"
timeout: 600
and a sample spec file:
describe("sample test", function() {
beforeEach(function() {
//need to use absolute path here for jstd-maven-plugin
jasmine.getFixtures().fixturesPath = '/test/src/test/js/fixtures';
loadFixtures('index.html');
//need this css to use `toBeHiden` and `toBeVisible` matchers
jasmine.getStyleFixtures().fixturesPath = '/test/src/test/js/fixtures/css';
loadStyleFixtures('bootstrap.min.css');
});
describe("when user click something", function() {
it("should show something", function() {
expect($('#a-page')).toBeHidden();
expect($('#b-page')).toBeHidden();
$('#course1').click();
expect($('#a-page')).toBeVisible();
expect($('#b-page')).toBeHidden();
});
});
});
});
from jasmine-jquery.
Thanks @justlaputa for posting that, looks pretty thorough. I'll link to this issue from the README in-case other jstd users come along.
from jasmine-jquery.
Thanks, glad to be helpful!
from jasmine-jquery.
thank you for posting that. Sorry I had not posted back in a few days I got tied up with work. I'll try this out tonight.
from jasmine-jquery.
Related Issues (20)
- Why is not recognizing jQuery object HOT 1
- Cache for fixtures is based on relative paths not absolute
- Feature Request: .toHaveMinLength()
- Documentation about jQuery 3 HOT 5
- toBeEmpty() matcher inconsistent behavior
- Error during loading: Cannot set property 'spiedEventsKey' of undefined HOT 3
- HTML fixtures load but JSON fixtures do not HOT 2
- Is it possible to loadFixtures over http? HOT 1
- Readme for toBeInDom() is incorrect
- Bug in addCustomEqualityTester HOT 2
- How to check whether the jquery plugin is applied to the DOM element? HOT 2
- Issue in jquery bower version
- Mocking with jasmine-ajax has been fixed
- Updating the documentation to include `npm install jasmine-jquery --save`
- laravel when saving sass giving error "Cannot set property '__file' of undefined" but working when saving js ..... every time mix build successful HOT 2
- JQUERY PHP (XHR LOADING FAILED)
- Is this library still maintained? HOT 10
- Can't set lang attribute on element HOT 1
- Has anyone ever tried to use this with Jest? HOT 2
- critical security issue in 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 jasmine-jquery.