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(mr): create mr modal #2828

Merged
merged 1 commit into from
May 29, 2024

Conversation

gitdallas
Copy link
Contributor

@gitdallas gitdallas commented May 20, 2024

Closes: RHOAIENG-2230

Description

Create MR form/modal
image

How Has This Been Tested?

Created an MR, checked form cannot be submitted if form validations exist.

Test Impact

  • added cypress tests for access to MR Settings
  • added cypress tests for create MR form validation

Request review criteria:

Modal opens, form looks right, validation shows up. form can be submitted with good content.

Self checklist (all need to be checked):

  • The developer has manually tested the changes and verified that the changes work
  • Commits have been squashed into descriptive, self-contained units of work (e.g. 'WIP' and 'Implements feedback' style messages have been removed)
  • Testing instructions have been added in the PR body (for PRs involving changes that are not immediately obvious).
  • The developer has added tests or explained why testing cannot be added (unit or cypress tests for related changes)

If you have UI changes:

  • Included any necessary screenshots or gifs if it was a UI change.
  • Included tags to the UX team if it was a UI/UX change (find relevant UX in the SMEs section).

After the PR is posted & before it merges:

  • The developer has tested their solution on a cluster by using the image produced by the PR to main

@gitdallas gitdallas requested a review from mturley May 20, 2024 20:42
Copy link

codecov bot commented May 20, 2024

Codecov Report

Attention: Patch coverage is 71.73913% with 26 lines in your changes are missing coverage. Please review.

Project coverage is 77.40%. Comparing base (1c223b6) to head (f28a71a).
Report is 35 commits behind head on main.

Additional details and impacted files

Impacted file tree graph

@@            Coverage Diff             @@
##             main    #2828      +/-   ##
==========================================
- Coverage   77.40%   77.40%   -0.01%     
==========================================
  Files        1101     1102       +1     
  Lines       23176    23264      +88     
  Branches     5843     5870      +27     
==========================================
+ Hits        17940    18008      +68     
- Misses       5236     5256      +20     
Files Coverage Δ
frontend/src/components/FieldList.tsx 93.33% <ø> (ø)
frontend/src/components/PasswordInput.tsx 100.00% <100.00%> (ø)
frontend/src/k8sTypes.ts 100.00% <ø> (ø)
.../environmentVariables/GenericKeyValuePairField.tsx 94.11% <ø> (ø)
...es/modelRegistrySettings/ModelRegistrySettings.tsx 80.00% <66.66%> (+80.00%) ⬆️
...nd/src/pages/modelRegistrySettings/CreateModal.tsx 70.23% <70.23%> (ø)

... and 3 files with indirect coverage changes


Continue to review full report in Codecov by Sentry.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 1c223b6...f28a71a. Read the comment docs.

Signed-off-by: gitdallas <[email protected]>
Copy link
Contributor

@mturley mturley left a comment

Choose a reason for hiding this comment

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

LGTM, one comment that we could leave for another PR if you want.

@mturley
Copy link
Contributor

mturley commented May 29, 2024

Approving, I'll follow up on some minor things we discussed as part of #2829

Copy link
Contributor

openshift-ci bot commented May 29, 2024

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: mturley

The full list of commands accepted by this bot can be found here.

The pull request process is described here

Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@openshift-merge-bot openshift-merge-bot bot merged commit 2d559b3 into opendatahub-io:main May 29, 2024
8 checks passed
Comment on lines +55 to +77
cy.findByText('Create model registry').click();
// Fill in the form with invalid data
cy.get('#mr-name').clear();
cy.get('#mr-host').clear();
cy.get('#mr-port').clear();
cy.get('#mr-username').clear();
cy.get('#mr-password').clear();
cy.get('#mr-database').clear();
cy.get('#mr-database').blur();
// Assert the submit button is disabled
cy.findByTestId('modal-submit-button').should('be.disabled');
// Assert that error messages are displayed
cy.findByTestId('mr-name-error')
.should('be.visible')
.contains(
"Must consist of lower case alphanumeric characters or '-', and must start and end with an alphanumeric character",
);
cy.findByTestId('mr-host-error').should('be.visible').contains('Host cannot be empty');
cy.findByTestId('mr-port-error').should('be.visible').contains('Port cannot be empty');
cy.findByTestId('mr-username-error').should('be.visible').contains('Username cannot be empty');
cy.findByTestId('mr-password-error').should('be.visible').contains('Password cannot be empty');
cy.findByTestId('mr-database-error').scrollIntoView();
cy.findByTestId('mr-database-error').should('be.visible').contains('Database cannot be empty');
Copy link
Contributor

Choose a reason for hiding this comment

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

@dpanshug Selectors should be part of page objects so they are reusable when we get to e2e tests.

Copy link
Contributor

Choose a reason for hiding this comment

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

@christianvogt FYI I addressed this in updates to #2829

Comment on lines +69 to +71
.contains(
"Must consist of lower case alphanumeric characters or '-', and must start and end with an alphanumeric character",
);
Copy link
Contributor

Choose a reason for hiding this comment

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

Asserting static text as defined in in our react components is often a bad idea because it's a 1:1 relationship and will only fail if we change the react component.

Copy link
Contributor

Choose a reason for hiding this comment

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

Ack. I plan to give these tests a second pass as part of adding more in #2829, I'll address this feedback there and request a review from you for that one when it's ready if you don't mind.

Copy link
Contributor

@mturley mturley May 29, 2024

Choose a reason for hiding this comment

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

@christianvogt looking back at this, I think it has value beyond what you're saying -- we shouldn't just assert that components render certain text for the sake of it, but this is trying to assert that the error is shown vs not shown. We could do it with a testid instead if you prefer but imo it doesn't matter much as long as the test is asserting logic and not just content. This test will fail if the form validation logic breaks.

Copy link
Contributor

@christianvogt christianvogt May 29, 2024

Choose a reason for hiding this comment

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

My concern was the contains check and not so much the check that the error node was visible since this is the only available error text that's shown in this node.

Note that if the error text was dynamic from a server response, I would agree with asserting the text presence.

Copy link
Contributor

Choose a reason for hiding this comment

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

@christianvogt FYI I addressed this in updates to #2829

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants