added end-to-end tests for cor-tabs in image repo view

This commit is contained in:
alecmerdler 2017-06-26 16:43:18 -07:00
parent 8c03a6be31
commit f78e1fb679
3 changed files with 86 additions and 5 deletions

View file

@ -6,4 +6,8 @@ export class CorTabsViewObject {
public selectTabByTitle(title: string): Promise<void> {
return Promise.resolve($(`cor-tab[tab-title="${title}"] a`).click());
}
public isActiveTab(title: string): Promise<boolean> {
return Promise.resolve($(`cor-tab[tab-title="${title}"] .cor-tab-itself.active`).isPresent());
}
}

View file

@ -28,24 +28,101 @@ describe("Image Repository", () => {
});
describe("information tab", () => {
const tabTitle: string = 'Information';
beforeAll((done) => {
repoTabs.selectTabByTitle('Information').then(() => 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('Tags').then(() => done());
repoTabs.selectTabByTitle(tabTitle).then(() => done());
});
it("displays repository description", () => {
expect(element(by.cssContainingText('h4', 'Description')).isDisplayed()).toBe(true);
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);
});
});
});

View file

@ -60,7 +60,7 @@ export const config: Config = {
browser.close();
},
specs: [
'./e2e/sanity.scenario.ts',
// './e2e/sanity.scenario.ts',
// './e2e/trigger-creation.scenario.ts',
'./e2e/image-repo.scenario.ts',
],