forked from manuelbl/SwissQRBill
-
Notifications
You must be signed in to change notification settings - Fork 0
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
Showing
4 changed files
with
70 additions
and
5 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,40 @@ | ||
import { ExamplesPage } from './examples.po'; | ||
import { protractor } from 'protractor/built/ptor'; | ||
import { browser, by, element } from 'protractor'; | ||
import { MainPage } from './main.po'; | ||
|
||
describe('Examples Page', () => { | ||
let page: ExamplesPage; | ||
|
||
beforeEach(() => { | ||
page = new ExamplesPage(); | ||
}); | ||
|
||
it('should display examples', () => { | ||
page.navigateTo(); | ||
expect(page.getNumAppExamples()).toBeGreaterThan(3); | ||
expect(page.getAppExample(1)).toBeTruthy(); | ||
expect(page.getAppExample(2)).toBeTruthy(); | ||
expect(page.getAppExample(3)).toBeTruthy(); | ||
expect(page.getAppExample(4)).toBeTruthy(); | ||
}); | ||
|
||
it('should display images', () => { | ||
let EC = protractor.ExpectedConditions; | ||
for (let i = 1; i <= 4; i++) { | ||
browser.wait( | ||
() => browser.executeScript( | ||
"return arguments[0].complete && arguments[0].naturalWidth > 0;", | ||
page.getAppExample(i).element(by.css('img')).getWebElement()), | ||
3000 | ||
); | ||
} | ||
}); | ||
|
||
it('should navigate to main page', () => { | ||
page.getUseButton(2).click(); | ||
browser.waitForAngular(); | ||
let mainPage = new MainPage(); | ||
expect(mainPage.getPreviewButton()).toBeTruthy(); | ||
}); | ||
}); |
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,25 @@ | ||
import { browser, by, element } from 'protractor'; | ||
import { promise } from 'selenium-webdriver'; | ||
import { ElementFinder } from 'protractor/built/element'; | ||
|
||
export class ExamplesPage { | ||
navigateTo(): promise.Promise<any> { | ||
return browser.get('/examples'); | ||
} | ||
|
||
getNavbarText(): promise.Promise<string> { | ||
return element(by.css('app-root .navbar-button')).getText(); | ||
} | ||
|
||
getAppExample(index: number): ElementFinder { | ||
return element(by.css('.examples mat-card:nth-child(' + index + ')')); | ||
} | ||
|
||
getNumAppExamples(): promise.Promise<number> { | ||
return element.all(by.css('.examples mat-card')).count(); | ||
} | ||
|
||
getUseButton(index: number): ElementFinder { | ||
return element(by.css('.examples mat-card:nth-child(' + index + ') button')); | ||
} | ||
} |
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
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