mirror of
https://github.com/linux-odyssey/linux-odyssey.git
synced 2026-11-06 03:20:13 +08:00
Add check chtext element and ids,fix quest problem
This commit is contained in:
1 parent
9da23b5dc1
commit
869f01a62b
11 files changed
+90
-78
No files matched your search
@@ -5,8 +5,7 @@ Cypress.Commands.add('LoginWithPassword', (username, password) => {
|
||||
cy.visit('/login')
|
||||
cy.get('#username').type(username)
|
||||
cy.get('#password').type(password)
|
||||
cy.findByRole('button', { name: 'Log In' }).click()
|
||||
cy.url().should('include', '/game')
|
||||
cy.get('#LogInOrSignUp').click()
|
||||
})
|
||||
Cypress.Commands.add('PrepareForGame', () => {
|
||||
cy.visit('/')
|
||||
@@ -14,11 +13,12 @@ Cypress.Commands.add('PrepareForGame', () => {
|
||||
Cypress.env('defaultAccount'),
|
||||
Cypress.env('defaultPassword')
|
||||
)
|
||||
cy.url().should('include', '/game')
|
||||
cy.visit('/game/helloworld')
|
||||
cy.get('.xterm-screen', { timeout: 10000 })
|
||||
.as('Terminaltextbox')
|
||||
.should('be.visible')
|
||||
cy.findByRole('button', { name: 'Reset' }).click()
|
||||
cy.CheckTextElement('#reset','重來','Reset').click()
|
||||
cy.typeInCommand('clear{enter}')
|
||||
cy.get('@Terminaltextbox', { timeout: 150000 }).should(
|
||||
'contain',
|
||||
@@ -66,3 +66,23 @@ Cypress.Commands.add('checkPending', () => {
|
||||
Cypress.Commands.add('Complete the Stage (only command)', () => {
|
||||
cy.log('')
|
||||
})
|
||||
Cypress.Commands.add('CheckTextElement',(id,chText,enText)=>{
|
||||
cy.get(id).within(($element)=>{
|
||||
if(Cypress.env('isCHVersion')){
|
||||
cy.get($element).should('contain',chText).and('be.visible')
|
||||
}
|
||||
else{
|
||||
cy.get($element).should('contain',enText).and('be.visible')
|
||||
}
|
||||
})
|
||||
})
|
||||
Cypress.Commands.add('CheckPlaceholder',(id,chText,enText)=>{
|
||||
cy.get(id).invoke('attr', 'placeholder').then(($placeHolder)=>{
|
||||
if(Cypress.env('isCHVersion')){
|
||||
expect($placeHolder).eq(chText)
|
||||
}
|
||||
else{
|
||||
expect($placeHolder).eq(enText)
|
||||
}
|
||||
})
|
||||
})
|
||||
Reference in new issue
Block a user