awaken
awaken

Reputation: 809

protractor how do you run a single test case?

I'm using protractor 1.8.0 and jasmine 2.1.3 but I can't run a single test when I use ddescribe and then iit. I get:

Message: ReferenceError: iit is not defined

I have a lot of test cases and want to just run 1 for debugging purposes. Is there a way to do this?

Do I need to $npm install jasmine-focused or is it already part of jasmine 2.1.3?

@Aaron I went ahead and uninstalled and reinstall. Ran the test and got the same error. Here is the output after install.

/usr/local/bin/protractor -> /usr/local/lib/node_modules/protractor/bin/protractor
/usr/local/bin/webdriver-manager -> /usr/local/lib/node_modules/protractor/bin/webdriver-manager
[email protected] /usr/local/lib/node_modules/protractor
├── [email protected]
├── [email protected]
├── [email protected]
├── [email protected]
├── [email protected]
├── [email protected]
├── [email protected]
├── [email protected] ([email protected], [email protected])
├── [email protected] ([email protected], [email protected])
├── [email protected]
├── [email protected] ([email protected])
├── [email protected]
├── [email protected] ([email protected], [email protected], [email protected], [email protected], [email protected], [email protected], [email protected], [email protected], [email protected], [email protected], [email protected], [email protected])
├── [email protected] ([email protected])
└── [email protected] ([email protected], [email protected])

Upvotes: 6

Views: 5613

Answers (2)

awaken
awaken

Reputation: 809

Thanks @Aaron for leading me to this. I finally figured out the answer. I had to comment out my declaration of jasmine-reporters in my config file:

/*var jasmineReporters = require('jasmine-reporters'); jasmine.getEnv().addReporter(new jasmineReporters.JUnitXmlReporter({ consolidateAll: true, filePrefix: 'verifi_portal_tests_xmloutput', savePath: './test_results_report' }));*/

It works after I do this. The problem now is how do I include jasmine-reporters and still make fdescribe and fit work.

UPDATE: the correct answer is to update jasmine-reporters from 2.0.4 to 2.0.5. I did this and it fixed the problem.

Upvotes: -1

Aaron
Aaron

Reputation: 2485

The syntax for that as of 2.1 is fdescribe and fit. Source

describe('a test', function() {
    it('spec 1', function() {
        console.log('1');
    });

    it('spec 2', function() {
        console.log('2');
    });

    it('spec 3', function() {
        console.log('3');
    });
});

This will print:

1
.2
.3
.

Meanwhile:

fdescribe('a test', function() {
    it('spec 1', function() {
        console.log('1');
    });

    fit('spec 2', function() {
        console.log('2');
    });

    it('spec 3', function() {
       console.log('3');
    });
});

Will print:

2
.

Upvotes: 6

Related Questions