From 13cbd1f0106efdb623da2c401fb567ceafd97dfb Mon Sep 17 00:00:00 2001 From: wpgoble Date: Thu, 29 Jun 2023 10:00:12 -0400 Subject: [PATCH 01/11] Test Barn Kit Seeding Report columns by seeding type (#210) * Initial commit, adding seeding input data cypress test * subtask #1 Assert header has 'Data' * Check the crop dropdown list size * Testing crop dropdown * Testing for crop dropdown length * Testing for crop dropdown length * test input date element enabled and has correct default value * Cleaning cypress test * Add spec.js file for testing seeding report columns by seeding type * Add test column for Tray Seedings * Completed testing for Direct Seeding column headers * Added a test to check where proper columns are displayed in the table for "All" seeding type * Reformat Tray Seeding test to look like Direct Seeding test format * Rewrite the test for all option (checking the table columns) for better efficiency and readability * Delete unnecessary folder * Modify test for the table column for the all option. Specifically, modified the for loop that check the visibility of table headers to use cypress tag instead of using .children() for to get the header elements * delete an unnecessary folder * Standardized tests and addressed requested changes * Cleaned comments * Address PR change requests * Add test for Edit header back * Check for report table before checkbuttons and add check that the checkbuttons are not disabled --------- Co-authored-by: nathang15 Co-authored-by: infantlikesprogramming --- .../seedingReport.columns.spec.js | 106 ++++++++++++++++++ 1 file changed, 106 insertions(+) create mode 100644 farmdata2/farmdata2_modules/fd2_barn_kit/seedingReport/seedingReport.columns.spec.js diff --git a/farmdata2/farmdata2_modules/fd2_barn_kit/seedingReport/seedingReport.columns.spec.js b/farmdata2/farmdata2_modules/fd2_barn_kit/seedingReport/seedingReport.columns.spec.js new file mode 100644 index 0000000000..d5c7b8041c --- /dev/null +++ b/farmdata2/farmdata2_modules/fd2_barn_kit/seedingReport/seedingReport.columns.spec.js @@ -0,0 +1,106 @@ +const allExpectedHeaders = [ + { "header": 'Date'}, + { "header": 'Crop'}, + { "header": 'Area'}, + { "header": 'Seeding'}, + { "header": 'Row Feet'}, + { "header": 'Bed Feet'}, + { "header": 'Rows/Bed'}, + { "header": 'Seeds'}, + { "header": 'Trays'}, + { "header": 'Cells/Tray'}, + { "header": 'Workers'}, + { "header": 'Hours'}, + { "header": 'Varieties'}, + { "header": 'Comments'}, + { "header": 'User'}, +]; + +describe("Test the seeding report columns by seeding type", () => { + beforeEach(() => { + + cy.login('manager1', 'farmdata2') + cy.visit('/farm/fd2-barn-kit/seedingReport') + + // Wait here for the maps to load in the page. + cy.waitForPage() + + //first generate a report + cy.get('[data-cy=start-date-select]').type('2020-01-01') + cy.get('[data-cy=end-date-select]').type('2020-07-01') + cy.get('[data-cy=generate-rpt-btn]') + .click() + }) + + it('Checks the Report Table header for the "all" option', () => { + cy.get('[data-cy=report-table]') + .should('exist') + + // Check to see if the checkboxes are visible and enabled + cy.get("[data-cy=r1-cbuttonCheckbox]").should('not.be.disabled') + cy.get("[data-cy=r1-cbuttonCheckbox]").should('be.visible') + + //Make sure these headers exist on the page and the rest are not + let includedHeaders = ["Date", "Crop", "Area", "Seeding", "Workers", "Hours", "Varieties", "Comments", "User"] + let i = 0 + allExpectedHeaders.forEach(header => { + if (includedHeaders.includes(header.header)) { + cy.get("[data-cy=h" + i + "]").should('exist') + } else { + cy.get("[data-cy=h" + i + "]").should('not.exist') + } + i++ + }) + + cy.get('[data-cy=r1-edit-button]').should('exist'); + }); + + it("Tests the direct seeding columns", () => { + cy.get('[data-cy=seeding-type-dropdown] > [data-cy=dropdown-input]').select('Direct Seedings') + + cy.get('[data-cy=report-table]') + .should('exist') + + cy.get("[data-cy=r1-cbuttonCheckbox]").should('not.be.disabled') + cy.get('[data-cy=selectAll-checkbox]').should('be.visible'); + + //Make sure these headers exist on the page and the rest are not + let includedHeaders = ["Date", "Crop", "Area", "Seeding", "Row Feet", "Bed Feet", "Rows/Bed", + "Workers", "Hours", "Varieties", "Comments", "User"] + let i = 0 + allExpectedHeaders.forEach(header => { + if (includedHeaders.includes(header.header)) { + cy.get("[data-cy=h" + i + "]").should('exist') + } else { + cy.get("[data-cy=h" + i + "]").should('not.exist') + } + i++ + }) + + cy.get('[data-cy=r1-edit-button]').should('exist'); + }); + + it("Tests the tray seeding columns", () => { + cy.get('[data-cy=seeding-type-dropdown] > [data-cy=dropdown-input]').select('Tray Seedings') + + cy.get('[data-cy=report-table]') + .should('exist') + + cy.get("[data-cy=r1-cbuttonCheckbox]").should('not.be.disabled') + cy.get('[data-cy=selectAll-checkbox]').should('be.visible'); + + //Make sure these headers exist on the page and the rest are not + let includedHeaders = ["Date", "Crop", "Area", "Seeding", "Seeds", "Trays", "Cells/Tray", "Workers", "Hours", "Varieties", "Comments", "User"] + let i = 0 + allExpectedHeaders.forEach(header => { + if (includedHeaders.includes(header.header)) { + cy.get("[data-cy=h" + i + "]").should('exist') + } else { + cy.get("[data-cy=h" + i + "]").should('not.exist') + } + i++ + }) + + cy.get('[data-cy=r1-edit-button]').should('exist'); + }); +}); From 2bc73b7cef2bcc91a76540e0d75eded2f180214c Mon Sep 17 00:00:00 2001 From: wpgoble Date: Thu, 29 Jun 2023 11:06:39 -0400 Subject: [PATCH 02/11] Added HTML sub-tab to FD2 School Tab --- farmdata2/farmdata2_modules/fd2_school/HTML/HTML.html | 1 + farmdata2/farmdata2_modules/fd2_school/fd2_school.module | 8 ++++++++ 2 files changed, 9 insertions(+) create mode 100644 farmdata2/farmdata2_modules/fd2_school/HTML/HTML.html diff --git a/farmdata2/farmdata2_modules/fd2_school/HTML/HTML.html b/farmdata2/farmdata2_modules/fd2_school/HTML/HTML.html new file mode 100644 index 0000000000..8e09273d5a --- /dev/null +++ b/farmdata2/farmdata2_modules/fd2_school/HTML/HTML.html @@ -0,0 +1 @@ +

My name is Prof. Goble

\ No newline at end of file diff --git a/farmdata2/farmdata2_modules/fd2_school/fd2_school.module b/farmdata2/farmdata2_modules/fd2_school/fd2_school.module index 167ca8ef2a..a4f71534f3 100644 --- a/farmdata2/farmdata2_modules/fd2_school/fd2_school.module +++ b/farmdata2/farmdata2_modules/fd2_school/fd2_school.module @@ -61,6 +61,14 @@ function fd2_school_menu() { ); // Add items blocks for new sub-tabs here. + $items['farm/fd2-school/HTML'] = array( + 'title' => 'HTML', + 'type' => MENU_LOCAL_TASK, + 'page callback' => 'fd2_school_view', + 'page arguments' => array('HTML'), + 'access arguments' => array('view fd2 school'), + 'weight' => 110, + ); return $items; }; From 30b3b5bf98beeb2905e3f1cd2f5631cfe787744f Mon Sep 17 00:00:00 2001 From: wpgoble Date: Thu, 29 Jun 2023 12:32:30 -0400 Subject: [PATCH 03/11] Adds Sample Harvest Report --- .../farmdata2_modules/fd2_school/HTML/HTML.html | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-) diff --git a/farmdata2/farmdata2_modules/fd2_school/HTML/HTML.html b/farmdata2/farmdata2_modules/fd2_school/HTML/HTML.html index 8e09273d5a..f26e17dc15 100644 --- a/farmdata2/farmdata2_modules/fd2_school/HTML/HTML.html +++ b/farmdata2/farmdata2_modules/fd2_school/HTML/HTML.html @@ -1 +1,16 @@ -

My name is Prof. Goble

\ No newline at end of file +

Harvest Report

+

This page is a mockup of a simplified harvest report.

+
+

My Sample Harvest Report

+

+ Details +

    +
  • Farm:Sample Farm
  • +
  • User:manager1
  • +
  • Language:English
  • +
    +
  • Start:05/01/2018
  • +
  • End:05/15/2018
  • +
  • Crop:Kale
  • +
+

\ No newline at end of file From e716994ab3a50d651d62e9e5cc54493dc59697db Mon Sep 17 00:00:00 2001 From: wpgoble Date: Thu, 29 Jun 2023 12:41:42 -0400 Subject: [PATCH 04/11] Adds Title input field and anon button --- farmdata2/farmdata2_modules/fd2_school/HTML/HTML.html | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/farmdata2/farmdata2_modules/fd2_school/HTML/HTML.html b/farmdata2/farmdata2_modules/fd2_school/HTML/HTML.html index f26e17dc15..869313e8cb 100644 --- a/farmdata2/farmdata2_modules/fd2_school/HTML/HTML.html +++ b/farmdata2/farmdata2_modules/fd2_school/HTML/HTML.html @@ -13,4 +13,7 @@

My Sample Harvest Report

  • End:05/15/2018
  • Crop:Kale
  • -

    \ No newline at end of file +

    + + + \ No newline at end of file From a4e3da5bf2c9608d260e65e804d310d5e337358f Mon Sep 17 00:00:00 2001 From: wpgoble Date: Thu, 29 Jun 2023 12:50:23 -0400 Subject: [PATCH 05/11] Adds crop element --- .../fd2_school/HTML/HTML.html | 25 +++++++++++++++---- 1 file changed, 20 insertions(+), 5 deletions(-) diff --git a/farmdata2/farmdata2_modules/fd2_school/HTML/HTML.html b/farmdata2/farmdata2_modules/fd2_school/HTML/HTML.html index 869313e8cb..638d0735ab 100644 --- a/farmdata2/farmdata2_modules/fd2_school/HTML/HTML.html +++ b/farmdata2/farmdata2_modules/fd2_school/HTML/HTML.html @@ -5,15 +5,30 @@

    My Sample Harvest Report

    Details

      -
    • Farm:Sample Farm
    • +
    • Farm:
    • User:manager1
    • Language:English

    • Start:05/01/2018
    • End:05/15/2018
    • -
    • Crop:Kale
    • +
    • + Crop: +
        +
      • + + +
      • +
      • + + +
      • +
      • + + +
      • +
      +
    -

    +

    - - \ No newline at end of file + \ No newline at end of file From b80c0b1999e90138111833bad6cb19c856e6c138 Mon Sep 17 00:00:00 2001 From: wpgoble Date: Thu, 29 Jun 2023 12:53:26 -0400 Subject: [PATCH 06/11] Fixes Crop selection, now is drop down --- .../fd2_school/HTML/HTML.html | 19 +++++-------------- 1 file changed, 5 insertions(+), 14 deletions(-) diff --git a/farmdata2/farmdata2_modules/fd2_school/HTML/HTML.html b/farmdata2/farmdata2_modules/fd2_school/HTML/HTML.html index 638d0735ab..1c90833e6f 100644 --- a/farmdata2/farmdata2_modules/fd2_school/HTML/HTML.html +++ b/farmdata2/farmdata2_modules/fd2_school/HTML/HTML.html @@ -13,20 +13,11 @@

    My Sample Harvest Report

  • End:05/15/2018
  • Crop: -
      -
    • - - -
    • -
    • - - -
    • -
    • - - -
    • -
    +
  • From 0c46569443fe5af4abc397cb7bf14eedbe5ccb4c Mon Sep 17 00:00:00 2001 From: wpgoble Date: Thu, 29 Jun 2023 12:56:49 -0400 Subject: [PATCH 07/11] Adds field information --- farmdata2/farmdata2_modules/fd2_school/HTML/HTML.html | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/farmdata2/farmdata2_modules/fd2_school/HTML/HTML.html b/farmdata2/farmdata2_modules/fd2_school/HTML/HTML.html index 1c90833e6f..be8d5f88f8 100644 --- a/farmdata2/farmdata2_modules/fd2_school/HTML/HTML.html +++ b/farmdata2/farmdata2_modules/fd2_school/HTML/HTML.html @@ -13,12 +13,20 @@

    My Sample Harvest Report

  • End:05/15/2018
  • Crop: -
  • +
  • + Field: + +
  • From a4edc40158e0e29d883ad106e3325e84146bbb2b Mon Sep 17 00:00:00 2001 From: wpgoble Date: Thu, 29 Jun 2023 13:04:43 -0400 Subject: [PATCH 08/11] Adds start and end date input fields --- .../farmdata2_modules/fd2_school/HTML/HTML.html | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/farmdata2/farmdata2_modules/fd2_school/HTML/HTML.html b/farmdata2/farmdata2_modules/fd2_school/HTML/HTML.html index be8d5f88f8..8d577699a5 100644 --- a/farmdata2/farmdata2_modules/fd2_school/HTML/HTML.html +++ b/farmdata2/farmdata2_modules/fd2_school/HTML/HTML.html @@ -9,8 +9,16 @@

    My Sample Harvest Report

  • User:manager1
  • Language:English

  • -
  • Start:05/01/2018
  • -
  • End:05/15/2018
  • +
  • + Start: + +
  • +
  • + End: + +
  • Crop:

    +

    Start: + End:

    +

    Crop: + + Field: + +

    +

    My Sample Harvest Report

    Details

      -
    • Farm:
    • +
    • Farm:Sample Farm
    • User:manager1
    • Language:English

    • Start: - +
    • End: - +
    • Crop: -
    • Field: - +
    -

    - - \ No newline at end of file +

    \ No newline at end of file From 4f51992a913cd02f6e9eefcfae152771a92ee5ef Mon Sep 17 00:00:00 2001 From: wpgoble Date: Thu, 29 Jun 2023 13:23:51 -0400 Subject: [PATCH 10/11] Fixes 'generated data' section, misread instructions previously --- .../fd2_school/HTML/HTML.html | 18 +++--------------- 1 file changed, 3 insertions(+), 15 deletions(-) diff --git a/farmdata2/farmdata2_modules/fd2_school/HTML/HTML.html b/farmdata2/farmdata2_modules/fd2_school/HTML/HTML.html index cee42e0c10..8d6f583223 100644 --- a/farmdata2/farmdata2_modules/fd2_school/HTML/HTML.html +++ b/farmdata2/farmdata2_modules/fd2_school/HTML/HTML.html @@ -26,20 +26,8 @@

    My Sample Harvest Report

  • User:manager1
  • Language:English

  • -
  • - Start: - -
  • -
  • - End: - -
  • -
  • - Crop: -
  • -
  • - Field: - -
  • +
  • Start:05/05/2020
  • +
  • End:05/15/2020
  • +
  • Crop:Kale
  • \ No newline at end of file From 9d12cba4f514ddd6f0b5448dcc8391822d58670c Mon Sep 17 00:00:00 2001 From: wpgoble Date: Thu, 29 Jun 2023 13:31:49 -0400 Subject: [PATCH 11/11] Adds table with styling --- .../fd2_school/HTML/HTML.html | 23 +++++++++++++++++++ 1 file changed, 23 insertions(+) diff --git a/farmdata2/farmdata2_modules/fd2_school/HTML/HTML.html b/farmdata2/farmdata2_modules/fd2_school/HTML/HTML.html index 8d6f583223..94560ee76c 100644 --- a/farmdata2/farmdata2_modules/fd2_school/HTML/HTML.html +++ b/farmdata2/farmdata2_modules/fd2_school/HTML/HTML.html @@ -30,4 +30,27 @@

    My Sample Harvest Report

  • End:05/15/2020
  • Crop:Kale
  • + + + + + + + + + + + + + + + + + + + + + + +
    DateAreaCropYieldUnits
    05/05/2020Chuau-1Kale10Bunches
    05/05/2020SQ7Kale7Bunches

    \ No newline at end of file