added Protractor for end-to-end testing

This commit is contained in:
alecmerdler 2017-06-06 16:03:13 -07:00
parent 0841d2bfb9
commit 31d518f3e1
6 changed files with 524 additions and 145 deletions

View file

@ -0,0 +1,62 @@
import { element, by, browser, $, ElementFinder, ExpectedConditions as until } from 'protractor';
export class ManageTriggerViewObject {
public sections: {[name: string]: ElementFinder} = {
namespace: $('linear-workflow-section[section-id=namespace]'),
githostrepo: $('linear-workflow-section[section-id=repo][section-title="Select Repository"]'),
customrepo: $('linear-workflow-section[section-id=repo][section-title="Git Repository"]'),
triggeroptions: $('linear-workflow-section[section-id=triggeroptions]'),
dockerfilelocation: $('linear-workflow-section[section-id=dockerfilelocation]'),
contextlocation: $('linear-workflow-section[section-id=contextlocation]'),
robot: $('linear-workflow-section[section-id=robot]'),
verification: $('linear-workflow-section[section-id=verification]'),
};
private customGitRepoInput: ElementFinder = element(by.model('$ctrl.buildSource'));
private dockerfileLocationInput: ElementFinder = this.sections['dockerfilelocation'].$('input');
private dockerfileLocationDropdownButton: ElementFinder = this.sections['dockerfilelocation'].$('button[data-toggle=dropdown');
private dockerContextInput: ElementFinder = this.sections['contextlocation'].$('input');
private dockerContextDropdownButton: ElementFinder = this.sections['contextlocation'].$('button[data-toggle=dropdown');
private robotAccountOptions: ElementFinder = this.sections['robot'].element(by.repeater('$ctrl.orderedData.visibleEntries'));
public continue(): Promise<void> {
return Promise.resolve(element(by.buttonText('Continue')).click());
}
public enterRepositoryURL(url: string): Promise<void> {
browser.wait(until.presenceOf(this.customGitRepoInput));
this.customGitRepoInput.clear();
return Promise.resolve(this.customGitRepoInput.sendKeys(url));
}
public enterDockerfileLocation(path: string): Promise<void> {
browser.wait(until.presenceOf(this.dockerfileLocationInput));
this.dockerfileLocationInput.clear();
return Promise.resolve(this.dockerfileLocationInput.sendKeys(path));
}
public getDockerfileSuggestions(): Promise<string[]> {
return Promise.resolve(this.dockerfileLocationDropdownButton.click())
.then(() => element.all(by.repeater('$ctrl.paths')).map(result => result.getText()));
}
public enterDockerContext(path: string): Promise<void> {
browser.wait(until.presenceOf(this.dockerContextInput));
this.dockerContextInput.clear();
return Promise.resolve(this.dockerContextInput.sendKeys(path));
}
public getDockerContextSuggestions(): Promise<string[]> {
return Promise.resolve(this.dockerContextDropdownButton.click())
.then(() => element.all(by.repeater('$ctrl.contexts')).map(result => result.getText()));
}
public selectRobotAccount(index: number): Promise<void> {
return Promise.resolve(element.all(by.css('input[type=radio]')).get(index).click());
}
}