diff --git a/integration_test/tests/1-convention-organizers/conventionOrganizer.loggedin.spec.ts b/integration_test/tests/1-convention-organizers/conventionOrganizer.loggedin.spec.ts index b35a369..600f37c 100644 --- a/integration_test/tests/1-convention-organizers/conventionOrganizer.loggedin.spec.ts +++ b/integration_test/tests/1-convention-organizers/conventionOrganizer.loggedin.spec.ts @@ -7,77 +7,112 @@ import RepresentativesPage from '@pages/representativesPage'; import HomePage from '@pages/homePage'; import { faker } from '@faker-js/faker'; +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'); }); test.use({ storageState: '.auth/organizer.json', wallet: organizerWallet }); -test.describe('Recognise a Convention Organiser', () => { - test('1H. Must be able to distinguish CO', async ({ page }) => { - await page.goto('/'); - const CreatePollButton = page.getByTestId('create-poll-button').first(); - await expect(CreatePollButton).toBeVisible(); - await expect(CreatePollButton).toHaveText('Create Poll'); - }); -}); test.describe('Polls', () => { - test('1P, Can create poll with valid data', async ({ page }) => { - await page.goto('/'); - const homePage = new HomePage(page); - const pollName = faker.commerce.productName(); - const pollDescription = faker.commerce.productDescription(); - await homePage.createPoll(pollName, pollDescription); - - await expect(page.getByText(pollName)).toBeVisible(); - await expect( - page.getByTestId('poll-status-chip').getByText('Pending') - ).toBeVisible(); - }); -}); - -test.describe('Invitation', () => { - test('1B. Could invite delegates', async ({ page }) => { - await page.goto('/'); - await expect(page).toHaveTitle(CCVT.title); - }); - test('1C. Could invite alternates', async ({ page }) => { - await page.goto('/'); - await expect(page).toHaveTitle(CCVT.title); - }); -}); -test.describe('Poll results', () => { - test('1A. Must not edit poll results.', async ({ page }) => { + /** + * Description + * The Convention Voting Tool (CVT) recognises a Convention Organiser (CO) + * + * User Story + * As a CO I want the CVT to know my status so that I can act on it + * + * Acceptance Criteria + * Given that I am a CO with my wallet connected, When I go to the homepage, Then I see the "create poll" button + */ + test('1A. Given connected as CO can see create poll button', async ({ page }) => { await page.goto('/'); - await expect(page).toHaveTitle(CCVT.title); + const CreatePollButton = page.getByTestId('create-poll-button').first(); + await expect(CreatePollButton).toBeVisible(); + await expect(CreatePollButton).toHaveText('Create Poll'); }); - - test('1J. Must display vote count durin open poll.', async ({ page }) => { - await page.goto('/'); - await expect(page).toHaveTitle(CCVT.title); + /** + * Description + * Convention Organisers can create a poll + * + * User Story + * As a CO I want the CVT to give me the option to create a poll, so that I can begin the process of creating a poll. + * + * Acceptance Criteria + * Given that I am a CO on the homepage with my wallet connected, when I click the "create poll" button, Then I will go to the create poll page + */ + test('1B, Given connected as CO can create a new poll', async ({ page, browser }) => { + await page.goto('/'); + const homePage = new HomePage(page); + const pollName = faker.commerce.productName(); + const pollDescription = faker.commerce.productDescription(); + await homePage.createPoll(pollName, pollDescription); + + await expect(page.getByText(pollName)).toBeVisible(); + await expect( + page.getByTestId('poll-status-chip').getByText('Pending') + ).toBeVisible(); }); - test('1K. Should display vote count after poll ending.', async ({ page }) => { - await page.goto('/'); - await expect(page).toHaveTitle(CCVT.title); + /** + * Description: A convention organiser will be able to open a poll to make it available to vote on my delegates and alternates + * + * User Stories: As a CO, I want to open a poll, so that those who are eligible to vote can do so. + * + * Acceptance Criteria: Given that I am a CO on the poll's page, and the poll is in 'pending' status, then when I click the "open poll" button then the poll is opened. + */ + test('1C, Given connected as CO can open poll', async ({ page, browser }) => { + throw new Error("Not Implemented") }); + /** + * Description: If a poll is open then a CO can close it + * + * User Story: As a CO, I want to be able to close a poll so that the results can be calculated + * + * Acceptance Criteria: Given that I am a CO on the page of a poll that is in "Open" status, when I click "Close Poll" then the poll is closed. + */ + test('1D, Given connected as CO can create a new poll', async ({ page, browser }) => { + throw new Error("Not Implemented") - test('1L. Must open polls only after delegates are ready.', async ({ - page, - }) => { - await page.goto('/'); - await expect(page).toHaveTitle(CCVT.title); }); + /** + * Description: Once a poll has been closed to voting it cannot be re-opened, and no further votes will be accepted. + * + * User Story: As a CO, I do not want to be able to reopen a poll, so that there is no suggestion of vote manipulation. + * + * Acceptance Criteria: Given that I am on the page of a closed poll, then there is no button or any other way for me to re-open it. + */ + test('1E, Given connected as CO can create a new poll', async ({ page, browser }) => { + throw new Error("Not Implemented") - test('1M. Must close polls once voting is completed.', async ({ page }) => { - await page.goto('/'); - await expect(page).toHaveTitle(CCVT.title); }); }); -test.describe('Delegates and Alternates Grouped together', () => { + +test.describe('User Info', () => { test('1N. Should have corresponding workspace delegate and alternate in a same row', async ({ page, }) => { @@ -113,10 +148,8 @@ test.describe('Delegates and Alternates Grouped together', () => { ) ); }); -}); - -test.describe('Delegate and Alternate Profile', () => { - test('1F. Must have access to update delegate profile', async ({ page }) => { + // As a convention organiser, I want to be able to update the profile information of a delegate (or alternate) to correct any error or omission. + test('1-Org-Invite: 9. Convention organisers can update delegate profile information ', async ({ page }) => { const represntativePage = new RepresentativesPage(page); await represntativePage.updateDelegateProfile(); await represntativePage.isRepresentativeUpdated(); @@ -124,14 +157,9 @@ test.describe('Delegate and Alternate Profile', () => { await represntativePage.isRepresentativeUpdated(); }); - test('1I. Must have access to create delegate and alternate profile', async ({ - page, - }) => { - await page.goto('/'); - await expect(page).toHaveTitle(CCVT.title); - }); }); + test.describe('Voting Power', () => { test('1D. Should be able to switch active voting power between delegate and alternate.', async ({ page,