add answer sheet and delete confirming story text

This commit is contained in:
Annie Huang committed 2023-10-30 15:00:30 +08:00
1 parent fd8433d9f9
commit 3df076d6fd
2 files changed
+9 -65

No files matched your search

+5 -65
View File
@@ -1,4 +1,6 @@
/// <reference types="cypress" />
// import '../quests/helloworld/answer.sh'
export default function checkLoginUI() {
cy.get('h1.text-text-primary')
.should('contain', 'Linux Odyssey')
@@ -24,7 +26,7 @@ export const getQuestInfo = (id) =>
cy.get('#quest').get('p.text-text').contains(`${id}`)
export const getTaskCheckbox = (id) =>
getQuestInfo(`${id}`).findByRole('checkbox')
const YAML = require('yamljs')
// const YAML = require('yamljs')
describe('example helloworld app', () => {
describe('Login tests', () => {
@@ -175,7 +177,7 @@ describe('example helloworld app', () => {
.should('contain', 'zsh: command not found: 12345')
.and('contain', '12345')
})
it('Clear first task', () => {
it('Complete the Game', () => {
cy.get('@Terminaltextbox').type('echo Hello World!{enter}')
cy.get('@Terminaltextbox').should('contain', '你聽到了一個聲音:')
cy.get('@Terminaltextbox').type(
@@ -186,29 +188,8 @@ describe('example helloworld app', () => {
getTaskCheckbox('搜索卷軸').should('not.be.checked')
cy.get('@Terminaltextbox')
.should('contain', `Unix Spirit: `)
.and('contain', '你好,指令官,我是你的 Unix 精靈。我已在此恭候多時。')
.and(
'contain',
`這個世界是在 3560000 時脈以前,由初代王建立了 Unix 律法,所形成的世界。然而在經過了好幾世代的王後,終於誕生了永恆之王——薩加(Saga),她比歷代的君王都更為強大,且從來不會衰老,使得這個世界變得前所未有的強大。`
)
.and(
'contain',
`然而,外在世界一直不斷在改變,同時在面臨外敵的不斷攻擊,而薩加卻始終用同一套治理的手段。最終,在 160000 時脈前的一次入侵中,根部遭到攻陷,薩加遭到封印,而這個國家也陷入了黑暗。`
)
.and(
'contain',
`由於長久以來依賴於薩加,世人已失去了「指令」的力量,即將走向衰敗和滅亡的命運。`
)
.and(
'contain',
`你的任務,就是找回被世人遺忘的指令,奪回 Linux 之根,成為 Linux 之王。`
)
.and('contain', `首先,你必須要學會如何使用指令。`)
.and(
'contain',
`你要學習的第一個指令,是「發現」的指令:\`ls\`。ls 可以用來查看一個目錄中有哪些檔案。`
)
.and('contain', `現在,請你輸入 \`ls\` 來查看目前的目錄下有哪些檔案。`)
cy.get('@Terminaltextbox').type('ls{enter}')
cy.get('#Lbutton').should('be.visible').and('be.disabled')
cy.get('#Rbutton').should('be.visible').and('be.disabled')
cy.get('#hint')
@@ -217,46 +198,5 @@ describe('example helloworld app', () => {
.should('contain', '1/1')
.and('contain', '使用 `ls` 指令來查看目前的目錄下有哪些檔案。')
})
it.only('Clear second task', () => {
clearFirstTask()
// try read from yml todo ignore upper text
cy.get('@gameScript').then((text) => {
const script = YAML.parse(text)
cy.get('@Terminaltextbox').should(
'contain',
script.stages[0].responses[1].content[0]
)
cy.get('@Terminaltextbox')
.get('.xterm-rows')
.find('div')
.each(($el, i) => {
expect($el.text()).to.contain(
// should ignore upper text to match just story part
script.stages[0].responses[1].content[i]
)
})
})
cy.get('@Terminaltextbox').type('ls{enter}')
checkStoryStart()
cy.get('@Terminaltextbox').type('{enter}{enter}{enter}{enter}{enter}')
cy.get('@Terminaltextbox')
.should('contain', `forgotten_scroll.txt`)
.and('contain', '你找到了一個被遺忘的卷軸,上面寫著解除封印的咒語。')
cy.get('@Terminaltextbox').type('{enter}{enter}{enter}{enter}{enter}')
cy.get('@Terminaltextbox')
.and('contain', '使用指令 `cat [檔案名稱]` 來查看檔案內容。')
.and(
'contain',
'我可以為你提供一些指令的提示,只要輸入指令的前幾個字元,然後按下 `Tab` 鍵,就可以看到提示了。'
)
.and(
'contain',
'例如,你可以輸入 `ca` 然後按下 `Tab` 鍵,就可以看到 `cat` 這個指令的提示了。'
)
.and(
'contain',
'檔案名稱也一樣,只要輸入檔案名稱的前幾個字元,然後按下 `Tab` 鍵,就可以看到提示了。'
)
})
})
})