-
Notifications
You must be signed in to change notification settings - Fork 1
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
08f8d2f
commit 4466d43
Showing
3 changed files
with
110 additions
and
0 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
File renamed without changes.
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,81 @@ | ||
import { AppPage } from './app.po'; | ||
import { browser } from 'protractor'; | ||
import { video } from '../src/app/app-data'; | ||
|
||
describe('VideoLoader Lib E2E Tests', function () { | ||
let page: AppPage; | ||
|
||
const browserWaitTimeout = 10000; | ||
|
||
beforeEach(() => { | ||
page = new AppPage(); | ||
page.navigateTo(); | ||
page.scrollTo(); | ||
}); | ||
|
||
afterEach(() => { | ||
// ensure no errors appear in console | ||
browser.manage() | ||
.logs() | ||
.get('browser') | ||
.then((browserLog) => { | ||
expect(browserLog).toEqual([]); | ||
}); | ||
}); | ||
|
||
describe('video not in viewport', () => { | ||
beforeEach(() => page.setWindowSize(400, 580)); | ||
|
||
it('should not load video', () => { | ||
expect(page.isVideoLoaded()).toBeFalsy(); | ||
}); | ||
|
||
}); | ||
|
||
describe('video in viewport', () => { | ||
beforeEach(() => page.setWindowSize(400, 580)); | ||
|
||
it('should load video when in viewport', () => { | ||
expect(page.isVideoLoaded()).toBeFalsy(); | ||
|
||
page.scrollToBottom(); | ||
page.waitForVideoLoaded(); | ||
|
||
expect(page.isVideoLoaded()).toBeTruthy(); | ||
expect(page.getVideoSrc()).toEqual(video.videos[0].url); | ||
}); | ||
|
||
}); | ||
|
||
describe('responsive video', () => { | ||
|
||
it('should load correct video for "xs" device size', () => { | ||
page.setWindowSize(400, 580); | ||
page.scrollToBottom(); | ||
page.waitForVideoLoaded(); | ||
|
||
expect(page.isVideoLoaded()).toBeTruthy(); | ||
expect(page.getVideoSrc()).toEqual(video.videos[0].url); | ||
}); | ||
|
||
it('should load correct video for "md" device size', () => { | ||
page.setWindowSize(768, 580); | ||
page.scrollToBottom(); | ||
page.waitForVideoLoaded(); | ||
|
||
expect(page.isVideoLoaded()).toBeTruthy(); | ||
expect(page.getVideoSrc()).toEqual(video.videos[1].url); | ||
}); | ||
|
||
it('should load correct video for "lg" device size', () => { | ||
page.setWindowSize(1024, 580); | ||
page.scrollToBottom(); | ||
page.waitForVideoLoaded(); | ||
|
||
expect(page.isVideoLoaded()).toBeTruthy(); | ||
expect(page.getVideoSrc()).toEqual(video.videos[2].url); | ||
}); | ||
|
||
}); | ||
|
||
}); |