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

Test Seeding Report message with Cypress #160

Open
wants to merge 11 commits into
base: main
Choose a base branch
from
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
describe('Test the message of the BarnKit Seeding Report if there are no logs', () => {
beforeEach(() => {
cy.login('manager1', 'farmdata2')

// Cypress clears the local storage between each test.
// So we need to save it at the end of each test (see afterEach)
// and then restore before each test (here).
cy.restoreLocalStorage()
cy.visit('/farm/fd2-barn-kit/seedingReport')
})

afterEach(() => {
// Save the local storage at the end of each test so
// that it can be restored at the start of the next
cy.saveLocalStorage()
})

it('Test the text of the message if there are no rows in the table', () => {
cy.get('[data-cy=start-date-select]')
.type('2024-01-01')
cy.get('[data-cy=end-date-select]')
.type('2024-01-02')
cy.get('[data-cy=generate-rpt-btn]')
.click()

cy.get('[data-cy=no-logs-message]')
.contains('No Logs Found in These Dates')
})
})
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
describe('Tests the default contents of the Data section of the Seeding Input Form', () => {
beforeEach(() => {
cy.login('manager1', 'farmdata2')

// Cypress clears the local storage between each test.
// So we need to save it at the end of each test (see afterEach)
// and then restore beore each test (here).
cy.restoreLocalStorage()
cy.visit('/farm/fd2-field-kit/seedingInput')
})

afterEach(() => {
// Save the local storage at the end of each test so
// that it can be restored at the start of the next
cy.saveLocalStorage()
})

//Gabe
it('', () => {

})

//Spencer
it('', () => {

})

//Maximo
it('Tests the crop dropdown so that it does not have a selected value and the correct crop list', () => {
cy.get("[data-cy=crop-selection] > [data-cy=dropdown-input]").should("have.text", "")
cy.get("[data-cy=crop-selection] > [data-cy=dropdown-input] > [data-cy=option0]").should("have.text", "ARUGULA")
cy.get("[data-cy=crop-selection] > [data-cy=dropdown-input] > [data-cy=option8]").should("have.text", "BROCCOLI")
cy.get("[data-cy=crop-selection] > [data-cy=dropdown-input] > [data-cy=option32]").should("have.text", "GARLIC-SCAPES")
cy.get("[data-cy=crop-selection] > [data-cy=dropdown-input] > [data-cy=option110]").should("have.text", "ZUCCHINI")
cy.get("[data-cy=crop-selection] > [data-cy=dropdown-input]").children().should("have.length", 111)
})
})
8 changes: 8 additions & 0 deletions farmdata2/farmdata2_modules/fd2_school/fd2_school.module
Original file line number Diff line number Diff line change
Expand Up @@ -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;
};
Expand Down
74 changes: 74 additions & 0 deletions farmdata2/farmdata2_modules/fd2_school/html/html.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,74 @@
<div>
<h1>Harvest Report</h1>
<p>This page is a <i>mockup</i> of a simplified harvest report.</p>

<label for="title">Title:</label>
<input type="text" id="title" name="title" />

<br><br>

<label for="startDate">Start:</label>
<input type="date" id="startDate" name="startDate" min="2014-01-01" max="2022-01-01" value="2020-05-05" />
<label for="endDate">End:</label>
<input type="date" id="endDate" name="endDate" min="2020-05-05" max="2022-01-01" value="2020-05-15" />

<br><br>

<label for="crop">Crop:</label>
<select id="crop" name="crop">
<option>Broccoli</option>
<option selected>Kale</option>
<option>Peas</option>
</select>

<label for="field">Field:</label>
<select id="field" name="field">
<option selected>All</option>
<option>Chuau-1</option>
<option>SQ7</option>
</select>

<br><br>

<input type="button" value="Generate Report" />

<hr>

<h1>My Sample Harvest Report</h1>
<p>Details:</p>
<ul>
<li><strong>Farm: </strong>Sample Farm</li>
<li><strong>User: </strong>manager1</li>
<li><strong>Language: </strong>English</li>
<br>
<li><strong>Start: </strong>05/01/2018</li>
<li><strong>End: </strong>05/15/2018</li>
<li><strong>Crop: </strong>Kale</li>
</ul>

<br>

<table border="1">
<tr>
<th>Date</th>
<th>Area</th>
<th>Crop</th>
<th>Yield</th>
<th>Units</th>
</tr>
<tr>
<td>05/02/2018</td>
<td>Chuau-1</td>
<td>Kale</td>
<td>10</td>
<td>Bunches</td>
</tr>
<tr>
<td>05/05/2018</td>
<td>SQ7</td>
<td>Kale</td>
<td>7</td>
<td>Bunches</td>
</tr>
</table>
</div>