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

(test) O3-2224: add tests for text-person-attribute-field.component.tsx #766

Merged
merged 8 commits into from
Aug 26, 2023

Conversation

ayush-AI
Copy link
Contributor

Requirements

Summary

In this PR I have added missing tests for text-person-attribute-field.component.tsx.

Screenshots

None.

Related Issue

O3-2224

None.

Other

One of the test is failing because the validation errors of the input field are not coming in the test ui.

@ayush-AI ayush-AI marked this pull request as draft July 25, 2023 12:38
expect(screen.getByRole('textbox')).toBeInTheDocument();
});

it.skip('validates the input with the provided validationRegex', () => {
Copy link
Contributor Author

@ayush-AI ayush-AI Jul 25, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This test is failing because we are not getting the error in the test UI.

  <div>
    <form
      action="#"
    >
      <div
        class="customField halfWidthInDesktopView"
      >
        <div
          style="margin-bottom: 1rem;"
        >
          <div
            class="cds--layer-two"
          >
            <div
              class="cds--form-item cds--text-input-wrapper"
            >
              <div
                class="cds--text-input__label-wrapper"
              >
                <label
                  class="cds--label"
                  for="attributeId"
                >
                  Referred by (optional)
                </label>
              </div>
              <div
                class="cds--text-input__field-outer-wrapper"
              >
                <div
                  class="cds--text-input__field-wrapper"
                >
                  <input
                    class="cds--text-input cds--text-input--md"
                    id="attributeId"
                    name="attributes.4dd56a75-14ab-4148-8700-1f4f704dc5b0"
                    type="text"
                    value="abc"
                  />
                </div>
              </div>
            </div>
          </div>
        </div>
      </div>
    </form>
  </div>
</body>

  89 |     });
  90 |     screen.debug();
> 91 |     expect(screen.getByText(/Invalid Input/i)).toBeInTheDocument();
     |                   ^
  92 |   });
  93 |

This is the ui that is getting rendered. As you can see there is only input field and no errors indicating that input is not valid.
cc/ @denniskigen @jayasanka-sack @anjula-sack @Piumal1999

@ayush-AI
Copy link
Contributor Author

ayush-AI commented Aug 8, 2023

Thank you so much @denniskigen for the help.

@ayush-AI ayush-AI marked this pull request as ready for review August 8, 2023 13:38
Piumal1999
Piumal1999 previously approved these changes Aug 10, 2023
Copy link
Collaborator

@Piumal1999 Piumal1999 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good to me. Thanks @ayush-AI

@Piumal1999
Copy link
Collaborator

@ayush-AI could you please resolve the conflicts

@ayush-AI
Copy link
Contributor Author

Hi @Piumal1999 I resolved the conflicts have a look.

@Piumal1999 Piumal1999 merged commit 2b33c58 into openmrs:main Aug 26, 2023
6 checks passed
@ayush-AI ayush-AI deleted the text-person branch September 5, 2023 07:00
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.

3 participants