Skip to content

Commit

Permalink
Added additional test case to top navigation header bar
Browse files Browse the repository at this point in the history
  • Loading branch information
fdiazq committed Oct 2, 2024
1 parent 1e55aa9 commit 03cc7fb
Show file tree
Hide file tree
Showing 2 changed files with 27 additions and 0 deletions.
9 changes: 9 additions & 0 deletions tests/browserstack_automation/page_objects/topnavigation.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,10 @@ class TopNavigation extends Page {
return $('#candidatesTabHeaderBar');
}

get getChallengesTabLocator () {
return $('#challengesTabHeaderBar');
}

get getDonateTabLocator () {
return $('#donateTabHeaderBar');
}
Expand All @@ -32,6 +36,11 @@ class TopNavigation extends Page {
await this.getCandidatesTabLocator.findAndClick();
}

async toggleChallengesTab () {
await this.getChallengesTabLocator.findAndClick();
}


async toggleDonateTab () {
await this.getDonateTabLocator.findAndClick();
}
Expand Down
18 changes: 18 additions & 0 deletions tests/browserstack_automation/specs/TopNavigation.js
Original file line number Diff line number Diff line change
Expand Up @@ -143,4 +143,22 @@ describe('TopNavigation', () => {
// await driver.switchWindow('Democracy Squads - WeVote');
// await expect(driver).not.toHaveUrl(expect.stringContaining('ready'));
// });

// TopNavigation_011
it('openChallengesTab', async () => {
await ReadyPage.load();
await driver.pause(waitTime);
await TopNavigation.toggleChallengesTab();
await driver.waitUntil(async () => {
// Add condition to check for the expected URL
const currentUrl = await driver.getUrl();
console.log(currentUrl);
return currentUrl.includes('challenges');
}, {
timeout: 10000,
timeoutMsg: 'Expected URL to contain "challenges" not found, timeout after 10000ms',
});
await driver.pause(waitTime);
await expect(driver).not.toHaveUrl(expect.stringContaining('ready'));
});
});

0 comments on commit 03cc7fb

Please sign in to comment.