Skip to content

Commit

Permalink
Test for submitting new requests
Browse files Browse the repository at this point in the history
  • Loading branch information
crystalkirscht committed Jan 6, 2025
1 parent 7cd91fe commit 73bf418
Showing 1 changed file with 62 additions and 0 deletions.
62 changes: 62 additions & 0 deletions end2end/tests/lifecycleNewRequest.spec.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
import { test, expect } from '@playwright/test';

test.describe.configure({ mode: 'serial' });

// Generate unique text to help ensure that fields are being filled correctly.
let randNum = Math.random();
let uniqueText = `My New Form ${randNum}`;

test('Verify New Request Page', async ({ page }) => {
await page.goto('https://host.docker.internal/Test_Request_Portal/');
await page.getByText('New Request', { exact: true }).click();
await expect(page.locator('#record')).toContainText('Step 1 - General Information');
});

test('Create and Submit New Request', async ({ page }) => {
await page.goto('https://host.docker.internal/Test_Request_Portal/?a=newform');
await page.getByRole('cell', { name: 'Select an Option Service' }).locator('a').click();
await page.getByRole('option', { name: 'Concrete Music' }).click();
await page.getByLabel('Title of Request').click();
await page.getByLabel('Title of Request').fill(uniqueText + ' to Create');
await page.locator('label').filter({ hasText: 'Simple form' }).locator('span').click();
await page.getByRole('button', { name: 'Click here to Proceed' }).click();
await expect(page.getByText('1. single line text')).toBeVisible();
await page.getByLabel('single line text').click();
await page.getByLabel('single line text').fill('abc');
await page.locator('#nextQuestion2').click();
await expect(page.locator('#requestTitle')).toContainText(uniqueText);
await expect(page.locator('#data_11_1')).toContainText('abc');
await page.getByRole('button', { name: 'Submit Request' }).click();
await expect(page.getByText('Pending Group A')).toBeVisible();
});

test('Edit Request', async ({ page }) => {
await page.goto('https://host.docker.internal/Test_Request_Portal/?a=newform');
await page.getByRole('cell', { name: 'Select an Option Service' }).locator('a').click();
await page.getByRole('option', { name: 'Concrete Music' }).click();
await page.getByLabel('Title of Request').click();
await page.getByLabel('Title of Request').fill(uniqueText + ' to Edit');
await page.locator('label').filter({ hasText: 'Simple form' }).locator('span').click();
await page.getByRole('button', { name: 'Click here to Proceed' }).click();
await page.getByLabel('single line text').click();
await page.getByLabel('single line text').fill('abc');
await page.locator('#nextQuestion2').click();
await page.getByRole('button', { name: 'Edit this form' }).click();
await page.getByLabel('single line text').click();
await page.getByLabel('single line text').fill('Line 1');
await page.locator('#nextQuestion2').click();
await expect(page.locator('#data_11_1')).toContainText('Line 1');
});

test('Cancel Request', async ({ page }) => {
await page.goto('https://host.docker.internal/Test_Request_Portal/');
await page.getByRole('link', { name: uniqueText + ' to Edit' }).click();
await page.getByRole('button', { name: 'Cancel Request' }).click();
await page.getByPlaceholder('Enter Comment').click();
await page.getByPlaceholder('Enter Comment').fill('No Longer Needed');
await page.getByRole('button', { name: 'Yes' }).click();
await expect(page.locator('#bodyarea')).toContainText('has been cancelled!');
});



0 comments on commit 73bf418

Please sign in to comment.