From edb90e1e6261c5b8598c419420e9239a51f635bc Mon Sep 17 00:00:00 2001 From: Crystal Kirscht Date: Thu, 12 Dec 2024 12:48:43 -0600 Subject: [PATCH] Added random number to form name and description --- end2end/tests/testFormEditor.spec.ts | 22 +++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-) diff --git a/end2end/tests/testFormEditor.spec.ts b/end2end/tests/testFormEditor.spec.ts index 4dbb8d59..4b5587c6 100644 --- a/end2end/tests/testFormEditor.spec.ts +++ b/end2end/tests/testFormEditor.spec.ts @@ -9,19 +9,19 @@ let uniqueText = `New Form ${randNum}`; test('Create New Form', async ({ page }) => { await page.goto('https://host.docker.internal/Test_Request_Portal/admin/?a=form_vue#/'); await page.getByRole('button', { name: 'Create Form' }).click(); - await page.getByLabel('Form Name (up to 50').fill('My New Form'); + await page.getByLabel('Form Name (up to 50').fill(uniqueText); await page.getByLabel('Form Name (up to 50').press('Tab'); - await page.getByLabel('Form Description (up to 255').fill('My New Form Description'); + await page.getByLabel('Form Description (up to 255').fill(uniqueText + ' Description'); await page.getByRole('button', { name: 'Save' }).click(); - await expect(page.getByLabel('Form name')).toHaveValue('My New Form'); - await expect(page.getByLabel('Form description')).toHaveValue('My New Form Description'); + await expect(page.getByLabel('Form name')).toHaveValue(uniqueText); + await expect(page.getByLabel('Form description')).toHaveValue(uniqueText + ' Description'); await page.getByRole('link', { name: 'Form Browser' }).click(); - await expect(page.getByRole('link', { name: 'My New Form' })).toBeVisible(); + await expect(page.getByRole('link', { name: uniqueText })).toBeVisible(); }); test('Add Section to Form', async ({ page }) => { await page.goto('https://host.docker.internal/Test_Request_Portal/admin/?a=form_vue#/'); - await page.getByRole('link', { name: 'My New Form' }).click(); + await page.getByRole('link', { name: uniqueText }).click(); await page.getByLabel('Add Section').click(); await page.getByLabel('Section Heading').click(); await page.getByLabel('Section Heading').fill(uniqueText + ' Section'); @@ -31,7 +31,7 @@ test('Add Section to Form', async ({ page }) => { test('Add Question to Form', async ({ page }) => { await page.goto('https://host.docker.internal/Test_Request_Portal/admin/?a=form_vue#/'); - await page.getByRole('link', { name: 'My New Form' }).click(); + await page.getByRole('link', { name: uniqueText }).click(); await page.getByLabel('Add Question to Section').click(); await page.getByLabel('Field Name').click(); await page.getByLabel('Field Name').fill('Are you a VA Employee?'); @@ -46,7 +46,7 @@ test('Add Question to Form', async ({ page }) => { test('Add Sub-Question to Form', async ({ page }) => { await page.goto('https://host.docker.internal/Test_Request_Portal/admin/?a=form_vue#/'); - await page.getByRole('link', { name: 'My New Form' }).click(); + await page.getByRole('link', { name: uniqueText }).click(); await page.getByLabel('add sub-question').click(); await page.getByLabel('Field Name').fill('Supervisor Name'); await page.getByLabel('Short label for spreadsheet').click(); @@ -58,7 +58,7 @@ test('Add Sub-Question to Form', async ({ page }) => { test('Create Pre-Filled If/Then Question', async ({ page }) => { await page.goto('https://host.docker.internal/Test_Request_Portal/admin/?a=form_vue#/'); - await page.getByRole('link', { name: 'My New Form' }).click(); + await page.getByRole('link', { name: uniqueText }).click(); await page.getByText('Modify Logic').last().click(); await page.getByLabel('New Condition').click(); await page.getByLabel('Select an outcome').selectOption('pre-fill'); @@ -82,12 +82,12 @@ test('Create Pre-Filled If/Then Question', async ({ page }) => { test('Delete Form', async ({ page }) => { await page.goto('https://host.docker.internal/Test_Request_Portal/admin/?a=form_vue#/'); - await page.getByRole('link', { name: 'My New Form' }).click(); + await page.getByRole('link', { name: uniqueText }).click(); await expect(page.getByRole('heading', { name: 'Admin  Form Browser  Form' })).toBeVisible(); await page.getByLabel('delete this form').click(); await page.getByRole('button', { name: 'Yes' }).click(); await expect(page.locator('#createFormButton')).toContainText('Create Form'); - await expect(page.getByRole('link', { name: 'My New Form' })).not.toBeVisible(); + await expect(page.getByRole('link', { name: uniqueText })).not.toBeVisible(); });