initial import for Open Source 🎉
This commit is contained in:
parent
1898c361f3
commit
9c0dd3b722
2048 changed files with 218743 additions and 0 deletions
128
static/test/e2e/image-repo.scenario.ts
Normal file
128
static/test/e2e/image-repo.scenario.ts
Normal file
|
@ -0,0 +1,128 @@
|
|||
import { browser, element, by, $, $$ } from 'protractor';
|
||||
import { appHost } from '../protractor.conf';
|
||||
import { CorTabsViewObject } from '../../js/directives/ui/cor-tabs/cor-tabs.view-object';
|
||||
|
||||
|
||||
describe("Image Repository", () => {
|
||||
const username = 'devtable';
|
||||
const password = 'password';
|
||||
const repoTabs: CorTabsViewObject = new CorTabsViewObject();
|
||||
|
||||
beforeAll((done) => {
|
||||
browser.waitForAngularEnabled(false);
|
||||
|
||||
// Sign in
|
||||
browser.get(appHost);
|
||||
$$('a[href="/signin/"]').get(1).click();
|
||||
$('#signin-username').sendKeys(username);
|
||||
$('#signin-password').sendKeys(password);
|
||||
element(by.partialButtonText('Sign in')).click();
|
||||
browser.sleep(4000);
|
||||
|
||||
// Navigate to image repository
|
||||
browser.get(`${appHost}/repository/devtable/simple`).then(() => done());
|
||||
});
|
||||
|
||||
afterAll(() => {
|
||||
browser.waitForAngularEnabled(true);
|
||||
});
|
||||
|
||||
describe("information tab", () => {
|
||||
const tabTitle: string = 'Information';
|
||||
|
||||
beforeAll((done) => {
|
||||
repoTabs.selectTabByTitle(tabTitle).then(() => done());
|
||||
});
|
||||
|
||||
it("displays repository description", () => {
|
||||
expect(repoTabs.isActiveTab(tabTitle)).toBe(true);
|
||||
expect(element(by.cssContainingText('h4', 'Description')).isDisplayed()).toBe(true);
|
||||
});
|
||||
});
|
||||
|
||||
describe("tags tab", () => {
|
||||
const tabTitle: string = 'Tags';
|
||||
|
||||
beforeAll((done) => {
|
||||
repoTabs.selectTabByTitle(tabTitle).then(() => done());
|
||||
});
|
||||
|
||||
it("displays repository tags", () => {
|
||||
expect(repoTabs.isActiveTab(tabTitle)).toBe(true);
|
||||
expect(element(by.cssContainingText('.tab-header', 'Repository Tags')).isDisplayed()).toBe(true);
|
||||
});
|
||||
});
|
||||
|
||||
describe("tag history tab", () => {
|
||||
const tabTitle: string = 'Tag History';
|
||||
|
||||
beforeAll((done) => {
|
||||
repoTabs.selectTabByTitle(tabTitle).then(() => done());
|
||||
});
|
||||
|
||||
it("displays repository tags", () => {
|
||||
expect(repoTabs.isActiveTab(tabTitle)).toBe(true);
|
||||
expect(element(by.cssContainingText('.tab-header', 'Tag History')).isDisplayed()).toBe(true);
|
||||
});
|
||||
});
|
||||
|
||||
describe("builds tab", () => {
|
||||
const tabTitle: string = 'Builds';
|
||||
|
||||
beforeAll((done) => {
|
||||
repoTabs.selectTabByTitle(tabTitle).then(() => done());
|
||||
});
|
||||
|
||||
it("displays repository tags", () => {
|
||||
expect(repoTabs.isActiveTab(tabTitle)).toBe(true);
|
||||
expect(element(by.cssContainingText('.tab-header', 'Repository Builds')).isDisplayed()).toBe(true);
|
||||
});
|
||||
});
|
||||
|
||||
describe("usage logs tab", () => {
|
||||
const tabTitle: string = 'Usage Logs';
|
||||
|
||||
beforeAll((done) => {
|
||||
repoTabs.selectTabByTitle(tabTitle).then(() => done());
|
||||
});
|
||||
|
||||
it("displays repository tags", () => {
|
||||
expect(repoTabs.isActiveTab(tabTitle)).toBe(true);
|
||||
expect(element(by.cssContainingText('h3', 'Usage Logs')).isDisplayed()).toBe(true);
|
||||
});
|
||||
});
|
||||
|
||||
describe("settings tab", () => {
|
||||
const tabTitle: string = 'Settings';
|
||||
|
||||
beforeAll((done) => {
|
||||
repoTabs.selectTabByTitle(tabTitle).then(() => done());
|
||||
});
|
||||
|
||||
it("displays repository tags", () => {
|
||||
expect(repoTabs.isActiveTab(tabTitle)).toBe(true);
|
||||
expect(element(by.cssContainingText('.tab-header', 'Settings')).isDisplayed()).toBe(true);
|
||||
});
|
||||
});
|
||||
|
||||
describe("tabs navigation", () => {
|
||||
|
||||
beforeAll((done) => {
|
||||
repoTabs.selectTabByTitle('Information');
|
||||
repoTabs.selectTabByTitle('Tags');
|
||||
done();
|
||||
});
|
||||
|
||||
it("back button returns to previous tab", () => {
|
||||
browser.navigate().back();
|
||||
|
||||
expect(repoTabs.isActiveTab('Information')).toBe(true);
|
||||
});
|
||||
|
||||
it("forward button returns to next tab", () => {
|
||||
browser.navigate().forward();
|
||||
|
||||
expect(repoTabs.isActiveTab('Tags')).toBe(true);
|
||||
});
|
||||
});
|
||||
});
|
19
static/test/e2e/sanity.scenario.ts
Normal file
19
static/test/e2e/sanity.scenario.ts
Normal file
|
@ -0,0 +1,19 @@
|
|||
import { browser } from 'protractor';
|
||||
import { appHost } from '../protractor.conf';
|
||||
|
||||
|
||||
describe("sanity test", () => {
|
||||
|
||||
beforeEach(() => {
|
||||
browser.get(appHost);
|
||||
});
|
||||
|
||||
it("loads home view with no AngularJS errors", () => {
|
||||
browser.manage().logs().get('browser')
|
||||
.then((browserLog: any) => {
|
||||
browserLog.forEach((log: any) => {
|
||||
expect(log.message).not.toContain("angular");
|
||||
});
|
||||
});
|
||||
});
|
||||
});
|
154
static/test/e2e/trigger-creation.scenario.ts
Normal file
154
static/test/e2e/trigger-creation.scenario.ts
Normal file
|
@ -0,0 +1,154 @@
|
|||
import { browser, element, by, $, $$ } from 'protractor';
|
||||
import { ManageTriggerViewObject } from '../../js/directives/ui/manage-trigger/manage-trigger.view-object';
|
||||
import { appHost } from '../protractor.conf';
|
||||
|
||||
|
||||
describe("Trigger Creation", () => {
|
||||
const username = 'devtable';
|
||||
const password = 'password';
|
||||
var manageTriggerView: ManageTriggerViewObject = new ManageTriggerViewObject();
|
||||
|
||||
beforeAll((done) => {
|
||||
browser.waitForAngularEnabled(false);
|
||||
|
||||
// Sign in
|
||||
browser.get(appHost);
|
||||
$$('a[href="/signin/"]').get(1).click();
|
||||
$('#signin-username').sendKeys(username);
|
||||
$('#signin-password').sendKeys(password);
|
||||
element(by.partialButtonText('Sign in')).click();
|
||||
browser.sleep(4000).then(() => done());
|
||||
});
|
||||
|
||||
afterAll(() => {
|
||||
browser.waitForAngularEnabled(true);
|
||||
});
|
||||
|
||||
describe("for custom git", () => {
|
||||
|
||||
beforeAll(() => {
|
||||
// Navigate to trigger setup
|
||||
browser.get(`${appHost}/repository/devtable/simple?tab=builds`)
|
||||
});
|
||||
|
||||
it("can select custom git repository push as a trigger option", (done) => {
|
||||
element(by.buttonText('Create Build Trigger')).click();
|
||||
element(by.linkText('Custom Git Repository Push')).click();
|
||||
browser.sleep(1000);
|
||||
done();
|
||||
});
|
||||
|
||||
it("shows custom git repository section first", () => {
|
||||
expect(manageTriggerView.sections['customrepo'].isDisplayed()).toBe(true);
|
||||
});
|
||||
|
||||
it("does not accept invalid custom git repository URL's", () => {
|
||||
manageTriggerView.continue()
|
||||
.then(() => fail('Should not accept empty input for repository URL'))
|
||||
.catch(() => manageTriggerView.enterRepositoryURL('git@some'))
|
||||
.then(() => manageTriggerView.continue())
|
||||
.then(() => fail('Should not accept invalid input for repository URL'))
|
||||
.catch(() => null);
|
||||
});
|
||||
|
||||
it("proceeds to Dockerfile location section when given valid URL", () => {
|
||||
manageTriggerView.enterRepositoryURL('git@somegit.com:someuser/somerepo.git');
|
||||
manageTriggerView.continue()
|
||||
.then(() => {
|
||||
expect(manageTriggerView.sections['dockerfilelocation'].isDisplayed()).toBe(true);
|
||||
})
|
||||
.catch(reason => fail(reason));
|
||||
});
|
||||
|
||||
it("does not accept Dockerfile location that does not end with a filename", () => {
|
||||
manageTriggerView.enterDockerfileLocation('/')
|
||||
.then(() => manageTriggerView.continue())
|
||||
.then(() => fail('Should not accept Dockerfile location that does not end with a filename'))
|
||||
.catch(() => null);
|
||||
});
|
||||
|
||||
it("does not provide Dockerfile location suggestions", () => {
|
||||
manageTriggerView.getDockerfileSuggestions()
|
||||
.then((results) => {
|
||||
expect(results.length).toEqual(0);
|
||||
});
|
||||
});
|
||||
|
||||
it("proceeds to Docker context location section when given a valid Dockerfile location", () => {
|
||||
manageTriggerView.enterDockerfileLocation('/Dockerfile')
|
||||
.then(() => manageTriggerView.continue())
|
||||
.then(() => {
|
||||
expect(manageTriggerView.sections['contextlocation'].isDisplayed()).toBe(true);
|
||||
})
|
||||
.catch(reason => fail(reason));
|
||||
});
|
||||
|
||||
it("does not accept invalid Docker context", () => {
|
||||
manageTriggerView.enterDockerContext('')
|
||||
.then(() => manageTriggerView.continue())
|
||||
.then(() => fail('Should not acccept invalid Docker context location'))
|
||||
.catch(() => null);
|
||||
});
|
||||
|
||||
it("provides suggestions for Docker context based on Dockerfile location", () => {
|
||||
manageTriggerView.getDockerContextSuggestions()
|
||||
.then((results) => {
|
||||
expect(results).toContain('/');
|
||||
});
|
||||
});
|
||||
|
||||
it("proceeds to robot selection section when given valid Docker context", () => {
|
||||
manageTriggerView.enterDockerContext('/')
|
||||
.then(() => manageTriggerView.continue())
|
||||
.then(() => {
|
||||
expect(manageTriggerView.sections['robot'].isDisplayed()).toBe(true);
|
||||
})
|
||||
.catch(reason => fail(reason));
|
||||
});
|
||||
|
||||
it("allows selection of optional robot account", () => {
|
||||
manageTriggerView.selectRobotAccount(0)
|
||||
.catch(reason => fail(reason));
|
||||
});
|
||||
|
||||
it("proceeds to verification section", () => {
|
||||
manageTriggerView.continue()
|
||||
.then(() => {
|
||||
expect(manageTriggerView.sections['verification'].isDisplayed()).toBe(true);
|
||||
})
|
||||
.catch(reason => fail(reason));
|
||||
});
|
||||
|
||||
it("displays success message after creating the trigger", () => {
|
||||
manageTriggerView.continue()
|
||||
.then(() => {
|
||||
browser.sleep(2000);
|
||||
expect($('h3').getText()).toEqual('Trigger has been successfully activated');
|
||||
})
|
||||
.catch(reason => fail(reason));
|
||||
});
|
||||
});
|
||||
|
||||
describe("for githost", () => {
|
||||
|
||||
beforeAll(() => {
|
||||
// Navigate to trigger setup
|
||||
browser.get(`${appHost}/repository/devtable/simple?tab=builds`);
|
||||
});
|
||||
|
||||
it("can select GitHub repository push as a trigger option", () => {
|
||||
element(by.partialButtonText('Create Build Trigger')).click();
|
||||
element(by.linkText('GitHub Repository Push')).click();
|
||||
});
|
||||
|
||||
it("redirects to GitHub login page for granting authentication", () => {
|
||||
expect(browser.getCurrentUrl()).toContain('github.com');
|
||||
|
||||
// TODO: Which credentials do we use to login to GitHub?
|
||||
});
|
||||
|
||||
xit("shows namespace select section first", () => {
|
||||
expect(manageTriggerView.sections['namespace'].isDisplayed()).toBe(true);
|
||||
});
|
||||
});
|
||||
});
|
Reference in a new issue