Skip to content

Commit

Permalink
Merge pull request #4189 from lavishaGit/lavisha_WebApp_faq
Browse files Browse the repository at this point in the history
[WV-692 ]Added Ballot Location Page first few testcases
  • Loading branch information
charanya-QA authored Dec 3, 2024
2 parents cac9299 + 637df7b commit 2949336
Show file tree
Hide file tree
Showing 3 changed files with 105 additions and 0 deletions.
4 changes: 4 additions & 0 deletions tests/browserstack_automation/config/wdio.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,11 @@ module.exports.config = {
'../specs/HowItWorks.js',
'../specs/FooterLinks.js',
'../specs/SignInPage.js',

'../specs/BallotPage.js'

'../specs/WhosRunningForOffice.js',

],

capabilities,
Expand Down
42 changes: 42 additions & 0 deletions tests/browserstack_automation/page_objects/ballot.page.js
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();
59 changes: 59 additions & 0 deletions tests/browserstack_automation/specs/BallotPage.js
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();

});
});

0 comments on commit 2949336

Please sign in to comment.