Update tests:

- Add public command to press enter until story end
- Add public command to check status pending
This commit is contained in:
Annie Huang committed 2023-11-13 15:19:54 +08:00
1 parent 5d7c922fa6
commit c86163fd10
2 files changed
+36 -18

No files matched your search

+20 -1
View File
@@ -27,7 +27,8 @@ Cypress.Commands.add('typeInCommand', (command) => {
Cypress.Commands.add('getQuestInfo', (id) => {
return cy
.get('#quest')
.find('p.text-text')
.find('li')
.find('p')
.contains(`${id}`, { timeout: 100000 })
})
Cypress.Commands.add('checkHint', (index, total) => {
@@ -36,3 +37,21 @@ Cypress.Commands.add('checkHint', (index, total) => {
.contains(`${index}/${total}`)
.should('be.visible')
})
Cypress.Commands.add('waitUntilActive', () => {
cy.get('input[id="currentStatus"]', { timeout: 1000000 })
.invoke('val')
.then((value) => {
if (value === 'active' || value === 'finished') {
cy.log('story ends')
return
}
cy.typeInCommand('{enter}')
cy.waitUntilActive()
})
})
Cypress.Commands.add('checkPending', () => {
cy.get('input[id="currentStatus"]', { timeout: 1000000 }).should(
'have.value',
'pending'
)
})