mirror of
https://github.com/linux-odyssey/linux-odyssey.git
synced 2026-11-08 11:30:12 +08:00
fix format
This commit is contained in:
1 parent
869f01a62b
commit
5d26029166
1 file changed
+57
-23
@@ -3,7 +3,7 @@ export default function checkLoginUI() {
|
|||||||
cy.get('h1.text-text-primary')
|
cy.get('h1.text-text-primary')
|
||||||
.should('contain', 'Linux Odyssey')
|
.should('contain', 'Linux Odyssey')
|
||||||
.and('be.visible')
|
.and('be.visible')
|
||||||
cy.CheckPlaceholder('#password','密碼','Password')
|
cy.CheckPlaceholder('#password', '密碼', 'Password')
|
||||||
}
|
}
|
||||||
describe('example helloworld app', () => {
|
describe('example helloworld app', () => {
|
||||||
describe('Login tests', () => {
|
describe('Login tests', () => {
|
||||||
@@ -12,30 +12,58 @@ describe('example helloworld app', () => {
|
|||||||
})
|
})
|
||||||
it('Check Login Page Elements-Register', () => {
|
it('Check Login Page Elements-Register', () => {
|
||||||
checkLoginUI()
|
checkLoginUI()
|
||||||
cy.CheckPlaceholder('#username','帳號名稱','Username')
|
cy.CheckPlaceholder('#username', '帳號名稱', 'Username')
|
||||||
cy.get('label.text-text-secondary').should('be.visible') // check the rules is displayed
|
cy.get('label.text-text-secondary').should('be.visible') // check the rules is displayed
|
||||||
cy.CheckPlaceholder('#email','電子郵件','Email')
|
cy.CheckPlaceholder('#email', '電子郵件', 'Email')
|
||||||
cy.CheckTextElement('#CheckRegistered','已經有帳號了嗎?','Already have an account?')
|
cy.CheckTextElement(
|
||||||
cy.CheckTextElement('#SwitchtoLogin','登入','Log in')
|
'#CheckRegistered',
|
||||||
|
'已經有帳號了嗎?',
|
||||||
|
'Already have an account?'
|
||||||
|
)
|
||||||
|
cy.CheckTextElement('#SwitchtoLogin', '登入', 'Log in')
|
||||||
})
|
})
|
||||||
it('Check Login Page Elements-Login', () => {
|
it('Check Login Page Elements-Login', () => {
|
||||||
cy.get('#SwitchtoLogin').click()
|
cy.get('#SwitchtoLogin').click()
|
||||||
checkLoginUI()
|
checkLoginUI()
|
||||||
cy.CheckPlaceholder('#username','電子郵件 / 帳號名稱', 'Email / Username')
|
cy.CheckPlaceholder(
|
||||||
|
'#username',
|
||||||
|
'電子郵件 / 帳號名稱',
|
||||||
|
'Email / Username'
|
||||||
|
)
|
||||||
cy.get('#LogInOrSignUp').should('be.visible')
|
cy.get('#LogInOrSignUp').should('be.visible')
|
||||||
cy.CheckTextElement('#CheckRegistered','還沒有帳號嗎?',"Don't have an account?")
|
cy.CheckTextElement(
|
||||||
cy.CheckTextElement('#SwitchtoRegister','註冊','Sign up')
|
'#CheckRegistered',
|
||||||
|
'還沒有帳號嗎?',
|
||||||
|
"Don't have an account?"
|
||||||
|
)
|
||||||
|
cy.CheckTextElement('#SwitchtoRegister', '註冊', 'Sign up')
|
||||||
})
|
})
|
||||||
it('Check social account UI', () => {
|
it('Check social account UI', () => {
|
||||||
cy.CheckTextElement('#or','或','or')
|
cy.CheckTextElement('#or', '或', 'or')
|
||||||
cy.CheckTextElement('#GoogleLogin','以Google繼續','Continue with Google')
|
cy.CheckTextElement(
|
||||||
cy.CheckTextElement('#GitHubLogin','以GitHub繼續','Continue with GitHub')
|
'#GoogleLogin',
|
||||||
|
'以Google繼續',
|
||||||
|
'Continue with Google'
|
||||||
|
)
|
||||||
|
cy.CheckTextElement(
|
||||||
|
'#GitHubLogin',
|
||||||
|
'以GitHub繼續',
|
||||||
|
'Continue with GitHub'
|
||||||
|
)
|
||||||
})
|
})
|
||||||
it('Check login fail', () => {
|
it('Check login fail', () => {
|
||||||
cy.LoginWithPassword('dddd', '123456')
|
cy.LoginWithPassword('dddd', '123456')
|
||||||
cy.CheckTextElement('#ErrorDisplay','錯誤的帳號名稱或密碼。','Wrong username or password.')
|
cy.CheckTextElement(
|
||||||
|
'#ErrorDisplay',
|
||||||
|
'錯誤的帳號名稱或密碼。',
|
||||||
|
'Wrong username or password.'
|
||||||
|
)
|
||||||
cy.LoginWithPassword(`ddd\``, '123456')
|
cy.LoginWithPassword(`ddd\``, '123456')
|
||||||
cy.CheckTextElement('#ErrorDisplay','無效的帳號名稱或密碼。','Invalid username or password.')
|
cy.CheckTextElement(
|
||||||
|
'#ErrorDisplay',
|
||||||
|
'無效的帳號名稱或密碼。',
|
||||||
|
'Invalid username or password.'
|
||||||
|
)
|
||||||
})
|
})
|
||||||
it('Login-Password Already Register', () => {
|
it('Login-Password Already Register', () => {
|
||||||
cy.LoginWithPassword(
|
cy.LoginWithPassword(
|
||||||
@@ -50,29 +78,35 @@ describe('example helloworld app', () => {
|
|||||||
cy.PrepareForGame()
|
cy.PrepareForGame()
|
||||||
})
|
})
|
||||||
it('Check Header', () => {
|
it('Check Header', () => {
|
||||||
cy.get('#HeaderText').should('contain','Hello, Linux World!').and('be.visible')
|
cy.get('#HeaderText')
|
||||||
|
.should('contain', 'Hello, Linux World!')
|
||||||
|
.and('be.visible')
|
||||||
cy.findByRole('link', { name: 'Bug Report' }).should('be.visible')
|
cy.findByRole('link', { name: 'Bug Report' }).should('be.visible')
|
||||||
cy.findByRole('button', { name: 'Sign Out' }).should('be.visible')
|
cy.findByRole('button', { name: 'Sign Out' }).should('be.visible')
|
||||||
})
|
})
|
||||||
it('Check QuestInfo', () => {
|
it('Check QuestInfo', () => {
|
||||||
cy.get('#topic').should('contain', 'Hello, Linux World!')
|
cy.get('#topic').should('contain', 'Hello, Linux World!')
|
||||||
cy.get('#quest').find('p.text-text').should('have.length', 3)
|
cy.get('#quest').find('p.text-text').should('have.length', 3)
|
||||||
cy.CheckTextElement('#tasks','任務','Tasks:')
|
cy.CheckTextElement('#tasks', '任務', 'Tasks:')
|
||||||
cy.getQuestInfo('輸入 `echo help` 來朗誦咒語').should('be.visible')
|
cy.getQuestInfo('輸入 `echo help` 來朗誦咒語').should('be.visible')
|
||||||
})
|
})
|
||||||
it('Check Command Cheat Sheet', () => {
|
it('Check Command Cheat Sheet', () => {
|
||||||
cy.get('#cmdlist').within(($cmdlist) => {
|
cy.get('#cmdlist').within(($cmdlist) => {
|
||||||
cy.get($cmdlist).should('be.visible')
|
cy.get($cmdlist).should('be.visible')
|
||||||
cy.get('svg[data-icon="list"]').should('be.visible')
|
cy.get('svg[data-icon="list"]').should('be.visible')
|
||||||
cy.CheckTextElement('#CommandBook','指令之書','Command Cheatsheets')
|
cy.CheckTextElement('#CommandBook', '指令之書', 'Command Cheatsheets')
|
||||||
cy.CheckTextElement('#cheatsheets','-- --指令列表-- --','--Command List--')
|
cy.CheckTextElement(
|
||||||
|
'#cheatsheets',
|
||||||
|
'-- --指令列表-- --',
|
||||||
|
'--Command List--'
|
||||||
|
)
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
it('Check Terminal', () => {
|
it('Check Terminal', () => {
|
||||||
cy.get('#terminal', { timeout: 20000 }).within(($terminal) => {
|
cy.get('#terminal', { timeout: 20000 }).within(($terminal) => {
|
||||||
cy.get($terminal).should('be.visible')
|
cy.get($terminal).should('be.visible')
|
||||||
cy.get('svg[data-icon="terminal"]').should('be.visible')
|
cy.get('svg[data-icon="terminal"]').should('be.visible')
|
||||||
cy.CheckTextElement('#Terminal','終端機','Terminal')
|
cy.CheckTextElement('#Terminal', '終端機', 'Terminal')
|
||||||
cy.get('@Terminaltextbox')
|
cy.get('@Terminaltextbox')
|
||||||
.should('be.visible')
|
.should('be.visible')
|
||||||
.and('contain', 'commander:~ $')
|
.and('contain', 'commander:~ $')
|
||||||
@@ -83,16 +117,16 @@ describe('example helloworld app', () => {
|
|||||||
cy.get($hint).should('be.visible')
|
cy.get($hint).should('be.visible')
|
||||||
cy.get('svg[data-icon="lightbulb"]').should('be.visible')
|
cy.get('svg[data-icon="lightbulb"]').should('be.visible')
|
||||||
})
|
})
|
||||||
cy.CheckTextElement('#hint','提示','Hint')
|
cy.CheckTextElement('#hint', '提示', 'Hint')
|
||||||
})
|
})
|
||||||
it('Check File TreeChart', () => {
|
it('Check File TreeChart', () => {
|
||||||
cy.get('#tree').should('be.visible')
|
cy.get('#tree').should('be.visible')
|
||||||
cy.get('#tree').get('a').should('contain', '???').and('be.visible')
|
cy.get('#tree').get('a').should('contain', '???').and('be.visible')
|
||||||
})
|
})
|
||||||
it('Check Fucnctional Buttons', () => {
|
it('Check Fucnctional Buttons', () => {
|
||||||
cy.CheckTextElement('#solution','解答','Solution')
|
cy.CheckTextElement('#solution', '解答', 'Solution')
|
||||||
cy.CheckTextElement('#reset','重來','Reset')
|
cy.CheckTextElement('#reset', '重來', 'Reset')
|
||||||
cy.CheckTextElement('#continue','繼續','Continue')
|
cy.CheckTextElement('#continue', '繼續', 'Continue')
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
describe('Game Play', () => {
|
describe('Game Play', () => {
|
||||||
@@ -151,7 +185,7 @@ describe('example helloworld app', () => {
|
|||||||
cy.waitUntilActive()
|
cy.waitUntilActive()
|
||||||
cy.getQuestInfo('✓ 解除封印').should('be.visible')
|
cy.getQuestInfo('✓ 解除封印').should('be.visible')
|
||||||
// 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: '填寫問卷' }).should('be.visible')
|
cy.findByRole('link', { name: '填寫問卷' }).should('be.visible')
|
||||||
})
|
})
|
||||||
|
|||||||
Reference in new issue
Block a user