From df0334d5663e5be4ba20c6c70188d7f8a4f0195d Mon Sep 17 00:00:00 2001 From: Toddthegod1 Date: Thu, 7 Nov 2024 11:13:22 -0500 Subject: [PATCH 01/11] Added Transplanting Report Test --- .../transplantingReport/transplantingReport.html | 2 +- .../transplantingReport/transplantingReport.spec.js | 7 +++++++ 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/farmdata2/farmdata2_modules/fd2_barn_kit/transplantingReport/transplantingReport.html b/farmdata2/farmdata2_modules/fd2_barn_kit/transplantingReport/transplantingReport.html index 1eb9ae52..38b32ac8 100644 --- a/farmdata2/farmdata2_modules/fd2_barn_kit/transplantingReport/transplantingReport.html +++ b/farmdata2/farmdata2_modules/fd2_barn_kit/transplantingReport/transplantingReport.html @@ -1,6 +1,6 @@
-

Transplanting Report

+

Transplanting Report

Set Dates diff --git a/farmdata2/farmdata2_modules/fd2_barn_kit/transplantingReport/transplantingReport.spec.js b/farmdata2/farmdata2_modules/fd2_barn_kit/transplantingReport/transplantingReport.spec.js index baaa90c8..abf8b520 100644 --- a/farmdata2/farmdata2_modules/fd2_barn_kit/transplantingReport/transplantingReport.spec.js +++ b/farmdata2/farmdata2_modules/fd2_barn_kit/transplantingReport/transplantingReport.spec.js @@ -28,6 +28,13 @@ describe('Testing for the transplanting report page', () => { cy.waitForPage() }) + it('check Transplanting Report Header', () => { + cy.get('[data-cy=Tr-report]') + .should('have.text', 'Transplanting Report') + }) + + + context('can set dates and then render the report', () => { it('allows user input of the start and end dates', () => { From 3aac71bf004ccc8758bb86bd8712256f57970a69 Mon Sep 17 00:00:00 2001 From: ngpmnam Date: Thu, 7 Nov 2024 11:29:20 -0500 Subject: [PATCH 02/11] Added test for the generate report button --- .../transplantingReport/transplantingReport.spec.js | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/farmdata2/farmdata2_modules/fd2_barn_kit/transplantingReport/transplantingReport.spec.js b/farmdata2/farmdata2_modules/fd2_barn_kit/transplantingReport/transplantingReport.spec.js index abf8b520..ea7be40d 100644 --- a/farmdata2/farmdata2_modules/fd2_barn_kit/transplantingReport/transplantingReport.spec.js +++ b/farmdata2/farmdata2_modules/fd2_barn_kit/transplantingReport/transplantingReport.spec.js @@ -33,6 +33,16 @@ describe('Testing for the transplanting report page', () => { .should('have.text', 'Transplanting Report') }) + it('check generate report button', () => { + cy.get('[data-cy=generate-rpt-btn]') + .should('have.text', 'Generate Report') + cy.get('[data-cy=generate-rpt-btn]') + .should('be.enabled') + }) + + + + context('can set dates and then render the report', () => { From 18fea31e42f42a647036926cf3a9cee9ab63a52f Mon Sep 17 00:00:00 2001 From: Toddthegod1 Date: Fri, 8 Nov 2024 13:33:40 -0500 Subject: [PATCH 03/11] Added default specs file --- .../transplantingReport.defaults.spec.js | 26 +++++++++++++++++++ .../transplantingReport.spec.js | 5 ++++ 2 files changed, 31 insertions(+) create mode 100644 farmdata2/farmdata2_modules/fd2_barn_kit/transplantingReport/transplantingReport.defaults.spec.js diff --git a/farmdata2/farmdata2_modules/fd2_barn_kit/transplantingReport/transplantingReport.defaults.spec.js b/farmdata2/farmdata2_modules/fd2_barn_kit/transplantingReport/transplantingReport.defaults.spec.js new file mode 100644 index 00000000..3252955e --- /dev/null +++ b/farmdata2/farmdata2_modules/fd2_barn_kit/transplantingReport/transplantingReport.defaults.spec.js @@ -0,0 +1,26 @@ +beforeEach(() => { + cy.login('manager1', 'farmdata2') + cy.visit('/farm/fd2-barn-kit/transplantingReport') + + // Wait here for the maps to load in the page. + cy.waitForPage() +}) + +it('check Transplanting Report Header', () => { + cy.get('[data-cy=Tr-report]') + .should('have.text', 'Transplanting Report') +}) + +it('check generate report button', () => { + cy.get('[data-cy=generate-rpt-btn]') + .should('have.text', 'Generate Report') + cy.get('[data-cy=generate-rpt-btn]') + .should('be.enabled') +}) + +it('check default start date is first day of current day', () => { + cy.get('[data-cy="date-range-selection"]') + cy.get('[data-cy="date-range-selection"] input[name="set-start-date:"]') + .should('have.value', '01/01/2024') + // this is not working yet +}) \ No newline at end of file diff --git a/farmdata2/farmdata2_modules/fd2_barn_kit/transplantingReport/transplantingReport.spec.js b/farmdata2/farmdata2_modules/fd2_barn_kit/transplantingReport/transplantingReport.spec.js index ea7be40d..f1603b6c 100644 --- a/farmdata2/farmdata2_modules/fd2_barn_kit/transplantingReport/transplantingReport.spec.js +++ b/farmdata2/farmdata2_modules/fd2_barn_kit/transplantingReport/transplantingReport.spec.js @@ -40,6 +40,11 @@ describe('Testing for the transplanting report page', () => { .should('be.enabled') }) + it('check default start date is first day of current day', () => { + cy.get('[data-cy="date-range-selection"] input[name="set-start-date:"]') + .should('have.value', '01/01/2024') + }) + From fdf4a719ac7f30836485294bbcbc57b63bb37ebe Mon Sep 17 00:00:00 2001 From: Toddthegod1 Date: Tue, 12 Nov 2024 11:15:24 -0500 Subject: [PATCH 04/11] added default start date test --- .../transplantingReport.defaults.spec.js | 17 +++++++++----- .../transplantingReport.spec.js | 22 ------------------- 2 files changed, 11 insertions(+), 28 deletions(-) diff --git a/farmdata2/farmdata2_modules/fd2_barn_kit/transplantingReport/transplantingReport.defaults.spec.js b/farmdata2/farmdata2_modules/fd2_barn_kit/transplantingReport/transplantingReport.defaults.spec.js index 3252955e..bf8956ec 100644 --- a/farmdata2/farmdata2_modules/fd2_barn_kit/transplantingReport/transplantingReport.defaults.spec.js +++ b/farmdata2/farmdata2_modules/fd2_barn_kit/transplantingReport/transplantingReport.defaults.spec.js @@ -18,9 +18,14 @@ it('check generate report button', () => { .should('be.enabled') }) -it('check default start date is first day of current day', () => { - cy.get('[data-cy="date-range-selection"]') - cy.get('[data-cy="date-range-selection"] input[name="set-start-date:"]') - .should('have.value', '01/01/2024') - // this is not working yet -}) \ No newline at end of file + +describe('Default Start Date Test', () => { + it('should have the default start date as the first day of the current year', () => { + const currentYear = new Date().getFullYear(); + const firstDayOfYear = `${currentYear}-01-01`; + + cy.get('[data-cy=date-select]') + .should('have.value', firstDayOfYear); + }); + }); + diff --git a/farmdata2/farmdata2_modules/fd2_barn_kit/transplantingReport/transplantingReport.spec.js b/farmdata2/farmdata2_modules/fd2_barn_kit/transplantingReport/transplantingReport.spec.js index f1603b6c..baaa90c8 100644 --- a/farmdata2/farmdata2_modules/fd2_barn_kit/transplantingReport/transplantingReport.spec.js +++ b/farmdata2/farmdata2_modules/fd2_barn_kit/transplantingReport/transplantingReport.spec.js @@ -28,28 +28,6 @@ describe('Testing for the transplanting report page', () => { cy.waitForPage() }) - it('check Transplanting Report Header', () => { - cy.get('[data-cy=Tr-report]') - .should('have.text', 'Transplanting Report') - }) - - it('check generate report button', () => { - cy.get('[data-cy=generate-rpt-btn]') - .should('have.text', 'Generate Report') - cy.get('[data-cy=generate-rpt-btn]') - .should('be.enabled') - }) - - it('check default start date is first day of current day', () => { - cy.get('[data-cy="date-range-selection"] input[name="set-start-date:"]') - .should('have.value', '01/01/2024') - }) - - - - - - context('can set dates and then render the report', () => { it('allows user input of the start and end dates', () => { From 4bd962e341d22718731f88a8a7c6e52df90e9b00 Mon Sep 17 00:00:00 2001 From: HuuPhu-Nguyen Date: Thu, 14 Nov 2024 01:09:27 -0500 Subject: [PATCH 05/11] added test for the Set Date legend --- .../fd2_barn_kit/transplantingReport/transplantingReport.html | 2 +- .../transplantingReport/transplantingReport.spec.js | 4 +++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/farmdata2/farmdata2_modules/fd2_barn_kit/transplantingReport/transplantingReport.html b/farmdata2/farmdata2_modules/fd2_barn_kit/transplantingReport/transplantingReport.html index 38b32ac8..934922b9 100644 --- a/farmdata2/farmdata2_modules/fd2_barn_kit/transplantingReport/transplantingReport.html +++ b/farmdata2/farmdata2_modules/fd2_barn_kit/transplantingReport/transplantingReport.html @@ -3,7 +3,7 @@

Transplanting Report

- Set Dates + Set Dates
{ .should('be.enabled') }) - + it('check the date input', () => { + cy.get('[data-cy = set-date-label]').should('have.text', 'Set Dates') + }) From 3123e7f8af17a52e39501413b8f8ba2ffa04e84f Mon Sep 17 00:00:00 2001 From: Toddthegod1 Date: Thu, 14 Nov 2024 11:01:28 -0500 Subject: [PATCH 06/11] added phus test --- .../transplantingReport.defaults.spec.js | 5 +++++ .../transplantingReport.spec.js | 20 +------------------ 2 files changed, 6 insertions(+), 19 deletions(-) diff --git a/farmdata2/farmdata2_modules/fd2_barn_kit/transplantingReport/transplantingReport.defaults.spec.js b/farmdata2/farmdata2_modules/fd2_barn_kit/transplantingReport/transplantingReport.defaults.spec.js index bf8956ec..8f0f0f22 100644 --- a/farmdata2/farmdata2_modules/fd2_barn_kit/transplantingReport/transplantingReport.defaults.spec.js +++ b/farmdata2/farmdata2_modules/fd2_barn_kit/transplantingReport/transplantingReport.defaults.spec.js @@ -27,5 +27,10 @@ describe('Default Start Date Test', () => { cy.get('[data-cy=date-select]') .should('have.value', firstDayOfYear); }); + + it('check the date input', () => { + cy.get('[data-cy = set-date-label]').should('have.text', 'Set Dates') + }) + }); diff --git a/farmdata2/farmdata2_modules/fd2_barn_kit/transplantingReport/transplantingReport.spec.js b/farmdata2/farmdata2_modules/fd2_barn_kit/transplantingReport/transplantingReport.spec.js index 46fb3232..648de406 100644 --- a/farmdata2/farmdata2_modules/fd2_barn_kit/transplantingReport/transplantingReport.spec.js +++ b/farmdata2/farmdata2_modules/fd2_barn_kit/transplantingReport/transplantingReport.spec.js @@ -27,25 +27,7 @@ describe('Testing for the transplanting report page', () => { // Wait here for the maps to load in the page. cy.waitForPage() }) - - - it('check Transplanting Report Header', () => { - cy.get('[data-cy=Tr-report]') - .should('have.text', 'Transplanting Report') - }) - - it('check generate report button', () => { - cy.get('[data-cy=generate-rpt-btn]') - .should('have.text', 'Generate Report') - cy.get('[data-cy=generate-rpt-btn]') - .should('be.enabled') - }) - - it('check the date input', () => { - cy.get('[data-cy = set-date-label]').should('have.text', 'Set Dates') - }) - - + context('can set dates and then render the report', () => { it('allows user input of the start and end dates', () => { From 52ff3d024b00f0817a81baf56dde2733c23bf186 Mon Sep 17 00:00:00 2001 From: Toddthegod1 Date: Thu, 14 Nov 2024 13:44:10 -0500 Subject: [PATCH 07/11] Added start and end date --- .../transplantingReport.defaults.spec.js | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/farmdata2/farmdata2_modules/fd2_barn_kit/transplantingReport/transplantingReport.defaults.spec.js b/farmdata2/farmdata2_modules/fd2_barn_kit/transplantingReport/transplantingReport.defaults.spec.js index 8f0f0f22..dbddf10c 100644 --- a/farmdata2/farmdata2_modules/fd2_barn_kit/transplantingReport/transplantingReport.defaults.spec.js +++ b/farmdata2/farmdata2_modules/fd2_barn_kit/transplantingReport/transplantingReport.defaults.spec.js @@ -23,10 +23,17 @@ describe('Default Start Date Test', () => { it('should have the default start date as the first day of the current year', () => { const currentYear = new Date().getFullYear(); const firstDayOfYear = `${currentYear}-01-01`; - - cy.get('[data-cy=date-select]') + cy.get('[data-cy=start-date-select]') + .children() .should('have.value', firstDayOfYear); }); + + it('check the end date is the current date', () => { + const currentDate = new Date().toISOString().split('T')[0]; + cy.get('[data-cy=end-date-select]') + .children() + .should('have.value', currentDate); + }) it('check the date input', () => { cy.get('[data-cy = set-date-label]').should('have.text', 'Set Dates') From 32ca4ca9fe6b1bafe7e4bbb44dbb25d2245d214d Mon Sep 17 00:00:00 2001 From: HuuPhu-Nguyen Date: Sun, 17 Nov 2024 23:26:10 -0500 Subject: [PATCH 08/11] tested table\'s existence --- .../transplantingReport.defaults.spec.js | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/farmdata2/farmdata2_modules/fd2_barn_kit/transplantingReport/transplantingReport.defaults.spec.js b/farmdata2/farmdata2_modules/fd2_barn_kit/transplantingReport/transplantingReport.defaults.spec.js index 8f0f0f22..d330b3d9 100644 --- a/farmdata2/farmdata2_modules/fd2_barn_kit/transplantingReport/transplantingReport.defaults.spec.js +++ b/farmdata2/farmdata2_modules/fd2_barn_kit/transplantingReport/transplantingReport.defaults.spec.js @@ -32,5 +32,9 @@ describe('Default Start Date Test', () => { cy.get('[data-cy = set-date-label]').should('have.text', 'Set Dates') }) - }); +}); + +it('check table\'s existence', () => { + cy.get('[data-cy=report-table]').should("not.exist"); +}) From a82fef9ec013bf320dc50eafbc977a661954224c Mon Sep 17 00:00:00 2001 From: Toddthegod1 Date: Thu, 21 Nov 2024 11:07:47 -0500 Subject: [PATCH 09/11] Finished first issue --- .../transplantingReport.defaults.spec.js | 58 +++++++++---------- 1 file changed, 29 insertions(+), 29 deletions(-) diff --git a/farmdata2/farmdata2_modules/fd2_barn_kit/transplantingReport/transplantingReport.defaults.spec.js b/farmdata2/farmdata2_modules/fd2_barn_kit/transplantingReport/transplantingReport.defaults.spec.js index 8dd98437..e9b306e5 100644 --- a/farmdata2/farmdata2_modules/fd2_barn_kit/transplantingReport/transplantingReport.defaults.spec.js +++ b/farmdata2/farmdata2_modules/fd2_barn_kit/transplantingReport/transplantingReport.defaults.spec.js @@ -1,30 +1,34 @@ -beforeEach(() => { - cy.login('manager1', 'farmdata2') - cy.visit('/farm/fd2-barn-kit/transplantingReport') - - // Wait here for the maps to load in the page. - cy.waitForPage() -}) +// Tests the default contents of the Transplanting Report in the BarnKit +describe('Checks default contents of the Transplanting Report', () => { + beforeEach(() => { + cy.login('manager1', 'farmdata2') + cy.visit('/farm/fd2-barn-kit/transplantingReport') + + // Wait here for the maps to load in the page. + cy.waitForPage() + }) -it('check Transplanting Report Header', () => { - cy.get('[data-cy=Tr-report]') - .should('have.text', 'Transplanting Report') -}) + it('check Transplanting Report Header', () => { + cy.get('[data-cy=Tr-report]') + .should('have.text', 'Transplanting Report') + }) -it('check generate report button', () => { - cy.get('[data-cy=generate-rpt-btn]') - .should('have.text', 'Generate Report') - cy.get('[data-cy=generate-rpt-btn]') - .should('be.enabled') -}) + it('check the page contains a section labeled Set Dates', () => { + cy.get('[data-cy = set-date-label]').should('have.text', 'Set Dates') + }) + it('check generate report button', () => { + cy.get('[data-cy=generate-rpt-btn]') + .should('have.text', 'Generate Report') + cy.get('[data-cy=generate-rpt-btn]') + .should('be.enabled') + }) -describe('Default Start Date Test', () => { it('should have the default start date as the first day of the current year', () => { - const currentYear = new Date().getFullYear(); - const firstDayOfYear = `${currentYear}-01-01`; - cy.get('[data-cy=start-date-select]') - .children() + const currentYear = new Date().getFullYear(); + const firstDayOfYear = `${currentYear}-01-01`; + cy.get('[data-cy=start-date-select]') + .children() .should('have.value', firstDayOfYear); }); @@ -34,14 +38,10 @@ describe('Default Start Date Test', () => { .children() .should('have.value', currentDate); }) - - it('check the date input', () => { - cy.get('[data-cy = set-date-label]').should('have.text', 'Set Dates') - }) + it('check table\'s existence', () => { + cy.get('[data-cy=report-table]').should("not.exist"); + }) }); -it('check table\'s existence', () => { - cy.get('[data-cy=report-table]').should("not.exist"); -}) From 14f60e7e469217207b1e90974d14d1fd88059f72 Mon Sep 17 00:00:00 2001 From: HuuPhu-Nguyen Date: Thu, 12 Dec 2024 23:49:57 -0500 Subject: [PATCH 10/11] added the tests, the last one need to be reviewed --- .../farmdata2_modules/cypress/subtabs.spec.js | 27 +++++++++++ .../transplantingReport.defaults.spec.js | 47 ------------------- 2 files changed, 27 insertions(+), 47 deletions(-) create mode 100644 farmdata2/farmdata2_modules/cypress/subtabs.spec.js delete mode 100644 farmdata2/farmdata2_modules/fd2_barn_kit/transplantingReport/transplantingReport.defaults.spec.js diff --git a/farmdata2/farmdata2_modules/cypress/subtabs.spec.js b/farmdata2/farmdata2_modules/cypress/subtabs.spec.js new file mode 100644 index 00000000..19654d3b --- /dev/null +++ b/farmdata2/farmdata2_modules/cypress/subtabs.spec.js @@ -0,0 +1,27 @@ +describe('Test the UI tabs are accurate for each kind of person logged into FarmData2', () => { + + + it('When the manager is logged in the UI should contain FieldKit, BarnKit and FD2 Config tabs', () => { + cy.login('manager1', 'farmdata2') + cy.visit('/farm') + cy.get('a.glyphicons-processed[href="/farm/fd2-field-kit"]').should('exist').and('be.visible'); + cy.get('a.glyphicons-processed[href="/farm/fd2-barn-kit"]').should('exist').and('be.visible'); + cy.get('a.glyphicons-processed[href="/farm/fd2-config"]').should('exist').and('be.visible'); + }) + + it('When worker is logged in UI should contain FieldKit and BarnKit tabs but not FD2Config tab', () => { + cy.login('worker1', 'farmdata2') + cy.visit('/farm') + cy.get('a.glyphicons-processed[href="/farm/fd2-field-kit"]').should('exist').and('be.visible'); + cy.get('a.glyphicons-processed[href="/farm/fd2-barn-kit"]').should('exist').and('be.visible'); + cy.get('a.glyphicons-processed[href="/farm/fd2-config"]').should('not.exist') + }) + + it('When guest is selected none of the three tabs should appear', () => { + cy.login('guest1', 'farmdata2') + cy.visit('/farm') + cy.get('a.glyphicons-processed[href="/farm/fd2-field-kit"]').should('not.exist') + cy.get('a.glyphicons-processed[href="/farm/fd2-barn-kit"]').should('not.exist') + cy.get('a.glyphicons-processed[href="/farm/fd2-config"]').should('not.exist') + }) +}) \ No newline at end of file diff --git a/farmdata2/farmdata2_modules/fd2_barn_kit/transplantingReport/transplantingReport.defaults.spec.js b/farmdata2/farmdata2_modules/fd2_barn_kit/transplantingReport/transplantingReport.defaults.spec.js deleted file mode 100644 index e9b306e5..00000000 --- a/farmdata2/farmdata2_modules/fd2_barn_kit/transplantingReport/transplantingReport.defaults.spec.js +++ /dev/null @@ -1,47 +0,0 @@ -// Tests the default contents of the Transplanting Report in the BarnKit -describe('Checks default contents of the Transplanting Report', () => { - beforeEach(() => { - cy.login('manager1', 'farmdata2') - cy.visit('/farm/fd2-barn-kit/transplantingReport') - - // Wait here for the maps to load in the page. - cy.waitForPage() - }) - - it('check Transplanting Report Header', () => { - cy.get('[data-cy=Tr-report]') - .should('have.text', 'Transplanting Report') - }) - - it('check the page contains a section labeled Set Dates', () => { - cy.get('[data-cy = set-date-label]').should('have.text', 'Set Dates') - }) - - it('check generate report button', () => { - cy.get('[data-cy=generate-rpt-btn]') - .should('have.text', 'Generate Report') - cy.get('[data-cy=generate-rpt-btn]') - .should('be.enabled') - }) - - it('should have the default start date as the first day of the current year', () => { - const currentYear = new Date().getFullYear(); - const firstDayOfYear = `${currentYear}-01-01`; - cy.get('[data-cy=start-date-select]') - .children() - .should('have.value', firstDayOfYear); - }); - - it('check the end date is the current date', () => { - const currentDate = new Date().toISOString().split('T')[0]; - cy.get('[data-cy=end-date-select]') - .children() - .should('have.value', currentDate); - }) - - it('check table\'s existence', () => { - cy.get('[data-cy=report-table]').should("not.exist"); - }) -}); - - From e62aebb68bd2120a5352168843c967a03d92f521 Mon Sep 17 00:00:00 2001 From: ngpmnam Date: Sun, 15 Dec 2024 12:26:07 -0500 Subject: [PATCH 11/11] all tests for issue3 --- farmdata2/farmdata2_modules/cypress/subtabs.spec.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/farmdata2/farmdata2_modules/cypress/subtabs.spec.js b/farmdata2/farmdata2_modules/cypress/subtabs.spec.js index 19654d3b..ea878fb6 100644 --- a/farmdata2/farmdata2_modules/cypress/subtabs.spec.js +++ b/farmdata2/farmdata2_modules/cypress/subtabs.spec.js @@ -18,7 +18,7 @@ describe('Test the UI tabs are accurate for each kind of person logged into Farm }) it('When guest is selected none of the three tabs should appear', () => { - cy.login('guest1', 'farmdata2') + cy.login('guest', 'farmdata2') cy.visit('/farm') cy.get('a.glyphicons-processed[href="/farm/fd2-field-kit"]').should('not.exist') cy.get('a.glyphicons-processed[href="/farm/fd2-barn-kit"]').should('not.exist')