Skip to content

Commit

Permalink
setup for test "create and setup a data trial" including new helper f…
Browse files Browse the repository at this point in the history
…unction
  • Loading branch information
nstclair-cc committed Jun 27, 2024
1 parent e492e2e commit 7d67581
Show file tree
Hide file tree
Showing 2 changed files with 51 additions and 0 deletions.
35 changes: 35 additions & 0 deletions cypress/integration/branch/experiment.setup.spec.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import ExperimentSetup from "../../supports/elements/ExperimentSetup"
import SensorData from "../../supports/elements/SensorData"

context("Testing Experiment Selection View", () => {

Expand All @@ -15,6 +16,8 @@ context("Testing Experiment Selection View", () => {
let studySite2 = "Study Site #2"
let defaultSchoolyardInvestigation = "Schoolyard Investigation #1"

let sensorData = new SensorData();

before(() => {
cy.visit(url);
});
Expand Down Expand Up @@ -100,4 +103,36 @@ context("Testing Experiment Selection View", () => {
experimentSetup.deleteExperiment()
})
})

describe("Tests Data Trial", () => {

it.only("create and setup a data trial", () => {
experimentSetup.openNewExperiment('Data Trial')
//cy.wait(500)

sensorData.getExperimentOptionsMenu() // gets the click in the helper function
sensorData.selectMenuOption('Connect')

// Select and verify the "Mocked Sensor: Temperature" option
sensorData.selectSensor('Temperature')
cy.get('div.sensor-module-connectionLabel-vortex select')
.should('have.value', '1');

})
// this is pasted code from above
// it("edit experiment and verify changes", () => {
// experimentSetup.getExperiment('Stream Study', 1).click()
// experimentSetup.getExperimentNameSpan().click()
// experimentSetup.getNameInput().type(testLabel2)
// experimentSetup.getGroupMembersTextBox().type(testGroupMembers)
// experimentSetup.getSubheader(testLabel2)
// experimentSetup.getBackButton().click()
// experimentSetup.expandAllExperimentLabels()
// experimentSetup.getExperimentLabel(testLabel2).should('be.visible')
// })

// it("deletes Stream Study experiment", () => {
// experimentSetup.deleteExperiment()
// })
})
})
16 changes: 16 additions & 0 deletions cypress/supports/elements/SensorData.js
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,22 @@ class SensorData {
cy.get('.sensor-value-module-connectedValue-vortex')
})
}
selectSensor(input){
// Click to focus on the select dropdown (adjust the selector as needed)
cy.get('div.sensor-module-connectionLabel-vortex select').focus();

if (input === 'Force') {
// Select the "Mocked Sensor: Force" option
cy.get('div.sensor-module-connectionLabel-vortex select').select('Mocked Sensor: Force');
return 'Mocked Sensor: Force';
} else if (input === 'Temperature') {
// Select the "Mocked Sensor: Temperature" option
cy.get('div.sensor-module-connectionLabel-vortex select').select('Mocked Sensor: Temperature');
return 'Mocked Sensor: Temperature';
} else {
throw new Error('Invalid input: please specify either "Force" or "Temperature"');
}
}

getDataRow(index) {
return cy.get('.data-table-field-module-refreshSensorReading-vortex').eq(index - 1).parent().parent()
Expand Down

0 comments on commit 7d67581

Please sign in to comment.