-
-
Notifications
You must be signed in to change notification settings - Fork 46
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
Add Playwright tests for mapper flow #1766
Changes from 5 commits
e9b08b9
f63f2d1
73f3bcb
d8285c3
0970f6b
4035a4a
7275f32
c27b442
bdfdc51
869cdee
174d88c
0cd6615
47b486b
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,68 @@ | ||
import { test, expect } from '@playwright/test'; | ||
|
||
test('entity test', async ({ page }) => { | ||
await page.goto('/'); | ||
await page.getByRole('button', { name: 'Sign in' }).click(); | ||
await page | ||
.getByLabel('', { exact: true }) | ||
.locator('div') | ||
.filter({ hasText: "Temporary AccountIf you're" }) | ||
.nth(3) | ||
.click(); | ||
|
||
// click first project card on the home page | ||
await page.locator('.MuiCardContent-root').first().click(); | ||
|
||
// click on task & assert task popup visibility | ||
await page.waitForTimeout(4000); | ||
await page.locator('canvas').click({ | ||
position: { | ||
x: 388, | ||
y: 220, | ||
}, | ||
}); | ||
await expect(page.getByText('Status: READY')).toBeVisible(); | ||
await expect(page.getByRole('button', { name: 'START MAPPING' })).toBeVisible(); | ||
|
||
// click on entity within task & assert feature popup visibility | ||
await page.waitForTimeout(4000); | ||
await page.locator('canvas').click({ | ||
position: { | ||
x: 387, | ||
y: 211, | ||
}, | ||
}); | ||
await expect(page.getByRole('heading', { name: 'Feature:' })).toBeVisible(); | ||
await expect(page.getByRole('button', { name: 'MAP FEATURE IN ODK' })).toBeEnabled(); | ||
await page.getByRole('button', { name: 'MAP FEATURE IN ODK' }).click(); | ||
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. After this click I think we should expect a console warning that the redirect to protocol We could set a console listener via playwright and check this warning is displayed (it's not a user facing thing, but it helps check the button works as intended) |
||
|
||
// check if task status is updated to locked_for_mapping on entity map | ||
await page.waitForSelector('div:has-text("updated status to LOCKED_FOR_MAPPING"):nth-of-type(1)'); | ||
await expect( | ||
page | ||
.locator('div') | ||
.filter({ hasText: /updated status to LOCKED_FOR_MAPPING/ }) | ||
.first(), | ||
).toBeVisible(); | ||
|
||
// click on task to check if task popup has been updated | ||
await page.waitForTimeout(4000); | ||
await page.locator('canvas').click({ | ||
position: { | ||
x: 411, | ||
y: 171, | ||
}, | ||
}); | ||
|
||
// await page.getByText('Status: LOCKED_FOR_MAPPING').click(); | ||
await expect(page.getByText('Status: LOCKED_FOR_MAPPING')).toBeVisible(); | ||
|
||
// click entity to confirm task is locked | ||
await page.locator('canvas').click({ | ||
position: { | ||
x: 387, | ||
y: 211, | ||
}, | ||
}); | ||
await expect(page.getByRole('button', { name: 'MAP FEATURE IN ODK' })).toBeDisabled(); | ||
}); |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,64 @@ | ||
import { test, expect } from '@playwright/test'; | ||
|
||
test('mapper flow test', async ({ page }) => { | ||
await page.goto('/'); | ||
await page.getByRole('button', { name: 'Sign in' }).click(); | ||
await page | ||
.getByLabel('', { exact: true }) | ||
.locator('div') | ||
.filter({ hasText: "Temporary AccountIf you're" }) | ||
.nth(3) | ||
.click(); | ||
|
||
// click first project card on the home page | ||
await page.locator('.MuiCardContent-root').first().click(); | ||
|
||
// click on task | ||
await page.waitForTimeout(4000); | ||
await page.locator('canvas').click({ | ||
position: { | ||
x: 445, | ||
y: 95, | ||
}, | ||
}); | ||
await expect(page.getByText('Status: READY')).toBeVisible(); | ||
|
||
// STATUS: READY | ||
await page.getByRole('button', { name: 'START MAPPING' }).waitFor({ state: 'visible' }); | ||
await page.getByRole('button', { name: 'START MAPPING' }).click(); | ||
await page.waitForSelector('div:has-text("updated status to LOCKED_FOR_MAPPING"):nth-of-type(1)'); | ||
await expect( | ||
page | ||
.locator('div') | ||
.filter({ hasText: /updated status to LOCKED_FOR_MAPPING/ }) | ||
.first(), | ||
).toBeVisible(); | ||
|
||
//STATUS: LOCKED_FOR_MAPPING | ||
await page.getByRole('button', { name: 'MARK AS FULLY MAPPED' }).click(); | ||
await page.getByRole('button', { name: 'MARK AS FULLY MAPPED' }).click(); | ||
await page.waitForSelector('div:has-text("updated status to MAPPED"):nth-of-type(1)'); | ||
await expect( | ||
page | ||
.locator('div') | ||
.filter({ hasText: /updated status to MAPPED/ }) | ||
.first(), | ||
).toBeVisible(); | ||
|
||
// STATUS: MAPPED | ||
await page.getByRole('button', { name: 'START VALIDATION' }).click(); | ||
await page.getByRole('button', { name: 'FULLY MAPPED' }).click(); | ||
|
||
await page.getByText('has been updated to VALIDATED').waitFor({ state: 'visible' }); | ||
await expect(page.getByText('has been updated to VALIDATED')).toBeVisible(); | ||
|
||
// click on validated task after map renders | ||
await page.waitForTimeout(4000); | ||
await page.locator('canvas').click({ | ||
position: { | ||
x: 445, | ||
y: 95, | ||
}, | ||
}); | ||
await expect(page.getByText('Status: VALIDATED')).toBeVisible(); | ||
}); |
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.
I was checking the test ordering for Playwright
https://playwright.dev/docs/next/test-parallel#control-test-order
It seems they simply run in alphabetical order of the files, so with that in mind I think we should append numbers to some tests like:
This should mean that the project is created first, then the project page can be viewed and tests carried out there