Untitled
unknown
plain_text
2 years ago
3.9 kB
10
Indexable
test('Create a Ranking poll', async ({ page }) => {
const now = new Date();
const description = 'AT: Creation date in UTC ' + now.toISOString();
await page.getByRole('link', { name: 'Poll Management' }).click();
await page.getByRole('button', { name: 'New Poll' }).click();
await page.getByLabel('Poll').click();
await page.getByLabel('Poll').fill('AT: Create a Ranking poll');
await page.getByLabel('Description').click();
await page.getByLabel('Description').fill(description);
await page.getByLabel('Start Date').fill(startDate);
await page.getByRole('button', { name: 'Done' }).focus();
await page.getByRole('button', { name: 'Done' }).click();
await page.getByLabel('End Date').fill(endDate);
await page.getByRole('button', { name: 'Done' }).focus();
await page.getByRole('button', { name: 'Done' }).click();
await page.getByRole('button', { name: 'Save' }).click();
await expect(await page.getByRole('alert').getByText('Poll submitted')).toBeVisible();
await page.getByRole('button', { name: '' }).click();
await page.getByRole('button', { name: 'New Question' }).click({
timeout: 1500,
});
await page.frameLocator('iframe[title="Question"]').getByLabel('Type').selectOption({ label: 'Ranking' });
await page.frameLocator('iframe[title="Question"]').getByLabel('Question Text').click();
await page.frameLocator('iframe[title="Question"]').getByLabel('Question Text').fill('AT: Ranking poll created?');
await page.frameLocator('iframe[title="Question"]').getByLabel('Question Text').press('Enter');
await page.frameLocator('iframe[title="Question"]').getByRole('button', { name: 'Answers' }).click({
timeout: 2000,
});
await page.waitForTimeout(1000);
await page.frameLocator('iframe[title="Answers"]').getByLabel('Answer', { exact: true }).click();
await page.frameLocator('iframe[title="Answers"]').getByLabel('Answer', { exact: true }).fill('AT: 1st response to Ranking poll.');
await page.frameLocator('iframe[title="Answers"]').getByRole('button', { name: 'Save answer', exact: true }).click();
await page.waitForTimeout(1000);
await page.frameLocator('iframe[title="Question"]').getByRole('button', { name: 'Answers' }).click();
await page.frameLocator('iframe[title="Answers"]').getByLabel('Answer', { exact: true }).click();
await page.frameLocator('iframe[title="Answers"]').getByLabel('Answer', { exact: true }).fill('AT: 2nd response to Ranking poll.');
await page.frameLocator('iframe[title="Answers"]').getByRole('button', { name: 'Save answer' }).click();
await page.waitForTimeout(1000);
await page.frameLocator('iframe[title="Question"]').getByRole('button', { name: 'Apply changes' }).click({
timeout: 1000,
});
await expect(page.getByRole('link', { name: ERROR_MESSAGES[5] }).click()).toBeTruthy();
const name_err = await page.locator('P19_RANKING_error').allInnerTexts();
await expect(name_err[0]).toStrictEqual(ERROR_MESSAGES[5]);
await page.frameLocator('iframe[title="Answers"]').getByLabel('Ranking').click();
await page.frameLocator('iframe[title="Answers"]').getByLabel('Ranking').fill('1');
await page.frameLocator('iframe[title="Question"]').getByRole('button', { name: 'Apply changes' }).click({
timeout: 2000,
});
await page.waitForTimeout(1000);
await page.getByLabel('Status').selectOption('Approved');
await page.getByRole('button', { name: 'Save' }).click({
timeout: 2000,
});
await expect(await page.getByRole('alert').getByText('Poll submitted')).toBeVisible();
await page.getByRole('button', { name: '' }).click();
await page.getByRole('link', { name: 'Poll Management' }).click();
await page.waitForTimeout(2000);
await expect(await page).toHaveURL(/.*poll-management\?session=.*/);
await expect(await page.getByText(description)).toBeVisible();
await page.close();
});Editor is loading...