-
Notifications
You must be signed in to change notification settings - Fork 106
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
367e3c5
commit c4ceaa4
Showing
6 changed files
with
87 additions
and
56 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,51 @@ | ||
import {GalleryPage} from './app.po' | ||
import {browser, protractor} from "protractor" | ||
|
||
describe('Gallery', function () { | ||
let page: GalleryPage | ||
|
||
beforeEach(() => { | ||
page = new GalleryPage() | ||
}) | ||
|
||
it('should display the first gallery row', () => { | ||
page.navigateTo() | ||
expect(page.getFirstGalleryRow().isPresent()).toBeTruthy() | ||
}) | ||
|
||
it('should open the image viewer on click of the first image', () => { | ||
page.getFirstImageFromFirstRow().click() | ||
expect(page.getImageInsideViewerIfActive(1).isPresent()).toBeTruthy() | ||
}) | ||
|
||
it('should navigate through the images when using keystrokes', () => { | ||
browser.actions().sendKeys(protractor.Key.RIGHT).perform() | ||
expect(page.getImageInsideViewerIfActive(2).isPresent()).toBeTruthy() | ||
}) | ||
|
||
it('should display the interaction elements inside the viewer correctly', () => { | ||
expect(page.getExitButton().isPresent()).toBeTruthy() | ||
|
||
// buttons only show on hover | ||
browser.actions().mouseMove(page.getImageInsideViewerIfActive(2)).perform() | ||
expect(page.getLeftArrowButton().isPresent()).toBeTruthy() | ||
expect(page.getRightArrowButton().isPresent()).toBeTruthy() | ||
}) | ||
|
||
it('should support swiping images', () => { | ||
browser.actions() | ||
.mouseDown(page.getImageInsideViewerIfActive(2)) | ||
.mouseMove({x: -150, y: 0}) | ||
.mouseUp() | ||
.perform() | ||
|
||
expect(page.getImageInsideViewerIfActive(3).isPresent()).toBeTruthy() | ||
}) | ||
|
||
it('should close the viewer on exit', () => { | ||
page.getExitButton().click() | ||
|
||
browser.wait(protractor.ExpectedConditions.stalenessOf(page.getImageInsideViewerIfActive(3)), 1000) | ||
browser.wait(protractor.ExpectedConditions.stalenessOf(page.getExitButton()), 1000) | ||
}) | ||
}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
import { browser, element, by } from 'protractor'; | ||
|
||
export class GalleryPage { | ||
navigateTo() { | ||
return browser.get(''); | ||
} | ||
|
||
getFirstGalleryRow() { | ||
return element(by.css('gallery > .galleryContainer > .innerGalleryContainer > .imagerow:nth-child(1)')); | ||
} | ||
|
||
getFirstImageFromFirstRow() { | ||
return element(by.css('gallery > .galleryContainer > .innerGalleryContainer > .imagerow:nth-child(1) > img:nth-child(1)')); | ||
} | ||
|
||
getImageInsideViewerIfActive(id : number) { | ||
return element(by.css('viewer > .outerContainer > .imageContainer > div.image.active:nth-child('+id+')')) | ||
} | ||
|
||
getExitButton() { | ||
return element(by.css('viewer > .outerContainer > .buttonContainer > img.action.close')) | ||
} | ||
|
||
getLeftArrowButton() { | ||
return element(by.css('viewer > .outerContainer > img.arrow.left')) | ||
} | ||
|
||
getRightArrowButton() { | ||
return element(by.css('viewer > .outerContainer > img.arrow.right')) | ||
} | ||
} |
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,13 +1,15 @@ | ||
{ | ||
"extends": "../tsconfig.json", | ||
"compilerOptions": { | ||
"outDir": "../out-tsc/app", | ||
"outDir": "../out-tsc/e2e", | ||
"module": "commonjs", | ||
"target": "es5", | ||
"types": [ | ||
"jasmine", | ||
"jasminewd2", | ||
"node" | ||
], | ||
"typeRoots": [ | ||
"../node_modules/@types" | ||
] | ||
} | ||
} | ||
} |