-
Notifications
You must be signed in to change notification settings - Fork 310
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'wevote:develop' into updateIdsCamelCasing
- Loading branch information
Showing
12 changed files
with
426 additions
and
33 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
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
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
import { $ } from '@wdio/globals'; | ||
import Page from './page'; | ||
|
||
|
||
class BallotPage extends Page { | ||
constructor () { | ||
super().title = 'Ballot - WeVote'; | ||
} | ||
|
||
get getViewBallotElement () { | ||
return $('(//button[contains(@id, "viewUpcomingBallot")])[1]'); | ||
} | ||
|
||
get getBallotTopElement () { | ||
return $('#ballotTabHeaderBar'); | ||
} | ||
|
||
get getBallotAddressElement () { | ||
return $(' #ballotTitleBallotAddress span'); | ||
} | ||
|
||
get getBallotModalTitleElement () { | ||
return $('#SelectBallotModalTitleId'); | ||
} | ||
|
||
get getBallotModalCloseElement () { | ||
return $('#profileCloseSelectBallotModal'); | ||
} | ||
|
||
get getBallotModalInputElement () { | ||
return $('#entryBox'); | ||
} | ||
|
||
get getBallotModalSaveElement () { | ||
return $('#addressBoxModalSaveButton'); | ||
} | ||
|
||
get getBallotModalCancelElement () { | ||
return $('#addressBoxModalCancelButton'); | ||
} | ||
} | ||
export default new BallotPage(); |
56 changes: 56 additions & 0 deletions
56
tests/browserstack_automation/page_objects/candidates.page.js
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,56 @@ | ||
import { $, $$ } from '@wdio/globals'; | ||
import Page from './page'; | ||
import TopNavigation from './topnavigation'; | ||
|
||
class CandidatesPage extends Page { | ||
async load () { | ||
await super.open(''); | ||
await TopNavigation.toggleCandidatesTab(); | ||
} | ||
|
||
get stateSelect () { | ||
return $("//select[@id='outlined-age-native-simple']"); | ||
} | ||
|
||
get stateSelectOptions () { | ||
return $$("//select[@id='outlined-age-native-simple']//option"); | ||
} | ||
|
||
get pageHeaders () { | ||
return $$('h2#WhatIsHappeningTitle'); | ||
} | ||
|
||
get CandidateCardList () { | ||
return $$("//div[contains(@id,'cardForListBodyWrapper')]"); | ||
} | ||
|
||
async getCandidateCardCandidateName(cardId) { | ||
const candidate = await $(`//div[@id='${cardId}']//a[@id='candidateCardDisplayName' or @id='representativeCardDisplayName']`); | ||
const candidateName = await candidate.getText(); | ||
return candidateName; | ||
} | ||
|
||
async getCandidateCardState(cardId) { | ||
const candidate = await $(`//div[@id='${cardId}']//div[contains(@id,'stateName')]`); | ||
const stateText = await candidate.getText(); | ||
return stateText; | ||
} | ||
|
||
async getCandidateCardPartyName (cardId) { | ||
const candidateParty = await $(`//div[@id='${cardId}']//div[contains(@class,'PoliticalParty')]`); | ||
const candidatePartyExists = await candidateParty.isExisting(); | ||
if (candidatePartyExists) { | ||
const partyText = await candidateParty.getText(); | ||
return partyText; | ||
} else { | ||
return null; | ||
} | ||
} | ||
|
||
async getCandidateCardOffice (cardId) { | ||
const candidateOffice = await $(`//div[@id='${cardId}']//div[contains(@class,'OfficeNameWrapper')]/div`); | ||
const officeText = candidateOffice.getText(); | ||
return officeText; | ||
} | ||
} | ||
export default new CandidatesPage(); |
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,59 @@ | ||
/* eslint-disable no-unused-vars */ | ||
|
||
import { driver, expect, browser } from '@wdio/globals'; | ||
|
||
|
||
|
||
import ReadyPage from '../page_objects/ready.page'; | ||
import BallotPage from '../page_objects/ballot.page'; | ||
|
||
|
||
const { describe, it } = require('mocha'); | ||
|
||
const waitTime = 5000; | ||
const verifyAddressModal = async () => { | ||
await (BallotPage.getBallotAddressElement).click(); | ||
await driver.pause(waitTime); | ||
|
||
await expect(BallotPage.getBallotModalTitleElement).toHaveText('Enter Your Address'); | ||
}; | ||
beforeEach(async function () { | ||
if (this.currentTest.title !== 'verifyBallotPageLinksNavigations') { | ||
// Skip for the specific test case | ||
await ReadyPage.load(); | ||
await driver.maximizeWindow(); | ||
await driver.pause(waitTime); | ||
} | ||
}); | ||
|
||
describe('Ballot Page', async () => { | ||
it('verifyBallotPageLinksNavigations', async () => { | ||
await ReadyPage.load(); | ||
await driver.maximizeWindow(); | ||
await expect(BallotPage.getViewBallotElement).toBeClickable(); | ||
await (BallotPage.getViewBallotElement).click(); | ||
|
||
await expect(browser).toHaveUrl(expect.stringContaining('ballot')); | ||
await expect(BallotPage.getBallotTopElement).toBeClickable(); | ||
await expect(browser).toHaveUrl(expect.stringContaining('ballot')); | ||
}); | ||
|
||
it('verifyBallotAddressLinks', async () => { | ||
await verifyAddressModal(); | ||
await (BallotPage.getBallotModalCloseElement).click(); | ||
await (await BallotPage.getBallotTopElement).click(); | ||
await verifyAddressModal(); | ||
}); | ||
|
||
it('validateBallotModalUIComponents', async () => { | ||
await (await BallotPage.getBallotAddressElement).click(); | ||
|
||
|
||
await expect(BallotPage.getBallotModalInputElement).toBeDisplayed(); | ||
await (await BallotPage.getBallotModalInputElement).click(); | ||
await expect(await BallotPage.getBallotModalInputElement.getAttribute('placeholder')).toBe('Street number, full address and ZIP...'); | ||
await expect(await BallotPage.getBallotModalSaveElement).toBeClickable(); | ||
await expect(await BallotPage.getBallotModalCancelElement).toBeClickable(); | ||
|
||
}); | ||
}); |
Oops, something went wrong.