Skip to content
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

feat: mfb v1.1 accept-deny re-prompt #7959

Open
wants to merge 33 commits into
base: develop
Choose a base branch
from
Open

Conversation

kevin9foong
Copy link
Contributor

@kevin9foong kevin9foong commented Nov 29, 2024

Problem

With MFB v1.0, admins are unable to re-try a prompt if they do not like the results from the initial prompt without recreating a new form or deleting all fields.

This is since when a form is generated using MFB prompt, the fields are created and MFB button disappears as it does not show up when fields exist for a form.

Closes FRM-1925

Solution

Allow admins to accept or reject proposed changes generated by Magic Form Builder.

Breaking Changes

No - this PR is backwards compatible

Before & After Screenshots

BEFORE:

AFTER:

Changes Made Screenshot
New Modal Design New Modal Design
Updated Button Placement New Button Placement
Accept and Deny Functionality Accept and Deny Functionality

Tests

TC1: Prompt is able to generate fields for empty form and can deny:

  • Create a new form
  • Use the main MFB button under drag a field or...
  • A modal should open.
  • Enter text prompt.
  • Generate and ensure fields are created and are highlighted + a bottom box appears for accept/deny.
  • Deny the changes.
  • Assert the changes are deleted.

TC2: Prompt is able to generate fields with sample prompts for empty form and can accept:

  • Open the side nav bar for create field.
  • Click on the AI button beside the search bar.
  • A modal should open.
  • Use one of the sample prompts by clicking on one of the buttons below the textarea.
  • Generate and ensure fields are created and are highlighted + a bottom box appears for accept/deny.
  • Accept the changes.
  • Assert the changes are saved.

TC3: Prompt is able to generate fields for form with fields:

  • Repeat the above TC by continuing with a form with existing fields (Eg, form from TC2)

TC4: Can accept/deny even after going out of form

  • Submit a text prompt from form in TC3.
  • It should generate fields and the accept/deny box pops up on the bottom of the page.
  • Do not press accept or deny.
  • Click on all forms on the top left to go back to the forms list.
  • Open another form, ensure that there are no highlighted fields and the bottom hug accept-deny box is not appearing.
  • Go back to all forms and select the form with the generated fields.
  • Ensure the accept-deny re-appears and the correct fields are highlighted.
  • Deny the changes. Ensure that the highlighted fields are deleted.

TC5: Refresh saves the generated fields

  • Use MFB to generate fields. The accept deny box should appear.
  • Hard refresh the page.
  • Assert the accept deny box should disappear and the generated fields are still saved.

@datadog-opengovsg
Copy link

datadog-opengovsg bot commented Dec 23, 2024

Datadog Report

Branch report: feat/mfb-v1.1
Commit report: 37e0940
Test service: formsg

✅ 0 Failed, 119 Passed, 0 Skipped, 27.84s Total duration (6m 32.39s time saved)

Copy link

linear bot commented Dec 30, 2024

@kevin9foong kevin9foong requested a review from KenLSM December 30, 2024 06:27
@kevin9foong
Copy link
Contributor Author

kevin9foong commented Dec 30, 2024

Pending unit test for:

  • assistance to return the field ids provided by createFormFields ✅
  • new delete fields by id on controller / service layer ✅

Pending chromatic story for:

  • new popover (for prompt & accept/deny) ✅
  • new search bar mfb button to right (need to enable for test env) ✅

note: did not write chromatic stories for the highlighted fields indicating accept/deny pending due to difficulties providing decorators for contexts/providers around the component.

@kevin9foong kevin9foong marked this pull request as ready for review December 30, 2024 17:33
@kevin9foong
Copy link
Contributor Author

Since can re-prompt, update form metadata to store # of prompts made per form to track volume of usage

@datadog-opengovsg
Copy link

datadog-opengovsg bot commented Jan 27, 2025

Datadog Report

Branch report: feat/mfb-v1.1
Commit report: 30e6d24
Test service: formsg

✅ 0 Failed, 2178 Passed, 1 Skipped, 5m 4.87s Total duration (1m 58.22s time saved)

@kevin9foong kevin9foong deployed to staging-alt2 January 27, 2025 03:59 — with GitHub Actions Active
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant