Skip to content

Commit

Permalink
test(frontend): fix e2e tests after UI refactor (#1847)
Browse files Browse the repository at this point in the history
* fix(dialogTaskActions): use task_event enum to compare btnId

* fix(submissionTable): on task validate, dispatch GOOD event

* fix(featureSelectionPopup): pass geojsonStyles as args

* fix(project): error toast display on error

* feat(submission): api integration for mappedVsValidated task chart

* fix(projectSubmissions: empty dependency add on api call)

* fix(dialogTaskActions): compare with task index

* fix(02-mapper-flow): update test acc to frontend updates
  • Loading branch information
NSUWAL123 authored Nov 4, 2024
1 parent c597522 commit 332b36f
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 8 deletions.
12 changes: 6 additions & 6 deletions src/frontend/e2e/02-mapper-flow.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -37,11 +37,11 @@ test.describe('mapper flow', () => {
// 2. Lock task for mapping
await expect(page.getByRole('button', { name: 'START MAPPING' })).toBeVisible();
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 page.waitForSelector('div:has-text("updated to LOCKED_FOR_MAPPING"):nth-of-type(1)');
await expect(
page
.locator('div')
.filter({ hasText: /updated status to LOCKED_FOR_MAPPING/ })
.filter({ hasText: /updated to LOCKED_FOR_MAPPING/ })
.first(),
).toBeVisible();
await page.getByRole('alert').waitFor({ state: 'hidden' });
Expand All @@ -61,11 +61,11 @@ test.describe('mapper flow', () => {
await page.getByRole('button', { name: 'MARK AS FULLY MAPPED' }).click();
// Required again for the confirmation dialog (0/4 features mapped)
await page.getByRole('button', { name: 'MARK AS FULLY MAPPED' }).click();
await page.waitForSelector('div:has-text("updated status to UNLOCKED_TO_VALIDATE"):nth-of-type(1)');
await page.waitForSelector('div:has-text("has been updated to UNLOCKED_TO_VALIDATE"):nth-of-type(1)');
await expect(
page
.locator('div')
.filter({ hasText: /updated status to UNLOCKED_TO_VALIDATE/ })
.filter({ hasText: /has been updated to UNLOCKED_TO_VALIDATE/ })
.first(),
).toBeVisible();
await page.getByRole('alert').waitFor({ state: 'hidden' });
Expand Down Expand Up @@ -141,11 +141,11 @@ test.describe('mapper flow', () => {

// 3. Validate feature status updated / locked
// 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 page.waitForSelector('div:has-text("has been updated to LOCKED_FOR_MAPPING"):nth-of-type(1)');
await expect(
page
.locator('div')
.filter({ hasText: /updated status to LOCKED_FOR_MAPPING/ })
.filter({ hasText: /has been updated to LOCKED_FOR_MAPPING/ })
.first(),
).toBeVisible();

Expand Down
4 changes: 2 additions & 2 deletions src/frontend/src/components/DialogTaskActions.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -63,11 +63,11 @@ export default function Dialog({ taskId, feature }: dialogPropType) {

useEffect(() => {
if (taskInfo?.length === 0) return;
const currentTaskInfo = taskInfo?.filter((task) => taskId.toString() === task?.task_id);
const currentTaskInfo = taskInfo?.filter((task) => selectedTask?.index === +task?.task_id);
if (currentTaskInfo?.[0]) {
setCurrentTaskInfo(currentTaskInfo?.[0]);
}
}, [taskId, taskInfo]);
}, [taskId, taskInfo, selectedTask]);

useEffect(() => {
if (projectIndex != -1) {
Expand Down

0 comments on commit 332b36f

Please sign in to comment.