fix cypress command format

This commit is contained in:
Annie committed 2023-11-21 14:20:55 +08:00
1 parent f7907a5999
commit cc03e57c70
1 file changed
+17 -17
+17 -17
View File
@@ -18,7 +18,7 @@ Cypress.Commands.add('PrepareForGame', () => {
cy.get('.xterm-screen', { timeout: 10000 }) cy.get('.xterm-screen', { timeout: 10000 })
.as('Terminaltextbox') .as('Terminaltextbox')
.should('be.visible') .should('be.visible')
cy.CheckTextElement('#reset','重來','Reset').click() cy.CheckTextElement('#reset', '重來', 'Reset').click()
cy.typeInCommand('clear{enter}') cy.typeInCommand('clear{enter}')
cy.get('@Terminaltextbox', { timeout: 150000 }).should( cy.get('@Terminaltextbox', { timeout: 150000 }).should(
'contain', 'contain',
@@ -66,23 +66,23 @@ Cypress.Commands.add('checkPending', () => {
Cypress.Commands.add('Complete the Stage (only command)', () => { Cypress.Commands.add('Complete the Stage (only command)', () => {
cy.log('') cy.log('')
}) })
Cypress.Commands.add('CheckTextElement',(id,chText,enText)=>{ Cypress.Commands.add('CheckTextElement', (id, chText, enText) => {
cy.get(id).within(($element)=>{ cy.get(id).within(($element) => {
if(Cypress.env('isCHVersion')){ if (Cypress.env('isCHVersion')) {
cy.get($element).should('contain',chText).and('be.visible') cy.get($element).should('contain', chText).and('be.visible')
} } else {
else{ cy.get($element).should('contain', enText).and('be.visible')
cy.get($element).should('contain',enText).and('be.visible')
} }
}) })
}) })
Cypress.Commands.add('CheckPlaceholder',(id,chText,enText)=>{ Cypress.Commands.add('CheckPlaceholder', (id, chText, enText) => {
cy.get(id).invoke('attr', 'placeholder').then(($placeHolder)=>{ cy.get(id)
if(Cypress.env('isCHVersion')){ .invoke('attr', 'placeholder')
expect($placeHolder).eq(chText) .then(($placeHolder) => {
} if (Cypress.env('isCHVersion')) {
else{ expect($placeHolder).eq(chText)
expect($placeHolder).eq(enText) } else {
} expect($placeHolder).eq(enText)
}) }
})
}) })