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

Have GetAge() return -1 if Year is null, and fix return type #6888

Conversation

grayeul
Copy link
Contributor

@grayeul grayeul commented Feb 21, 2024

Description & Issue number it closes

Closes #6887 - Adds return -1 to GetAge() if Year is null

Screenshots (if appropriate)

N/A

How to test the changes?

Perform CSVImport on a small file, with some records having birthdates, and others missing. Be sure to map the correct field to the birthdate field. It should fail before this change, and import successfully after this change.

Type of change

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • This change requires a documentation update

How Has This Been Tested?

Tested as described above, with simple 2-record csv file.

Checklist:

  • My code follows the style guidelines of this project
  • I have performed a self-review of my code
  • I have commented my code, particularly in hard-to-understand areas
  • I have made corresponding changes to the documentation
  • My changes generate no new warnings
  • I have added tests that prove my fix is effective or that my feature works
  • New and existing unit tests pass locally with my changes
  • Any dependent changes have been merged and published in downstream modules

@DAcodedBEAT
Copy link
Contributor

(Probably not for this PR but) at some point, we should probably consolidate on the Family model used throughout the codebase instead of using that and separate one that's just for this page.

@DAcodedBEAT
Copy link
Contributor

It looks like there are a lot of end to end test failures, and it's not the normal flaky offenders - can you look into what's going on there?

@grayeul
Copy link
Contributor Author

grayeul commented Feb 21, 2024

I'm still trying to get where I understand how the end-to-end tests are working, and how to run them on my own. Not there yet. And I really can't see how the change I made should have caused the kinds of errors I see reported in the Package and Build test... and knowing we have had some repeatability issues before... I'm hoping it is related to that -- though I'd love to be able to follow how to do the individual steps and track down the problem.

@DAcodedBEAT
Copy link
Contributor

I'm still trying to get where I understand how the end-to-end tests are working, and how to run them on my own. Not there yet. And I really can't see how the change I made should have caused the kinds of errors I see reported in the Package and Build test... and knowing we have had some repeatability issues before... I'm hoping it is related to that -- though I'd love to be able to follow how to do the individual steps and track down the problem.

This is what I was instructed with when I first started contributing here: #6554 (comment)

I then re-summarized it in the repo itself: /~https://github.com/ChurchCRM/CRM/tree/master/docker#requirements-1

The repeatability issues have historically only been around report generation pages (in that it is flaky and works sometimes) because the testing framework isn't designed to test the exact workflow that we are doing, so it shouldn't be related since this seems more far-reaching.

If you hit issues, let's try to figure it out and update the docs from there!

@grayeul grayeul requested a review from DAcodedBEAT February 24, 2024 00:34
cy.get("input[type='file']").selectFile('cypress/data/test_import.csv')
cy.get("input[type='submit']").click();
cy.contains('Total number of rows in the CSV file:3');
cy.get('#SelField0').select("Last Name",{force:true});
Copy link
Contributor

Choose a reason for hiding this comment

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

@grayeul is force: true necessary here? https://docs.cypress.io/api/commands/select#Force-select seems to indicate that this is only useful for selecting hidden or disabled options, which shouldn't be the case here.

If it is required (and we ensured that we can't avoid it), we should add a comment to explain why we did this

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I would love for someone else to be able to verify that. I couldn't get the select 'action' to work and tried multiple different ways, finally I added the force:true (which I saw in a few other tests) and then it worked! I agree that shouldn't have been necessary, as the fields were not hidden -- but that was my experience. I can add a comment for that.

Copy link
Contributor

Choose a reason for hiding this comment

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

I'm away from my test machine but I wonder if we need to scrollIntoView before selecting

Copy link
Contributor

@DAcodedBEAT DAcodedBEAT Feb 26, 2024

Choose a reason for hiding this comment

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

(Once we either get rid of the force or add a comment for why we did this, even if it's "it only worked when I did this", this PR should be good to merge)

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I don't think that was it... The screen is short, and it looked fine when I used the cypress gui, but still didn't select. I think it should have been in view from the start.

@DAcodedBEAT DAcodedBEAT added this to the 5.6.0 milestone Feb 27, 2024
@DAcodedBEAT DAcodedBEAT merged commit 0d90f08 into master Feb 29, 2024
4 checks passed
@DAcodedBEAT DAcodedBEAT deleted the 6887-bug-csvimport-fails-when-importing-birthdate-if-not-all-records-have-birthdate branch February 29, 2024 00:13
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.

Bug: CSVImport fails when importing birthdate, if not all records have birthdate.
2 participants