Coder Social home page Coder Social logo

JsTestDriver integration about jasmine-jquery HOT 5 CLOSED

velesin avatar velesin commented on July 20, 2024
JsTestDriver integration

from jasmine-jquery.

Comments (5)

travisjeffery avatar travisjeffery commented on July 20, 2024

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.

justlaputa avatar justlaputa commented on July 20, 2024

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.

travisjeffery avatar travisjeffery commented on July 20, 2024

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.

justlaputa avatar justlaputa commented on July 20, 2024

Thanks, glad to be helpful!

from jasmine-jquery.

subtubes-io avatar subtubes-io commented on July 20, 2024

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)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.