Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Tri 31401 e2e test stage #150

Merged
merged 4 commits into from
Jan 30, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 0 additions & 2 deletions tests/.gitignore

This file was deleted.

3 changes: 1 addition & 2 deletions ui/cypress.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -32,8 +32,7 @@ module.exports = defineConfig({
testIsolation: false,

specPattern: 'cypress/e2e/**/*.feature',

supportFile:false
supportFile: 'cypress/support/commands.js',

},

Expand Down
14 changes: 6 additions & 8 deletions ui/cypress/e2e/graphSlider.feature
Original file line number Diff line number Diff line change
Expand Up @@ -4,20 +4,18 @@ Feature: Validation of RPV and LE

Given I open the Oxidation State Analyser website

When I enter LiMn2O4 in Chemical composition text box
When I enter "LiMn2O4" in Chemical composition text box and submit

When I click Submit
Then I capture "current" RPV

Then I capture current RPV

Then I capture current LE
Then I capture "current" LE

Then I click on new toggle value

Then I capture new RPV
Then I capture "new" RPV

Then I capture new LE
Then I capture "new" LE

Then I verify the RPV and LE changes
Then I verify the "RPV" and "LE" changes

#Then the indicator should move
95 changes: 11 additions & 84 deletions ui/cypress/e2e/graphSlider/graphSlider.js
Original file line number Diff line number Diff line change
@@ -1,107 +1,34 @@
import { Given, When, Then, And } from 'cypress-cucumber-preprocessor/steps';
import "cypress-xpath";
const genFilesPath = "cypress/fixtures/rpv.text"
const leFilesPath = "cypress/fixtures/le.text"
const newRpvPath = "cypress/fixtures/newRpv.text"
const newleFilesPath = "cypress/fixtures/newLe.text"
//cy.writeFile(genFilesPath,'test') tested


const sometext='';

Given('I open the Oxidation State Analyser website', () => {

cy.visit(Cypress.config().baseUrl)
cy.intercept('POST', '/api', { fixture: 'response.json' })
cy.log('NAVIGATING TO OXIDATION ANALYSER WEB')
cy.wait(10000)
cy.get('#input-section-chemical-composition').should("be.visible")
cy.screenshot()


cy.login()
});


When('I enter LiMn2O4 in Chemical composition text box', () => {
cy.log('Entering LiMnO4 in chemical input')
cy.get('#input-section-chemical-composition').should("be.visible")
.type('LiMn2O4')
When('I enter {string} in Chemical composition text box and submit', chemical => {
cy.analyse(chemical)

});


When('I click Submit',()=> {
cy.get('#input-section-submit-button')
.should('be.visible')
.click()

});


Then('I capture current RPV', () => {
cy.get('input[id="ecp-input"]')
.invoke('val')
.then(sometext => cy.writeFile(genFilesPath,sometext));
cy.log('The RPV value at first record is');

Then('I capture {string} RPV', (currentorNew) => {
cy.captureRPV(currentorNew)
});

Then('I capture current LE', () => {

const items = []
cy.get('[data-field="likelihoodCurrentElecChemPotential"]')
.each(($li) => items.push($li.text()))
.then( () => {
cy.writeFile(leFilesPath,items)
})
Then('I capture {string} LE', (currentorNew) => {
cy.captureLE(currentorNew)
})


Then('I click on new toggle value', () => {

cy.wait(5000)
cy.get("[id='next-nudge']")
.should('be.visible')
.click()
.click()
cy.setToggle()
});


Then('I capture new RPV', () => {
cy.wait(5000)
cy.get('input[id="ecp-input"]')
.invoke('val')
.then(newRpv => cy.writeFile(newRpvPath,newRpv));
cy.readFile('cypress/fixtures/rpv.text')
})


Then('I capture new LE', () => {

const items = []
cy.get('[data-field="likelihoodCurrentElecChemPotential"]')
.each(($li) => items.push($li.text()))
.then( () => {
//cy.log(items.join(','))
cy.writeFile(newleFilesPath,items)
})
})


Then('I verify the RPV and LE changes', () => {

cy.fixture('rpv.text').then(fixture => {
cy.readFile(newRpvPath).then(download => {
assert.notEqual(fixture,download, " RPV Changes")
})
})

cy.fixture('le.text').then(oldle => {
cy.readFile(newleFilesPath).then(newle => {
assert.notEqual(oldle,newle, "LE Changes")
})
})

Then('I verify the {string} and {string} changes', (label1,label2) => {
cy.verifyChanges(label1)
cy.verifyChanges(label2)
})


Expand Down
14 changes: 8 additions & 6 deletions ui/cypress/e2e/rowInteraction.feature
Original file line number Diff line number Diff line change
Expand Up @@ -4,16 +4,18 @@ Feature: Validation of Graph Slider and RPV

Given I open the Oxidation State Analyser website

When I enter "LiMn2O4" in Chemical composition text box

When I click Submit
When I enter "LiMn2O4" in Chemical composition text box and submit

When I click row number 2

Then I capture "current" RPV and graph slider position
Then I capture "current" RPV

Then I capture "current" graph slider position

When I click row number 3

Then I capture "new" RPV and graph slider position
Then I capture "new" RPV

Then I capture "new" graph slider position

Then I validate the changes in RPV and graph slider position
Then I verify the "RPV" and "Graph" changes
58 changes: 12 additions & 46 deletions ui/cypress/e2e/rowInteraction/rowInteraction.js
Original file line number Diff line number Diff line change
@@ -1,65 +1,31 @@
import { Given, When, Then, And } from 'cypress-cucumber-preprocessor/steps';
import "cypress-xpath";
const rowsliderPath = "cypress/fixtures/rowslider.text"
const rowrpvPath = "cypress/fixtures/rowrpv.text"
const rownewSliderPath = "cypress/fixtures/rownewSlider.text"
const rownewrpvPath = "cypress/fixtures/rownewrpv.text"


const sometext='';

Given('I open the Oxidation State Analyser website', () => {

cy.visit(Cypress.config().baseUrl)
cy.intercept('POST', '/api', { fixture: 'response.json' })


cy.login()
});


When('I enter {string} in Chemical composition text box', chemical => {

cy.log('Entering Chemical in chemical input')
cy.get('#input-section-chemical-composition').should("be.visible")
.type(chemical)
When('I enter {string} in Chemical composition text box and submit', chemical => {
cy.analyse(chemical)

});


When('I click Submit',()=> {
cy.get('#input-section-submit-button')
.should('be.visible')
.click()
cy.wait(5000)

});


When('I click row number {int}', (row) => {
let actualRow=row-1
let theXpath="//*[@data-rowindex="+actualRow+"]"
// cy.xpath("//*[@data-id='row' and @data-rowindex='row']").click()
cy.xpath(theXpath).click()
cy.clickRow(row)
})


Then('I capture {string} RPV and graph slider position',currentorNew => {
let filePath="cypress/fixtures/"+currentorNew+"rowrpv.text"
cy.get('input[id="ecp-input"]')
.invoke('val')
.then(sometext => cy.writeFile(filePath,sometext));
cy.log('The RPV value at first record is');
Then('I capture {string} RPV', (currentorNew) => {
cy.captureRPV(currentorNew)
})

cy.get('[data-rcs="clip-item"]')
.invoke('attr', 'style').then(some => cy.writeFile(filePath,some, {flag : 'a+'}));
cy.log('The Slider style value at first record is');
Then('I capture {string} graph slider position', (currentorNew) => {
cy.captureGraph(currentorNew)
})


Then('I validate the changes in RPV and graph slider position', () => {
cy.fixture('currentrowrpv.text').then(fixture => {
cy.readFile('cypress/fixtures/newrowrpv.text').then(download => {
assert.notEqual(fixture,download, " RPV and Slider Position Changes when row selection changes")
})
})
Then('I verify the {string} and {string} changes', (label1,label2) => {
cy.verifyChanges(label1)
cy.verifyChanges(label2)
})
16 changes: 7 additions & 9 deletions ui/cypress/e2e/rpvInteraction.feature
Original file line number Diff line number Diff line change
Expand Up @@ -4,20 +4,18 @@ Feature: Validation of Graph Slider and LE

Given I open the Oxidation State Analyser website

When I enter LiMn2O4 in Chemical composition text box
When I enter "LiMn2O4" in Chemical composition text box and submit

When I click Submit
Then I capture "current" graph slider position

Then I capture current graph slider position
Then I capture "current" LE

Then I capture current LE
Then I enter new RPV "5.0000"

Then I enter new RPV
Then I capture "new" graph slider position

Then I capture new graph slider position
Then I capture "new" LE

Then I capture new LE

Then I verify the graph slider and LE changes
Then I verify the "LE" and "Graph" changes

#Then the indicator should move
Loading
Loading