Skip to content

Commit

Permalink
Merge pull request #179 from TRI-AMDD/TRI-32907-test-validation-tests…
Browse files Browse the repository at this point in the history
…-for-additional-elements

Tri 32907 test validation tests for additional elements
  • Loading branch information
harisilpa-davanam authored Mar 26, 2024
2 parents d52d8dc + 449e913 commit e33a594
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 0 deletions.
1 change: 1 addition & 0 deletions web/frontend/cypress/e2e/ui_fieldsPiro/ui_fieldsPiro.js
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,7 @@ Then('ICSD-based Precursors Only checkbox should be available', () => {

Then('Additional elements to consider field should be available', () => {
cy.verifyById("react-select-2-input")
cy.validateAdditionalElementsField()
})

Then('Explicity include as a preCursor field should be available', () => {
Expand Down
16 changes: 16 additions & 0 deletions web/frontend/cypress/support/commands.js
Original file line number Diff line number Diff line change
Expand Up @@ -78,4 +78,20 @@ Cypress.Commands.add('validateErr', (tc,temperature,comp,depth) => {
}else if(tc.trim() === ''){
cy.xpath("//input[@name='target_entry_id']").nextAll().invoke('text').should('eq',Cypress.config().errmsg1)
}
})

Cypress.Commands.add('validateAdditionalElementsField', () => {
cy.enterValidElements("na","Na")
cy.enterValidElements("PB","Pb")
cy.enterValidElements("Mn","Mn")
cy.get("[id='react-select-2-input']").type("Mn")
cy.xpath("//div[@class=' css-nhbbvo-NoOptionsMessage2']").invoke('text').should('eq','No options')
cy.get("[id='react-select-2-input']").clear().type("SS")
cy.xpath("//p[@style='color: red;']").invoke('text').should('eq','Not an element')
})

Cypress.Commands.add('enterValidElements', (elementName,message) => {
cy.get("[id='react-select-2-input']").clear().type(elementName)
cy.xpath("//div[@id='react-select-2-listbox']/div").click()
cy.xpath("//div[@class=' css-1y7rh0y-MultiValueGeneric2']").invoke('text').should('eq',message)
})

0 comments on commit e33a594

Please sign in to comment.