Skip to content
This repository has been archived by the owner on Aug 17, 2023. It is now read-only.

Seeding Report: Test Cancel Seeding Log Edit #202

Open
braughtg opened this issue Apr 11, 2023 · 9 comments
Open

Seeding Report: Test Cancel Seeding Log Edit #202

braughtg opened this issue Apr 11, 2023 · 9 comments
Assignees
Labels
testing Issue related to testing FarmData2 functionality

Comments

@braughtg
Copy link
Member

braughtg commented Apr 11, 2023

The Seeding Report allows the values within a seeding log (i.e. a row) to be edited by clicking the “Edit” button (i.e. the blue pencil button). When a row is being edited the “Edit” button changes to two buttons. The “Save” button (the green check mark) will save the changes to the database. The “Cancel” button (the brown X) discards any edits and does not change the database.

Notes:

  • The test must enter data into the form and use the “Submit” button
  • The test should not use the Seeding Report to check that the database was not changed.
  • The test must use appropriate FarmOSAPI functions to:
    • check that the database was not changed.
  • If you find that you have scrambled the database you can always reset to the default sample database running the command setDB sample in a Terminal in the development environment.

Resources:

  • The examples in the dbtest sub-tab of the FD2 Example tab will be helpful. These should be studied and understood before beginning coding for this issue.
  • The source for the examples can be found in farmdat2/farmdata2_modules/fd2_example/dbtest.

Additional Information:

Some additional notes relevant to this issue:

  • The .spec.js file containing your test should be stored in an appropriate location and have a short but descriptive name. Use the locations and an naming from the "Good First issues" as examples.
  • The .spec.js file should include a comment at the top that describes what the file as a whole is testing.
  • The message for the describe should describe in a short phrase what the file is testing.
  • After logging in and visiting the desired page the beforeEach method should call cy.waitForPage(). This will ensure that the page is fully loaded (e.g. that all the Maps used by the page are loaded) before performing any tests.
  • It is not necessary to include a separate it for each of the things to be tested.
    • You should decide how to divide the things being tested into its so that each it tests a cohesive set of things.
    • The message for each it should describe in a short phrase what the it is testing.
  • The .spec.js files in the farmdata2/farmdata2_modules/fd2_example/ sub-tabs (e.g. ui, api) may provide some helpful examples.
  • These tests should utilize logs that are in the sample database. Information about the data contained in the sample database can be found in the "The Sample Database" section of the docker/sampleDB/README.md file.
@braughtg braughtg added the testing Issue related to testing FarmData2 functionality label Apr 11, 2023
@Shahir-47
Copy link

I would like to work on this!

2 similar comments
@JinLeeGG
Copy link

I would like to work on this!

@won369369
Copy link

I would like to work on this!

@Shahir-47
Copy link

Hi @braughtg and @johnmaccormick, the seeding report does not show the edit button if the window width or height is less than 900 pixels. So it doesn't show the edit button on my laptop.

image

Here's the code for the custom table:
<custom-table data-cy="report-table" :columns="tableColumns" :rows='tableRows' csv-name="seedingReport_" @row-deleted="deleteRowLog" @row-edited='updateRow' @edit-clicked='disableFilters' @edit-canceled='enableFilters' :can-edit='!isMobile' :can-delete='!isMobile'></custom-table>

You can see that the property 'isMobile' needs to be false in order for the prop canEdit to be true. The if condition given below tells that the width and height needs to be greater than or equal to 900 pixels which isn't possible on my device.

if (window.screen.width < 900 || window.screen.height < 900) { this.isMobile = true }

When I change the pixels in the if condition to 500 pixels like shown below:

if (window.screen.width < 500 || window.screen.height < 500) { this.isMobile = true }

The edit button is now clearly visible:

image

For now, I've changed the if condition in the .html file so I can do cypress tests on my laptop but will change it back to how it was previously.

@Shahir-47
Copy link

I found another issue with the seeding report @braughtg @johnmaccormick,

When I press the edit button and select the drop-down menu for the crop, the crop names are repeated twice. For example, the crop name BEET is repeated twice in the drop-down menu as you can see in the screenshots below:

image
image

I also used Vue to check the custom table component and found that the second column has a dropdown option with an array that has 222 crop names. I remember from our previous assignment that there were only 111 crop names.

image

In that array you can clearly see down below that the element 0 and element 111 are clearly repeated,

image

image

Because of these duplications, my cypress tests fail.

@braughtg
Copy link
Member Author

braughtg commented May 3, 2023

the seeding report does not show the edit button if the window width or height is less than 900 pixels. So it doesn't show the edit button on my laptop.

Thanks for pointing this out and adding additional information about the location of the issue and a work around. This seems to be the same issue reported in #230 and in the Upstream FarmData2 at DickinsonCollege#592.

I have seen this issue as well and it has also been reported on screens that render widths > 900 pixels. So, I suspect that your laptop probably does allow rendering of widths greater than 900 pixels, suggesting that this issue is being caused by the way that the browser is reporting widths rather than the 900 number specifically. That said, the workaround you suggest works well for testing at this point.

When you finish the tests, I hope you will consider working on a full solution to #230.

@braughtg
Copy link
Member Author

braughtg commented May 3, 2023

When I press the edit button and select the drop-down menu for the crop, the crop names are repeated twice.

Good catch! @Shahir-47, would you be willing to create an issue for this bug in the Upstream FarmData2 issue tracker (https://github.com/DickinsonCollege/FarmData2/issues)? That would be super helpful in getting it fixed in the live project.

Once you post the issue, I hope your team will consider working on fixing it!

There was a similar issue with the Areas dropdown in the SeedingInput form (DickinsonCollege#460) which was fixed by PR DickinsonCollege#461. There may be some useful insights there.

@Shahir-47
Copy link

Hi @braughtg, I created a new issue #235 for the duplicate crop names in the dropdown menu.

@Shahir-47
Copy link

@braughtg @johnmaccormick , I fixed the issue #235 and is ready to be reviewed at #237.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
testing Issue related to testing FarmData2 functionality
Projects
None yet
Development

No branches or pull requests

4 participants