mirror of
https://github.com/linux-odyssey/linux-odyssey.git
synced 2026-11-08 11:30:12 +08:00
fix cypress fail
This commit is contained in:
1 parent
66adfec365
commit
277d619518
2 files changed
+11
-9
No files matched your search
@@ -137,7 +137,7 @@ describe('example helloworld app', () => {
|
|||||||
it('Typing in Terminal', () => {
|
it('Typing in Terminal', () => {
|
||||||
cy.typeInCommand('12345{enter}')
|
cy.typeInCommand('12345{enter}')
|
||||||
cy.get('@Terminaltextbox')
|
cy.get('@Terminaltextbox')
|
||||||
.should('contain', 'zsh: command not found: 12345')
|
.should('contain', 'zsh: command not found: 12345', { timeout: 50000 })
|
||||||
.and('contain', '12345')
|
.and('contain', '12345')
|
||||||
})
|
})
|
||||||
it('Complete the Game(relating UI)', () => {
|
it('Complete the Game(relating UI)', () => {
|
||||||
@@ -187,9 +187,7 @@ describe('example helloworld app', () => {
|
|||||||
// Check survey dialog pop up
|
// Check survey dialog pop up
|
||||||
cy.CheckTextElement('#QuestCompleted', '關卡完成!', 'Quest Completed!')
|
cy.CheckTextElement('#QuestCompleted', '關卡完成!', 'Quest Completed!')
|
||||||
cy.get('div[class="modal"]').find('p').should('be.visible')
|
cy.get('div[class="modal"]').find('p').should('be.visible')
|
||||||
cy.findByRole('link', { name: '回到地圖' }, { timeout: 30000 }).should(
|
cy.get('#BacktoMap').should('contain', '回到地圖').and('be.visible')
|
||||||
'be.visible'
|
|
||||||
)
|
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
|
|||||||
@@ -9,13 +9,21 @@ Cypress.Commands.add('LoginWithPassword', (username, password) => {
|
|||||||
})
|
})
|
||||||
Cypress.Commands.add('PrepareForGame', () => {
|
Cypress.Commands.add('PrepareForGame', () => {
|
||||||
cy.visit('/')
|
cy.visit('/')
|
||||||
|
// make sure the login page is loaded
|
||||||
|
cy.url().should('satisfy', (elements) => {
|
||||||
|
const text = elements
|
||||||
|
return text.includes('login') || text.includes('register')
|
||||||
|
})
|
||||||
cy.LoginWithPassword(
|
cy.LoginWithPassword(
|
||||||
Cypress.env('defaultAccount'),
|
Cypress.env('defaultAccount'),
|
||||||
Cypress.env('defaultPassword')
|
Cypress.env('defaultPassword')
|
||||||
)
|
)
|
||||||
|
// make sure the map page is loaded
|
||||||
cy.url().should('include', '/map')
|
cy.url().should('include', '/map')
|
||||||
cy.visit('/game/helloworld')
|
cy.visit('/game/helloworld')
|
||||||
cy.get('.xterm-screen', { timeout: 10000 })
|
// make sure the game page is loaded
|
||||||
|
cy.url().should('include', '/game/helloworld')
|
||||||
|
cy.get('.xterm-screen', { timeout: 30000 })
|
||||||
.as('Terminaltextbox')
|
.as('Terminaltextbox')
|
||||||
.should('be.visible')
|
.should('be.visible')
|
||||||
cy.CheckTextElement('#reset', '重來', 'Reset').click()
|
cy.CheckTextElement('#reset', '重來', 'Reset').click()
|
||||||
@@ -24,10 +32,6 @@ Cypress.Commands.add('PrepareForGame', () => {
|
|||||||
'contain',
|
'contain',
|
||||||
'commander:~ $'
|
'commander:~ $'
|
||||||
)
|
)
|
||||||
cy.get('@Terminaltextbox', { timeout: 150000 }).should(
|
|
||||||
'contain',
|
|
||||||
'commander:~ $'
|
|
||||||
)
|
|
||||||
})
|
})
|
||||||
Cypress.Commands.add('typeInCommand', (command) => {
|
Cypress.Commands.add('typeInCommand', (command) => {
|
||||||
cy.get('.xterm-screen', { timeout: 150000 }).type(command)
|
cy.get('.xterm-screen', { timeout: 150000 }).type(command)
|
||||||
|
|||||||
Reference in new issue
Block a user