mirror of
https://github.com/nowcommunity/nowdatabase.git
synced 2026-10-12 19:13:52 +03:00
Merge pull request #292 from nowcommunity/add-tests-for-time-bound
Add tests for time bound
This commit is contained in:
@@ -0,0 +1,27 @@
|
||||
describe("Locality min and max age checks work", () => {
|
||||
beforeEach('Login as admin', () => {
|
||||
cy.login('testSu')
|
||||
})
|
||||
|
||||
it("Editing a locality with contradictory min and max ages does not work", () => {
|
||||
cy.on("uncaught:exception", (error) => {
|
||||
// this is here to ignore the error that happens when you put contradictory data to backend
|
||||
// might ignore errors that should not be ignored too!
|
||||
console.log(error)
|
||||
return false
|
||||
})
|
||||
|
||||
cy.visit(`/locality/20920?tab=0`)
|
||||
cy.contains('Dating method')
|
||||
cy.get('[id=edit-button]').click()
|
||||
// the id's for these next two might change which breaks the test, don't know why
|
||||
cy.get("[id=\\:r1\\:]").first().type("{backspace}{backspace}{backspace}10") // min age input field
|
||||
cy.get("[id=\\:r5\\:]").type("{backspace}{backspace}{backspace}{backspace}{backspace}9") // max age input field
|
||||
cy.contains("Min value cannot be higher than max")
|
||||
cy.get('[id=write-button]').click()
|
||||
cy.get('[id=write-button]').click()
|
||||
// make sure the values didn't change
|
||||
cy.contains("7.2")
|
||||
cy.contains("11.63")
|
||||
})
|
||||
})
|
||||
@@ -85,31 +85,5 @@ describe('Test individual features across the app', () => {
|
||||
doesNotHaveStagingMode('person/AD')
|
||||
})
|
||||
})
|
||||
describe("Min and max age checks work", () => {
|
||||
beforeEach('Login as admin', () => {
|
||||
cy.login('testSu')
|
||||
})
|
||||
|
||||
it("Editing a locality with contradictory min and max ages does not work", () => {
|
||||
cy.on("uncaught:exception", (error) => {
|
||||
// this is here to ignore the error that happens when you put contradictory data to backend
|
||||
// might ignore errors that should not be ignored too!
|
||||
console.log(error)
|
||||
return false
|
||||
})
|
||||
|
||||
cy.visit(`/locality/20920?tab=0`)
|
||||
cy.get('[id=edit-button]').click()
|
||||
// the id's for these next two might change which breaks the test, don't know why
|
||||
cy.get("[id=\\:r1\\:]").first().type("{backspace}{backspace}{backspace}10") // min age input field
|
||||
cy.get("[id=\\:r5\\:]").type("{backspace}{backspace}{backspace}{backspace}{backspace}9") // max age input field
|
||||
cy.contains("Min value cannot be higher than max")
|
||||
cy.get('[id=write-button]').click()
|
||||
cy.get('[id=write-button]').click()
|
||||
// make sure the values didn't change
|
||||
cy.contains("7.2")
|
||||
cy.contains("11.63")
|
||||
})
|
||||
})
|
||||
})
|
||||
|
||||
|
||||
@@ -0,0 +1,31 @@
|
||||
describe("Editing time bound", () => {
|
||||
beforeEach('Login as admin', () => {
|
||||
cy.login('testSu')
|
||||
})
|
||||
beforeEach('Reset database', () => {
|
||||
cy.request(Cypress.env("databaseResetUrl"));
|
||||
});
|
||||
it("User editing time bound with correct values succeeds", () => {
|
||||
cy.visit(`/time-bound/11?tab=0`)
|
||||
cy.contains('C2N-y')
|
||||
cy.get('[id=edit-button]').click()
|
||||
// this id might change which breaks the test, don't know why
|
||||
cy.get("[id=\\:r1\\:]").first().type("{backspace}{backspace}{backspace}{backspace}{backspace}2.5")
|
||||
cy.contains("This field is required").should('not.exist')
|
||||
cy.get('[id=write-button]').click()
|
||||
cy.get('[id=write-button]').click()
|
||||
cy.contains("2.5")
|
||||
})
|
||||
it("User editing time bound with incorrect values is notified about it", () => {
|
||||
cy.visit(`/time-bound/11?tab=0`)
|
||||
cy.contains('C2N-y')
|
||||
cy.get('[id=edit-button]').click()
|
||||
// this id might change which breaks the test, don't know why
|
||||
cy.get("[id=\\:r1\\:]").first().type("{backspace}{backspace}{backspace}{backspace}{backspace}")
|
||||
cy.contains("This field is required")
|
||||
cy.get('[id=write-button]').click()
|
||||
cy.get('[id=write-button]').click()
|
||||
// make sure the age value didn't change
|
||||
cy.contains("1.778")
|
||||
})
|
||||
})
|
||||
Reference in New Issue
Block a user