How can we use protractor in eclipse?

后端 未结 2 1763
孤城傲影
孤城傲影 2020-12-16 07:07

Can we write protractor test/scripts in eclipse. Enabling syntax highlighting , intellisense etc. for Javascript in Eclipse.

2条回答
  •  感情败类
    2020-12-16 07:42

    Adding more content to Nick's answer , after the step 3. Click on convert to tern project you will ask to select the modules, leave the one's that automatically selected and in addition select

    Angular JS Browser Browser extention Protractor Jasmine.

    Then in project level write click and create a new file samfirstspec.js Copy https://www.protractortest.org/#/tutorial the content in Step 0 - write a test

        // samfirstspec.js
    describe('Protractor Demo App', function() {
      it('should have a title', function() {
        browser.get('http://juliemr.github.io/protractor-demo/');
    
        expect(browser.getTitle()).toEqual('Super Calculator');
      });
    });
    

    Next step is creating a configuration file.In project level write click and create a new file Copy the following into myconfig.js

     // conf.js
    exports.config = {
      framework: 'jasmine',
      seleniumAddress: 'http://localhost:4444/wd/hub',
      specs: ['samfirstspec.js']
    }
    

    This configuration tells Protractor where your test files (specs) are, and where to talk to your Selenium Server (seleniumAddress). It specifies that we will be using Jasmine for the test framework. It will use the defaults for all other configuration. Chrome is the default browser.

    The next step is running the script so go to project source code location via cmd

    F:\Learning\Repositories\protractor-sam-test-scripts\EclipsePro

    In cmd type

    protractor myconfig.js

    refer this too - https://www.protractortest.org/#/tutorial

提交回复
热议问题