Skip to content

Commit

Permalink
Test case for Switch Voting Power
Browse files Browse the repository at this point in the history
Should be able to switch active voting power between delegate and alternate
  • Loading branch information
Sital999 committed Nov 14, 2024
1 parent f836415 commit 1f482b2
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 39 deletions.
20 changes: 8 additions & 12 deletions integration_test/lib/pages/representativesPage.ts
Original file line number Diff line number Diff line change
Expand Up @@ -47,22 +47,18 @@ export default class RepresentativesPage {
await this.saveAlternateBtn.click({ force: true });
}

async transferVotePowerToAlternate(): Promise<void> {
async switchVotingPower(): Promise<void> {
await this.goto();
await this.transferVotingPowerBtn.click();
const currentActiveVoter = await this.page
.getByRole('combobox')
.nth(1)
.innerText();
await this.page.getByRole('combobox').nth(1).click();
await this.page
.getByRole('option', { name: 'Alternate' })
.click({ force: true });
await this.saveUpdatedVotingPowerBtn.click();
}

async transferVotePowerToDelegate(): Promise<void> {
await this.goto();
await this.transferVotingPowerBtn.click();
await this.page.getByRole('combobox').nth(1).click();
await this.page
.getByRole('option', { name: 'Delegate' })
.getByRole('option', {
name: currentActiveVoter === 'Delegate' ? 'Alternate' : 'Delegate',
})
.click({ force: true });
await this.saveUpdatedVotingPowerBtn.click();
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,29 +5,6 @@ import { expect } from '@playwright/test';
import { test } from '@fixtures/walletExtension';
import RepresentativesPage from '@pages/representativesPage';
import LoginPage from '@pages/loginPage';
import { types } from 'util';

const workshopInfo = [
{
name: 'Dubai',
delegate_id: BigInt(2),
alternate_id: BigInt(5),
active_vote_id: BigInt(2),
},
{
name: 'Singapore',
delegate_id: BigInt(4),
alternate_id: BigInt(3),
active_vote_id: BigInt(3),
},
{ name: 'Convention Organizer' },
{
name: 'Buenos Aires',
delegate_id: BigInt(8),
alternate_id: BigInt(7),
active_vote_id: BigInt(8),
},
];

test.beforeEach(async () => {
await setAllureEpic('1. Convention Organizers');
Expand Down Expand Up @@ -158,20 +135,19 @@ test.describe('Delegate and Alternate Profile', () => {
});

test.describe('Voting Power', () => {
test('1D. Should transfer voting power from delegate to alternate.', async ({
test('1D. Should be able to switch active voting power between delegate and alternate.', async ({
page,
}) => {
const representativePage = new RepresentativesPage(page);
const loginPage = new LoginPage(page);
await representativePage.transferVotePowerToAlternate();
await representativePage.switchVotingPower();
await expect(page.getByText('Active voter updated!')).toBeVisible();
});

test('1E. Should transfer voting power from alternate to delegate.', async ({
page,
}) => {
const representativePage = new RepresentativesPage(page);
await representativePage.transferVotePowerToDelegate();
await representativePage.switchVotingPower();
await expect(page.getByText('Active voter updated!')).toBeVisible();
});
});

0 comments on commit 1f482b2

Please sign in to comment.