DickinsonCollege / FD2School-FarmData2-S23

A fork of FarmData2 that is used for the FarmData2 School Activities.
Other
1 stars 36 forks source link

Tested the Seeding Report Crop Filter #196

Closed Alexandrialexie closed 1 year ago

Alexandrialexie commented 1 year ago

Pull Request Description This pull request checks that the crop filter in the Seeding Report tab works properly. It checks that when the "All" option is selected that multiple crops are in the table and that when one of the other crops is selected that only that crop is in the table. It also checks that only the correct crops are in the crop dropdown for the selected date range.

Closes #187


Licensing Certification

FarmData2 is a Free Cultural Work and all accepted contributions are licensed as described in the LICENSE.md file. This requires that the contributor holds the rights to do so. By submitting this pull request I certify that I satisfy the terms of the Developer Certificate of Origin for its contents.

braughtg commented 1 year ago

Please update the title of this PR to be descriptive of what it is addressing and also provide some additional descriptive content in the body text of the PR. That will help the project maintainers better understand what you are working on. Thanks!

pranavm2109 commented 1 year ago

Hi professor, quick question. I have been trying to test the presence of logs pertaining to the crop CAULIFLOWER in cypress. However, when I am invoking the have.value command to compare it with the expected value (that is 'CAULIFLOWER'), I am getting an AssertionError, stating that the value retrieved was 'CAULIFLOWER ' and not 'CAULIFLOWER'. Why is this the case? Why are there extra spaces at the end of the value retrieved from the table? Can I call a trim method (if it exists) to remove these trailing whitespaces? The error is found in the last line of the third individual test. The last commit does not have that error since I have used contain.text instead of have.text, but I believe that have.text is the correct function to use here since the name of the crops should be exactly the same.

braughtg commented 1 year ago

I am getting an AssertionError, stating that the value retrieved was 'CAULIFLOWER ' and not 'CAULIFLOWER'. Why is this the case?

It does seem like that extra space should not be there. It must be getting added in somewhere along the line. It could be in the database that way, it could that the Seeding Report is adding a space in the computed property that is generating the rows for the table, or it could be that the CustomTableComponent is adding a space when it is put into the <td> element.

I would suggest the following. Use the contain.text assertion in your test as that works sufficiently well. However, as you note it would be better to be able to use has.text. So please also create a new issue in the issue tracker describing the problem in sufficient detail that someone will be able to diagnose it. You should reference your PR in that issue and indicate how your test should change once the issue is resolved.

Then if there is interest, this would be a great thing for your team to investigate and try to resolve.

braughtg commented 1 year ago

Nicely done!