-
Notifications
You must be signed in to change notification settings - Fork 311
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #4189 from lavishaGit/lavisha_WebApp_faq
[WV-692 ]Added Ballot Location Page first few testcases
- Loading branch information
Showing
3 changed files
with
105 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
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(); |
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(); | ||
|
||
}); | ||
}); |