How can we use protractor in eclipse?

后端 未结 2 1757
孤城傲影
孤城傲影 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

    0 讨论(0)
  • 2020-12-16 07:45

    Yes, you can use protractor plugin in eclipse.

    1. Go to help-->Marketplace
    2. Search for tern.java
    3. Install Tern Eclipse IDE
    4. and accept the licence.

    Now create a project in eclipse

    1. Right click on project,
    2. Mouse hover to configure and
    3. Click on convert to tern project
    4. Properties window pop-up>> goto Modules
    5. you will be able to see Protractor,
    6. Select the check box and click on the Protractor and
    7. Also check the dependencies as well.

    Now you are ready to write scripts using protractor.

    0 讨论(0)
提交回复
热议问题