Skip to content

Commit

Permalink
add new flowsheet test
Browse files Browse the repository at this point in the history
  • Loading branch information
MichaelPesce committed Jul 10, 2024
1 parent aa98b6c commit 1a55103
Show file tree
Hide file tree
Showing 2 changed files with 31 additions and 17 deletions.
43 changes: 30 additions & 13 deletions electron/ui/cypress/e2e/FlowsheetTesting.cy.js
Original file line number Diff line number Diff line change
Expand Up @@ -102,32 +102,49 @@ describe('WaterTAP UI Testing', () => {

cy.open_logging_panel()
cy.screenshot('opened_logs')
;

// check that a log line of type info, warning, are present
cy.get('.log-line').contains('INFO')
cy.get('.log-line').contains('WARNING')

cy.screenshot('end-logging-test')
;
})

it('test values rounded to and displayed as 0 retain their original value', () => {
// XXX: This doesn't really test anything different
// XXX: because the flowsheet was changed.

it('tests new flowsheet', () => {
let modelFile = "https://drive.google.com/uc?export=download&id=1XdjuWNpYT9teZxaF8TuwDz0XS2XyXKeT"
let exportFile = "https://drive.google.com/uc?export=download&id=1-jWQmI4wO2OlyUi32fqobFEmPn3zm9Q9"
cy.load_flowsheets_list()
cy.screenshot('loaded flowsheet list page')

// download model and export files
cy.downloadFile(modelFile,'cypress/downloads','testModelFile.py')
cy.downloadFile(exportFile,'cypress/downloads','testModelFile_ui.py')

cy.load_ro_flowsheet()
cy.screenshot('loaded RO flowsheet');
;
cy.findByRole('button', {name: /new flowsheet +/i}).click()
cy.wait(500)

cy.solve_flowsheet()
cy.screenshot("clicked new flowsheet")

// select both files
cy.get('.ModelFile').selectFile('./cypress/downloads/testModelFile.py', {
action: 'drag-drop',
force: true
})
cy.get('.ExportFile').selectFile('./cypress/downloads/testModelFile_ui.py', {
action: 'drag-drop',
force: true
})

cy.wait(500)
cy.screenshot("dragged and dropped files")

cy.get('.upload-flowsheet-button').click()

cy.wait(1000)
cy.screenshot("uploaded files")

// XXX: Test something??
cy.get('.flowsheet-name').contains(/test custom flowsheet/i)
cy.screenshot('end-new-flowsheet-test')

cy.screenshot('end-rounding-test')
;
})
})
Original file line number Diff line number Diff line change
Expand Up @@ -285,14 +285,11 @@ export default function FlowsheetsListTable(props) {
sx={styles.listRow}
onClick={() => handleFlowsheetClick(row.id_, row.built, row.build_options)}
>
<TableCell>{row.description}</TableCell>
<TableCell><p style={{margin:0,padding:0}} className='flowsheet-name'>{row.description}</p></TableCell>
<TableCell
align="right">{formatLastRun(row.last_run)}</TableCell>
<TableCell>
{row.custom &&
// <IconButton size="small" onClick={(e) => handleRemoveCustomFlowsheet(e, row.id_)}>
// <ClearIcon sx={{fontSize: "15px"}}/>
// </IconButton>
<IconButton size="small"
onClick={(e) => handleShowModal(e, row.id_)}>
<ClearIcon sx={{fontSize: "15px"}}/>
Expand Down

0 comments on commit 1a55103

Please sign in to comment.