Open braughtg opened 1 year ago
I would like to work on this!
I would like to work on this!
I would like to work on this!
good luck!
The tests described above can only be completed once the user fills in all the required input in the Seeding Input Report. Otherwise, the submit button is disabled and the cancel button is hidden. Should we enter the cypress input code inside each and every it() block or simply in the beforeEach() block?
I've pasted the cypress Input code I was referring to down below. Credits to @JinLeeGG for the Cypress Input code. The code can also be accessed at this link: https://github.com/COMP290-John-Wonje-Shahir/FD2School-FarmData2/blob/log_creation/farmdata2/farmdata2_modules/fd2_field_kit/seedingInput/seedingInput.logCreation.spec.js
//type all inputs into seedingInput report
cy.get('[data-cy=date-select')
.type('2022-10-06')
cy.get('[data-cy=crop-selection] > [data-cy=dropdown-input]')
.select("ARUGULA")
cy.get('[data-cy=tray-seedings]')
.click()
cy.get('[data-cy=tray-area-selection] > [data-cy=dropdown-input]')
.select("CHUAU")
cy.get('[data-cy=num-cell-input] > [data-cy=text-input]')
.type('3')
cy.get('[data-cy=num-tray-input] > [data-cy=text-input]')
.type('3')
cy.get('[data-cy=num-seed-input] > [data-cy=text-input]')
.type('3')
cy.get('[data-cy=num-worker-input] > [data-cy=text-input]')
.type('3')
cy.get('[data-cy=minute-input] > [data-cy=text-input]')
.type('60')
.blur()
@Shahir-47 -- Good question. I don't think it would work as a single beforeEach(), because there are certain differences in some of the tests, such as whether you select the tray seeding or direct seeding. On the other hand, you will end up with an awful lot of repeated code if none of it is factored out. For now, I suggest take the simple approach of pasting all the needed code directly into each it() separately. Later, if Professor Braught @braughtg has another suggestion, you can adapt based on that.
For now, I suggest take the simple approach of pasting all the needed code directly into each it() separately.
This sounds like a good initial approach. Then once you have the tests written, working and refined, I would suggest identifying the code that is repeated in each it
and moving any of it that can be done at the start of every it
to the beforeEach
. That will simplify your tests and make them easier for future readers to follow.
Thanks for the suggestion @johnmaccormick and @braughtg. I'll wait until all of tests are written and then move the repeated code from every it() block to the beforeEach() block as suggested.
The Seeding Input form on the FieldKit tab is used to create new seeding logs in the database.
When the Seeding Input form is completed and the “Submit” button is clicked, the user is presented with “Confirm” and “Cancel” buttons.
This test must confirm that when the “Cancel” button is clicked:
This test must confirm that when the “Submit” button is clicked that a new seeding log in the database:
Notes:
setDB sample
in a Terminal in the development environment.Resources:
farmdat2/farmdata2_modules/fd2_example/dbtest
.Additional Information:
Some additional notes relevant to this issue:
.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..spec.js
file should include a comment at the top that describes what the file as a whole is testing.describe
should describe in a short phrase what the file is testing.beforeEach
method should callcy.waitForPage()
. This will ensure that the page is fully loaded (e.g. that all theMaps
used by the page are loaded) before performing any tests.it
for each of the things to be tested.it
s so that eachit
tests a cohesive set of things.it
should describe in a short phrase what theit
is testing..spec.js
files in thefarmdata2/farmdata2_modules/fd2_example/
sub-tabs (e.g.ui
,api
) may provide some helpful examples.docker/sampleDB/README.md
file.