mirror of
https://github.com/linux-odyssey/linux-odyssey.git
synced 2026-11-07 19:10:12 +08:00
Update function in command.js
This commit is contained in:
1 parent
a351eef898
commit
030b7b749e
2 files changed
+23
-24
No files matched your search
@@ -32,8 +32,16 @@ Cypress.Commands.add('LoginWithPassword', (username, password) => {
|
||||
cy.get('#password').type(password)
|
||||
cy.findByRole('button', { name: 'Log in' }).click()
|
||||
})
|
||||
Cypress.Commands.add('PrepareForGame', () => {
|
||||
cy.visit('/')
|
||||
cy.LoginWithPassword('alex', '123456')
|
||||
cy.get('.xterm-screen').as('Terminaltextbox').should('be.visible')
|
||||
cy.findByRole('button', { name: 'Reset' }).click()
|
||||
cy.typeInCommand('clear{enter}')
|
||||
cy.get('@Terminaltextbox').should('contain', 'commander:~ $')
|
||||
})
|
||||
Cypress.Commands.add('typeInCommand', (command) => {
|
||||
cy.get('.xterm-screen').type(command)
|
||||
cy.get('.xterm-screen', { timeout: 150000 }).type(command)
|
||||
})
|
||||
Cypress.Commands.add('getQuestInfo', (id) => {
|
||||
return cy.get('#quest').find('p.text-text').contains(`${id}`)
|
||||
@@ -41,3 +49,9 @@ Cypress.Commands.add('getQuestInfo', (id) => {
|
||||
Cypress.Commands.add('getTaskCheckbox', (id) => {
|
||||
return cy.getQuestInfo(id).findByRole('checkbox')
|
||||
})
|
||||
Cypress.Commands.add('checkHint', (index, total) => {
|
||||
cy.get('#hint')
|
||||
.get('.flex-wrap')
|
||||
.contains(`${index}/${total}`)
|
||||
.should('be.visible')
|
||||
})
|
||||
Reference in new issue
Block a user