-
Notifications
You must be signed in to change notification settings - Fork 301
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 #4097 from snysmymric/anna-commit-007-discuss
[Issue #WV-615] Reimplemented test 007 Discuss Page
- Loading branch information
Showing
2 changed files
with
35 additions
and
15 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 |
---|---|---|
|
@@ -4,6 +4,7 @@ import DiscussPage from '../page_objects/discuss.page'; | |
const { describe, it } = require('mocha'); | ||
|
||
const waitTime = 5000; | ||
const email = '[email protected]'; | ||
|
||
|
||
describe('Discuss Page', () => { | ||
|
@@ -35,7 +36,7 @@ describe('Discuss Page', () => { | |
await expect(DiscussPage.voterEmailAddressVerificationButton).not.toBeClickable(); | ||
const element = await DiscussPage.enterVoterEmailAddressTextBox; // Locate the text box element using a selector | ||
await driver.pause(waitTime); | ||
element.setValue('[email protected]'); | ||
element.setValue(email); | ||
await driver.pause(waitTime); | ||
await driver.waitUntil(async () => ((DiscussPage.toggleEmailVerificationButton))); | ||
}); | ||
|
@@ -73,23 +74,22 @@ describe('Discuss Page', () => { | |
}); | ||
|
||
// Discuss_007 | ||
it('verifyTabKeySelectenterVoterEmailAddressTextBox', async () => { | ||
it('verifyTabKeySelectEnterVoterEmailAddressTextBox', async () => { | ||
await DiscussPage.load(); | ||
await driver.switchWindow('https://quality.wevote.us/news'); | ||
|
||
const element = await DiscussPage.enterVoterEmailAddressTextBox; // Locate the text box element using a selector | ||
element.setValue('[email protected]'); | ||
// Press the tab key 11 times | ||
for (let i = 0; i < 12; i++) { | ||
driver.keys(['Tab']); | ||
const element = await DiscussPage.enterVoterEmailAddressTextBox; | ||
const elementId = await element.getAttribute('id'); | ||
|
||
const voterEmailAddressTextBox = await DiscussPage.tabToSelectElement(driver, elementId); | ||
if (voterEmailAddressTextBox) { | ||
await voterEmailAddressTextBox.setValue(email); | ||
} else { | ||
throw new Error('Element with ID ' + elementId + ' not found or not reachable while selectig with Tab.'); | ||
} | ||
await driver.pause(waitTime); | ||
// Check if the active element is the email text box after pressing the tab key 11 times | ||
const activeElement = await driver.getActiveElement(); | ||
const activeElementWdio = await (await $(activeElement)).getProperty('id'); | ||
await driver.pause(waitTime); | ||
console.log(activeElementWdio); | ||
await expect(activeElement).toBe(element); | ||
|
||
await expect(DiscussPage.voterEmailAddressVerificationButton).toBeClickable(); | ||
await expect(await element.getAttribute('value')).toBe(email); | ||
}); | ||
|
||
// Test Case Doesn't work | ||
|