diff --git a/static/js/directives/ui/cor-tabs/cor-tabs.view-object.ts b/static/js/directives/ui/cor-tabs/cor-tabs.view-object.ts index f34e51cd5..c07ea281f 100644 --- a/static/js/directives/ui/cor-tabs/cor-tabs.view-object.ts +++ b/static/js/directives/ui/cor-tabs/cor-tabs.view-object.ts @@ -6,4 +6,8 @@ export class CorTabsViewObject { public selectTabByTitle(title: string): Promise { return Promise.resolve($(`cor-tab[tab-title="${title}"] a`).click()); } + + public isActiveTab(title: string): Promise { + return Promise.resolve($(`cor-tab[tab-title="${title}"] .cor-tab-itself.active`).isPresent()); + } } diff --git a/static/test/e2e/image-repo.scenario.ts b/static/test/e2e/image-repo.scenario.ts index 9e9122334..ff000e3e0 100644 --- a/static/test/e2e/image-repo.scenario.ts +++ b/static/test/e2e/image-repo.scenario.ts @@ -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); }); }); }); diff --git a/static/test/protractor.conf.ts b/static/test/protractor.conf.ts index 1f59fdd12..e69f9753d 100644 --- a/static/test/protractor.conf.ts +++ b/static/test/protractor.conf.ts @@ -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', ],