Skip to content

Commit

Permalink
Write test case for issue 81
Browse files Browse the repository at this point in the history
  • Loading branch information
Sital999 committed Nov 14, 2024
1 parent 12a26f5 commit f836415
Show file tree
Hide file tree
Showing 2 changed files with 64 additions and 1 deletion.
4 changes: 3 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -48,4 +48,6 @@ cloud-sql-proxy
# eslint config
eslint.config.mjs

allure-results
allure-results

.auth/
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,29 @@ 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 @@ -79,6 +102,44 @@ test.describe('Poll results', () => {
});
});

test.describe('Delegates and Alternates Grouped together', () => {
test('1N. Should have corresponding workspace delegate and alternate in a same row', async ({
page,
}) => {
await page.goto('/');
await expect(page.getByRole('row').first()).toBeVisible();
const delegate = await page.getByRole('gridcell').nth(1).innerText();
const alternate = await page.getByRole('gridcell').nth(2).innerText();
const delegatesList = await page
.locator('[data-testid^="delegate-name-"]')
.allInnerTexts();
const alternateList = await page
.locator('[data-testid^="alternate-name-"]')
.allInnerTexts();
expect(delegatesList).toContain(delegate);
expect(alternateList).toContain(alternate);
});

test('1O. Should have workspace_name ordered alphabetically', async ({
page,
}) => {
const workspaceNames = [];
await page.goto('/');
await expect(page.getByRole('row').first()).toBeVisible();
const rows = await page.getByRole('row').all();
rows.shift();
for (const row of rows) {
const workspace = (await row.allInnerTexts())[0].split('\n')[0];
workspaceNames.push(workspace);
}
expect(
workspaceNames.every(
(word, i) => i === 0 || workspaceNames[i - 1].localeCompare(word) <= 0
)
);
});
});

test.describe('Delegate and Alternate Profile', () => {
test('1F. Must have access to update delegate profile', async ({ page }) => {
const represntativePage = new RepresentativesPage(page);
Expand Down

0 comments on commit f836415

Please sign in to comment.