DickinsonCollege / FD2School-FarmData2-S23

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

Seeding Input: Test Seeding Log Creation #203

Open braughtg opened 1 year ago

braughtg commented 1 year ago

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:

Resources:

Additional Information:

Some additional notes relevant to this issue:

Shahir-47 commented 1 year ago

I would like to work on this!

JinLeeGG commented 1 year ago

I would like to work on this!

won369369 commented 1 year ago

I would like to work on this!

johnmaccormick commented 1 year ago

good luck!

Shahir-47 commented 1 year ago

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()
johnmaccormick commented 1 year ago

@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.

braughtg commented 1 year ago

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.

Shahir-47 commented 1 year ago

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.