-
Notifications
You must be signed in to change notification settings - Fork 0
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
save workflow test #13
base: main
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
//const{base} | ||
|
||
import{test as baseTest} from "@playwright/test"; | ||
|
||
type WorkflowFixture = { | ||
workflowData:any; | ||
|
||
} | ||
|
||
export const test = baseTest.extend<WorkflowFixture>({ | ||
workflowData:{ | ||
|
||
uniqueText: String, | ||
uniqueDescr: String | ||
|
||
//"Random onr Test 870065a", //`New event ${randNum}`, | ||
|
||
//" Adding some more random description 00875a" //`Adding some random description ${randNum}`, | ||
// eventTitle: uniqueDescription; | ||
} | ||
|
||
}) | ||
|
||
|
||
|
||
export {expect} from "@playwright/test" |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,131 @@ | ||
import{test, expect} from "../fixtures/MyCustomWorkflowFixtures" | ||
|
||
test.use({ | ||
ignoreHTTPSErrors: true | ||
}); | ||
|
||
|
||
test.beforeAll(async ({workflowData})=>{ | ||
let randNum = Math.random(); | ||
workflowData.uniqueText = `New Event ${randNum}`; | ||
workflowData.uniqueDescr = `Adding description ${randNum}`; | ||
|
||
}) | ||
|
||
//Create a New Event | ||
test ('CreateEvent', async ({ page, workflowData}, testinfo) => { | ||
await page.goto('https://host.docker.internal/Test_Request_Portal/admin/?a=workflow'); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This line, and similar lines in other tests are redundant. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. remove the first line from all test |
||
await page.goto('https://host.docker.internal/Test_Request_Portal/admin/?a=workflow&workflowID=1'); | ||
|
||
//Click on the Requestor | ||
await expect(page.getByText('Return to Requestor')).toBeVisible(); | ||
await page.getByText('Return to Requestor').click(); | ||
|
||
//Add a new event | ||
await expect(page.getByRole('button', { name: 'Add Event' })).toBeVisible(); | ||
await page.getByRole('button', { name: 'Add Event' }).click(); | ||
|
||
|
||
// Wait for the Create Event page to load | ||
await expect(page.getByRole('button', { name: 'Save' })).toBeVisible(); | ||
await page.getByRole('button', { name: 'Create Event' }).click(); | ||
|
||
//Enter Data for New Event | ||
|
||
|
||
//await page.getByRole('button', { name: 'Create Event' }).click(); | ||
await page.getByLabel('Event Name:').click(); | ||
await page.getByLabel('Event Name:').fill(workflowData.uniqueText); | ||
await page.getByLabel('Short Description: Notify').fill(workflowData.uniqueDescr); | ||
await page.getByText('Notify Requestor Email: Notify Next Approver Email: Notify Group: None2911 TEST').click(); | ||
await page.getByLabel('Notify Requestor Email:', { exact: true }).check(); | ||
await page.getByLabel('Notify Next Approver Email:', { exact: true }).check(); | ||
await page.getByLabel('Notify Group:', { exact: true }).selectOption('206'); | ||
|
||
await expect(page.getByRole('button', { name: 'Save' })).toBeVisible(); | ||
|
||
//Save Event | ||
await page.getByRole('button', { name: 'Save' }).click(); | ||
|
||
await expect(page.getByRole('button', { name: 'Remove Action' })).toBeVisible(); | ||
|
||
//Verify present | ||
let eventTitle = `Email - ${workflowData.uniqueDescr}`; | ||
await expect(page.locator('#stepInfo_3')).toContainText(eventTitle); | ||
|
||
await page.getByLabel('Close Modal').click(); | ||
|
||
const screenshot = await page.screenshot() | ||
await testinfo.attach('screenshot', { body: screenshot, contentType: 'image/png' }); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The screenshot should be taken prior to closing the modal in order to show the new events. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. added more screenshots |
||
}) | ||
//End of 1st Test (Create New Event) | ||
|
||
// Select Newly Created Event from dropdown | ||
test('Add Event from ddown', async ({ page, workflowData }, testInfo) => { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. |
||
await page.goto('https://host.docker.internal/Test_Request_Portal/admin/?a=workflow'); | ||
await page.goto('https://host.docker.internal/Test_Request_Portal/admin/?a=workflow&workflowID=1'); | ||
await page.locator('#jsPlumb_1_51').click(); | ||
await page.getByRole('button', { name: 'Add Event' }).click(); | ||
await expect(page.getByRole('button', { name: 'Create Event' })).toBeVisible(); | ||
//await page.locator('a'). | ||
|
||
//locate the previous New Event and add it | ||
await expect(page.getByRole('button', { name: 'Save' })).toBeVisible(); | ||
let eventTitle = `Email - ${workflowData.uniqueDescr}`; | ||
await page.getByLabel('Add Event').locator('a').click(); | ||
await page.getByRole('option', { name: eventTitle }).click(); | ||
|
||
|
||
await page.getByRole('button', { name: 'Save' }).click(); | ||
|
||
//Verify New Event is added to the workflow | ||
await expect(page.getByRole('button', { name: 'Remove Action' })).toBeVisible(); | ||
await page.getByText(eventTitle).click(); | ||
|
||
//Close the modal and return | ||
await page.getByLabel('Close Modal').click(); | ||
|
||
const screenshot = await page.screenshot() | ||
await testInfo.attach('screenshot', { body: screenshot, contentType: 'image/png' }); | ||
|
||
|
||
}); | ||
//End of select from ddrown | ||
|
||
//Add Event From Side Bar | ||
test ('Add Event from side bar', async ({ page , workflowData }, testInfo) => { | ||
|
||
//Load Page | ||
await page.goto('https://host.docker.internal/Test_Request_Portal/admin/?a=workflow'); | ||
await page.goto('https://host.docker.internal/Test_Request_Portal/admin/?a=workflow&workflowID=1'); | ||
//Update the unique values | ||
|
||
//Add New Event | ||
await page.getByRole('button', { name: 'Edit Events' }).click(); | ||
await expect(page.getByRole('button', { name: 'Create a new Event' })).toBeVisible(); | ||
|
||
//Enter Data | ||
let uniqueText = `new ${workflowData.uniqueText} `; | ||
let uniqueDescr = `new ${workflowData.uniqueDescr}`; | ||
await page.getByRole('button', { name: 'Create a new Event' }).click(); | ||
await page.getByLabel('Event Name:').click(); | ||
await page.getByLabel('Event Name:').fill(uniqueText); | ||
|
||
await page.getByLabel('Short Description: Notify').fill(uniqueDescr); | ||
await page.getByLabel('Notify Requestor Email:', { exact: true }).check(); | ||
await page.getByLabel('Notify Next Approver Email:', { exact: true }).check(); | ||
await page.getByLabel('Notify Group:', { exact: true }).selectOption('206'); | ||
await page.getByRole('button', { name: 'Save' }).click(); | ||
|
||
await page.getByLabel('List of Events').click(); | ||
//Verify new event is added | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Missing assertion |
||
// await page.getByRole('row', { name: uniqueDescr }).locator('#Email').click(); | ||
// await page.getByRole('button', { name: 'Close' }).click(); | ||
|
||
//Close popup | ||
await page.getByRole('button', { name: 'Close' }).click(); | ||
|
||
|
||
const screenshot = await page.screenshot(); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Same as above. Screenshots are not useful if they don't show the expected change. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. updated |
||
await testInfo.attach('screenshot', { body: screenshot, contentType: 'image/png' }); | ||
}); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
A fixture is probably unnecessary for this purpose. See example.