Basic protractor setup incl. example test
							parent
							
								
									30cc500000
								
							
						
					
					
						commit
						0c11df34bd
					
				| 
						 | 
				
			
			@ -0,0 +1,19 @@
 | 
			
		|||
import {browser, element, by} from 'protractor'
 | 
			
		||||
 | 
			
		||||
describe('angularjs homepage todo list', function() {
 | 
			
		||||
  it('should add a todo', function() {
 | 
			
		||||
    browser.get('https://angularjs.org');
 | 
			
		||||
 | 
			
		||||
    element(by.model('todoList.todoText')).sendKeys('write first protractor test');
 | 
			
		||||
    element(by.css('[value="add"]')).click();
 | 
			
		||||
 | 
			
		||||
    var todoList = element.all(by.repeater('todo in todoList.todos'));
 | 
			
		||||
    expect(todoList.count()).toEqual(3);
 | 
			
		||||
    expect(todoList.get(2).getText()).toEqual('write first protractor test');
 | 
			
		||||
 | 
			
		||||
    // You wrote your first test, cross it off the list
 | 
			
		||||
    todoList.get(2).element(by.css('input')).click();
 | 
			
		||||
    var completedAmount = element.all(by.css('.done-true'));
 | 
			
		||||
    expect(completedAmount.count()).toEqual(2);
 | 
			
		||||
  });
 | 
			
		||||
});
 | 
			
		||||
| 
						 | 
				
			
			@ -0,0 +1,12 @@
 | 
			
		|||
{
 | 
			
		||||
  "extends": "../tsconfig.json",
 | 
			
		||||
  "compilerOptions": {
 | 
			
		||||
    "outDir": "../out-tsc/e2e",
 | 
			
		||||
    "module": "commonjs",
 | 
			
		||||
    "target": "es6",
 | 
			
		||||
    "types":[
 | 
			
		||||
      "jasmine",
 | 
			
		||||
      "node"
 | 
			
		||||
    ]
 | 
			
		||||
  }
 | 
			
		||||
}
 | 
			
		||||
| 
						 | 
				
			
			@ -45,10 +45,12 @@
 | 
			
		|||
    "codelyzer": "~2.0.0-beta.1",
 | 
			
		||||
    "concurrently": "^2.0.0",
 | 
			
		||||
    "jasmine-core": "^2.5.2",
 | 
			
		||||
    "jasmine-spec-reporter": "^3.2.0",
 | 
			
		||||
    "karma": "^1.5.0",
 | 
			
		||||
    "karma-chrome-launcher": "^2.0.0",
 | 
			
		||||
    "karma-jasmine": "^1.1.0",
 | 
			
		||||
    "karma-spec-reporter": "0.0.30",
 | 
			
		||||
    "protractor": "^5.1.1",
 | 
			
		||||
    "ts-node": "1.2.1",
 | 
			
		||||
    "tslint": "^4.3.0",
 | 
			
		||||
    "typescript": "~2.2.1"
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -0,0 +1,30 @@
 | 
			
		|||
// Protractor configuration file, see link for more information
 | 
			
		||||
// https://github.com/angular/protractor/blob/master/lib/config.ts
 | 
			
		||||
 | 
			
		||||
const { SpecReporter } = require('jasmine-spec-reporter');
 | 
			
		||||
 | 
			
		||||
exports.config = {
 | 
			
		||||
  allScriptsTimeout: 11000,
 | 
			
		||||
  specs: [
 | 
			
		||||
    './e2e/**/*.e2e-spec.ts'
 | 
			
		||||
  ],
 | 
			
		||||
  capabilities: {
 | 
			
		||||
    'browserName': 'chrome'
 | 
			
		||||
  },
 | 
			
		||||
  directConnect: true,
 | 
			
		||||
  baseUrl: 'http://localhost:4200/',
 | 
			
		||||
  framework: 'jasmine',
 | 
			
		||||
  jasmineNodeOpts: {
 | 
			
		||||
    showColors: true,
 | 
			
		||||
    defaultTimeoutInterval: 30000,
 | 
			
		||||
    print: function() {}
 | 
			
		||||
  },
 | 
			
		||||
  beforeLaunch: function() {
 | 
			
		||||
    require('ts-node').register({
 | 
			
		||||
      project: 'e2e/tsconfig.e2e.json'
 | 
			
		||||
    });
 | 
			
		||||
  },
 | 
			
		||||
  onPrepare() {
 | 
			
		||||
    jasmine.getEnv().addReporter(new SpecReporter({ spec: { displayStacktrace: true } }));
 | 
			
		||||
  }
 | 
			
		||||
};
 | 
			
		||||
		Loading…
	
		Reference in New Issue