mirror of
https://github.com/linux-odyssey/linux-odyssey.git
synced 2026-11-06 03:20:13 +08:00
fix type error
This commit is contained in:
1 parent
2b495f7cda
commit
2cb82fdcdc
2 files changed
+377
-330
No files matched your search
@@ -2,9 +2,8 @@
|
|||||||
import '@testing-library/cypress/add-commands'
|
import '@testing-library/cypress/add-commands'
|
||||||
|
|
||||||
declare global {
|
declare global {
|
||||||
declare namespace Cypress {
|
namespace Cypress {
|
||||||
interface Chainable {
|
interface Chainable {
|
||||||
// 確保你有正確的泛型參數
|
|
||||||
LoginWithPassword(username: string, password: string): Chainable<void>
|
LoginWithPassword(username: string, password: string): Chainable<void>
|
||||||
PrepareForGame(): Chainable<void>
|
PrepareForGame(): Chainable<void>
|
||||||
InitTerminal(): Chainable<void>
|
InitTerminal(): Chainable<void>
|
||||||
@@ -101,7 +100,7 @@ Cypress.Commands.add('waitUntilActive', (last = false) => {
|
|||||||
if (value === 'pending' && !last) {
|
if (value === 'pending' && !last) {
|
||||||
cy.log(`${last}`)
|
cy.log(`${last}`)
|
||||||
cy.typeInCommand('{enter}')
|
cy.typeInCommand('{enter}')
|
||||||
cy.waitUntilActive()
|
cy.waitUntilActive(last) // Pass `last` parameter
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
@@ -119,8 +118,7 @@ Cypress.Commands.add('CompleteStageWithCommands', (stagename) => {
|
|||||||
cy.CheckTextElement('#reset', '重來', 'Reset').click()
|
cy.CheckTextElement('#reset', '重來', 'Reset').click()
|
||||||
cy.checkTaskInit()
|
cy.checkTaskInit()
|
||||||
cy.InitTerminal()
|
cy.InitTerminal()
|
||||||
cy.readFile(`../quests/${stagename}/answer.sh`, 'utf-8').as('answers')
|
cy.readFile(`../quests/${stagename}/answer.sh`, 'utf-8').then((answers) => {
|
||||||
cy.get('@answers').then((answers) => {
|
|
||||||
const answerarr = answers.split('\n')
|
const answerarr = answers.split('\n')
|
||||||
for (const element of answerarr) {
|
for (const element of answerarr) {
|
||||||
cy.typeInCommand(`${element}{enter}`)
|
cy.typeInCommand(`${element}{enter}`)
|
||||||
|
|||||||
Reference in new issue
Block a user