Files
004_comission/nssheung/School-Management-System/test/E2E/cypress/e2e/as-a-admin/add-student.cy.js
louiscklaw 653422de08 update,
2025-01-31 21:09:49 +08:00

60 lines
1.3 KiB
JavaScript

Cypress.on('uncaught:exception', (err, runnable) => {
// returning false here prevents Cypress from
// failing the test
return false
})
describe('example to-do app', () => {
beforeEach(() => {
cy.visit('http://localhost:8000/sign-in')
})
it('can login and logout', () => {
cy.get(':nth-child(2) > .form-control').type('[email protected]')
cy.get(':nth-child(3) > .form-control').type('admin')
cy.get('.btn').click()
cy.wait(1000)
cy.get('.navbar-nav > :nth-child(3)').click()
cy.get('.pe-3 > .btn').click() // click add new student
cy.get('.row > :nth-child(1) > .form-control')
.clear()
.type('new student first name')
cy.get(':nth-child(2) > .form-control')
.clear()
.type('new student last name')
cy.get(':nth-child(5) > .form-control')
.clear()
.type('[email protected]')
cy.get(':nth-child(6) > .form-control')
.clear()
.type('123321') // password
cy.get('#floatingTextarea2')
.clear()
.type('new student address')
cy.get('form > .btn').click() // click add
// will return to table screen
cy.get('#users-table_wrapper').contains('[email protected]')
cy.contains('[email protected]')
.parent()
.find('.btn-danger')
.click();
// cy.get('.d-sm-inline').click()
})
})