Instantly share code, notes, and snippets.
Created
August 15, 2017 16:19
-
Save treaz/42fa490a46d7c91db2f7d3ca8fcef66e to your computer and use it in GitHub Desktop.
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
import config from 'config'; | |
import {login} from '../../utils/loginUtil'; | |
import {acceptedCookies} from '../../utils/cookieWallUtil'; | |
const {retryFailedTests} = config.selenium; | |
const MAIN_NAV_SECTION_COUNT = 4; | |
const { | |
SectionHeaderDesktop, | |
SectionSubHeader, | |
SectionNavigationItem, | |
Popup, | |
} = selectors.selectors; | |
describe('Desktop MenuMainLinks Flow', function () { | |
this.retries(retryFailedTests); | |
beforeEach(function () { | |
acceptedCookies(); | |
browser.url('/') | |
// todo: This is just for temporary use, because of the LoginWall for public release. After public you can remove the 3 lines code below in this function | |
login() | |
browser.click(Popup.closeButton) | |
}) | |
afterEach(function () { | |
browser.reload() | |
}); | |
const desktopHeader = SectionHeaderDesktop.root; | |
const desktopSectionLinks = desktopHeader + ' ' + SectionHeaderDesktop.menuMainLinks.sectionLinks; | |
it('TC001 - Validate SectionLinks Telegraaf HomePage', () => { | |
expect(desktopSectionLinks).to.be.visible() | |
const sectionLinks = $$(SectionHeaderDesktop.menuMainLinks.sectionLinks) | |
expect(sectionLinks).to.have.length(MAIN_NAV_SECTION_COUNT) | |
expect(sectionLinks[0].getText()).to.equal('NIEUWS') | |
expect(sectionLinks[1].getText()).to.equal('SPORT') | |
expect(sectionLinks[2].getText()).to.equal('ENTERTAINMENT') | |
expect(sectionLinks[3].getText()).to.equal('FINANCIEEL') | |
}); | |
it.only('TC002 - User navigates to the NIEUWS page', () => { | |
const sectionLinks = $$(SectionHeaderDesktop.menuMainLinks.sectionLinks) | |
const nieuwsButton = sectionLinks[0] | |
nieuwsButton.click() | |
browser.refresh() | |
const subNavigationLinks = $$(SectionNavigationItem) | |
expect(browser.getUrl()).to.match(/nieuws/) | |
// Local workaround until Ticket 3002 is fixed - Enable this snippet to see it work on your Local Machine :7070 | |
// const newsUrl = browser.getUrl(); | |
// browser.url(newsUrl) | |
expect(subNavigationLinks).to.have.length(MAIN_NAV_SECTION_COUNT) | |
expect(subNavigationLinks[0].getText()).to.equal('Overzicht') | |
expect(subNavigationLinks[1].getText()).to.equal('Binnenland') | |
expect(subNavigationLinks[2].getText()).to.equal('Buitenland') | |
expect(subNavigationLinks[3].getText()).to.equal('Opmerkelijk') | |
}); | |
it('TC003 - User navigates to the SPORT page', () => { | |
const sectionLinks = $$(SectionHeaderDesktop.menuMainLinks.sectionLinks) | |
const sportButton = sectionLinks[1] | |
sportButton.click() | |
browser.refresh() | |
const subNavigationLinks = $$(SectionNavigationItem) | |
expect(browser.getUrl()).to.match(/sport/) | |
// Local workaround until Ticket 3002 is fixed - Enable this snippet to see it work on your Local Machine :7070 | |
// const newsUrl = browser.getUrl(); | |
// browser.url(newsUrl) | |
expect(subNavigationLinks).to.have.lengthOf(6) | |
expect(subNavigationLinks[0].getText()).to.equal('Overzicht') | |
expect(subNavigationLinks[1].getText()).to.equal('Voetbal') | |
expect(subNavigationLinks[2].getText()).to.equal('Wielrennen') | |
expect(subNavigationLinks[3].getText()).to.equal('Tennis') | |
expect(subNavigationLinks[4].getText()).to.equal('Autosport') | |
expect(subNavigationLinks[5].getText()).to.equal('Darts') | |
}); | |
it('TC004 - User navigates to the ENTERTAINMENT page', () => { | |
const sectionLinks = $$(SectionHeaderDesktop.menuMainLinks.sectionLinks) | |
const entertainmentButton = sectionLinks[2] | |
entertainmentButton.click() | |
browser.refresh() | |
const subNavigationLinks = $$(SectionNavigationItem) | |
expect(browser.getUrl()).to.match(/entertainment/) | |
// Local workaround until Ticket 3002 is fixed - Enable this snippet to see it work on your Local Machine :7070 | |
// const newsUrl = browser.getUrl(); | |
// browser.url(newsUrl) | |
expect(subNavigationLinks).to.have.length(MAIN_NAV_SECTION_COUNT) | |
expect(subNavigationLinks[0].getText()).to.equal('Overzicht') | |
expect(subNavigationLinks[1].getText()).to.equal('Gossip') | |
expect(subNavigationLinks[2].getText()).to.equal('Sterren') | |
expect(subNavigationLinks[3].getText()).to.equal('Royals') | |
}); | |
it('TC005 - User navigates to the FINANCIEEL page', () => { | |
const sectionLinks = $$(SectionHeaderDesktop.menuMainLinks.sectionLinks) | |
const financieelButton = sectionLinks[3] | |
financieelButton.click() | |
browser.refresh() | |
const subNavigationLinks = $$(SectionNavigationItem) | |
expect(browser.getUrl()).to.match(/financieel/) | |
// Local workaround until Ticket 3002 is fixed - Enable this snippet to see it work on your Local Machine :7070 | |
// const newsUrl = browser.getUrl(); | |
// browser.url(newsUrl) | |
expect(subNavigationLinks[0].getText()).to.equal('Overzicht') | |
expect(subNavigationLinks[1].getText()).to.equal('Koersen') | |
expect(subNavigationLinks[2].getText()).to.equal('Geld') | |
expect(subNavigationLinks[3].getText()).to.equal('Ondernemen') | |
}); | |
it('TC006 - User navigates from SPORT to the TelegraafHomePage', () => { | |
browser.url('/sport/') | |
browser.click(SectionHeaderDesktop.menuMainLinks.telegraafHomeButton) | |
expect(desktopHeader + ' ' + SectionSubHeader).to.not.be.visible() | |
}); | |
it('TC007 - User navigates from FINANCIEEL to the VOORPAGINA page', () => { | |
browser.url('/financieel/') | |
browser.click(SectionHeaderDesktop.menuMainLinks.frontPageButton) | |
expect(desktopHeader + ' ' + SectionSubHeader).to.not.be.visible() | |
}); | |
it('TC008 - User navigates from NIEUWS to the TelegraafHomePage', () => { | |
browser.url('/nieuws/') | |
browser.click(SectionHeaderDesktop.menuMainLinks.telegraafHomeButton) | |
expect(desktopHeader + ' ' + SectionSubHeader).to.not.be.visible() | |
}); | |
it('TC009 - User navigates from ENTERTAINMENT to the VOORPAGINA page', () => { | |
browser.url('/entertainment/') | |
browser.click(SectionHeaderDesktop.menuMainLinks.frontPageButton) | |
expect(desktopHeader + ' ' + SectionSubHeader).to.not.be.visible() | |
}); | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment