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

65 lines
1.4 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(4) > .nav-link').click({force: true})
cy.get('.pe-3 > .btn').click() // click add new teacher
cy.get('.row > :nth-child(2) > .form-control')
.clear()
.type('new teacher first name')
cy.get('.row > :nth-child(3) > .form-control')
.clear()
.type('new teacher last name')
cy.get('.row > :nth-child(6) > .form-control')
.clear()
.type('[email protected]')
cy.get('.row > :nth-child(7) > .form-control')
.clear()
.type('123321')
cy.get(':nth-child(8) > #floatingTextarea2')
.clear()
.type('new teacher contact')
cy.get(':nth-child(9) > #floatingTextarea2')
.clear()
.type('new teacher skill set')
// click add
cy.get('form > .btn').click()
cy.get('#users-table_wrapper').contains('[email protected]')
cy.contains('[email protected]')
.parent()
.find('.btn-danger')
.click();
cy.get('.d-sm-inline').click()
})
})