Can we write protractor test/scripts in eclipse. Enabling syntax highlighting , intellisense etc. for Javascript in Eclipse.
问题:
回答1:
Yes, you can use protractor plugin in eclipse.
- Go to help-->Marketplace
- Search for tern.java
- Install Tern Eclipse IDE
- and accept the licence.
Now create a project in eclipse
- Right click on project,
- Mouse hover to configure and
- Click on convert to tern project
- Properties window pop-up>> goto Modules
- you will be able to see Protractor,
- Select the check box and click on the Protractor and
- Also check the dependencies as well.
Now you are ready to write scripts using protractor.
回答2:
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