Skip to content

Commit

Permalink
Test: Implement 0-1C Voters can see their assigned voting rights
Browse files Browse the repository at this point in the history
  • Loading branch information
Sital999 committed Nov 20, 2024
1 parent f43a995 commit 99c796f
Showing 1 changed file with 55 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -165,7 +165,6 @@ test.describe('Vote', () => {
*/

test(`${index + 2}-1E: Active ${user} should be able to vote Yes, No, or Abstain on a poll`, async () => {

// yes vote
await pollPage.voteYesBtn.click();
await expect(userPage.getByTestId('vote-status')).toHaveText('YES');
Expand Down Expand Up @@ -238,3 +237,58 @@ test.describe('Vote', () => {
});
});
});
test.describe('Representative Status', () => {
const users = ['delegate', 'alternate'];
users.forEach((user, index) => {
test.describe('Representative Status', () => {
test.beforeEach(async () => {
await setAllureEpic(
`${index + 2}. Constitutional ${upperCaseFirstLetter(user)}`
);
});

/**
* Description: Delegates and Voters can see whether or not they have been assigned voting rights
*
* User Story: As a delegate or alternate, I want to be able to see whether I am able to vote
*
* Acceptance Criteria:
*
*/

test(`${index + 2}-1B. Once login ${user} should be able to know their voting right status`, async ({
browser,
}) => {
const delegatePage = await newDelegatePage(browser, 3);
const alternatePage = await newAlternatePage(browser, 3);
const pages = user === 'delegate' ? [delegatePage] : [alternatePage];
await Promise.all(
pages.map(async (page) => {
await page.goto('/');
await expect(
page.locator('[data-testid^="active-voter-name-"]').first()
).toBeVisible();
const activeVoter = (
await page
.locator('[data-testid^="active-voter-name-"]')
.allInnerTexts()
)[4];
const delegateName = (
await page
.locator('[data-testid^="delegate-name-"]')
.allInnerTexts()
)[4];
const alternateName = (
await page
.locator('[data-testid^="alternate-name-"]')
.allInnerTexts()
)[4];
console.log(alternateName, delegateName, activeVoter);
expect(activeVoter).toEqual(delegateName);
expect(activeVoter).not.toEqual(alternateName);
})
);
});
});
});
});

0 comments on commit 99c796f

Please sign in to comment.