mirror of
https://github.com/linux-odyssey/linux-odyssey.git
synced 2026-11-06 03:20:13 +08:00
Add stage secret and try oAuth login settings
This commit is contained in:
1 parent
dba521b358
commit
be4af591af
5 files changed
+64
-7
No files matched your search
@@ -7,6 +7,15 @@
|
||||
"story2": "{enter}{enter}{enter}{enter}{enter}",
|
||||
"start2": "你找到了一個被遺忘的卷軸,上面寫著解除封印的咒語。",
|
||||
"end2": "使用 `Tab` 鍵來取得指令提示。",
|
||||
"stage_hidden1": "mkdir jail{enter}",
|
||||
"stage_hidden2": "ls{enter}",
|
||||
"stage_hidden3": "cd jail{enter}",
|
||||
"stage_hidden_story1": "你進入了一個牢房,牢房裡有一個門,門上有一個鎖。",
|
||||
"stage_hidden_story2": "轉身發現,自己被關在了牢房裡。",
|
||||
"stage_hidden4": "{enter}{enter}{enter}",
|
||||
"stage_hidden5": "cd ..{enter}",
|
||||
"stage_hidden6": "rmdir jail{enter}",
|
||||
"stage_hidden7": "ls{enter}",
|
||||
"stage3": "cat forgotten_scroll.txt{enter}",
|
||||
"story3": "{enter}{enter}",
|
||||
"scrollcontent": "Unix, rise and guide me!",
|
||||
|
||||
@@ -0,0 +1,8 @@
|
||||
GOOGLE_USERNAME=LinuxOdyssey
|
||||
GOOGLE_PASSWORD=GurLinChenHuang
|
||||
GITHUB_USERNAME=LinuxOdyssey
|
||||
GITHUB_USERNAME=GurLinChenHuang
|
||||
GOOGLE_CLIENT_ID=264068068396-hbso1a9a8kj4fpb2q0dg3hkhv34gb1de.apps.googleusercontent.com
|
||||
GOOGLE_CLIENT_SECRET=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
|
||||
GITHUB_CLIENT_ID=3a81cb865e421c225506
|
||||
GITHUB_CLIENT_SECRET=5fe79a58e9e9f4e44f22090da122e42517038779
|
||||
@@ -1,4 +1,5 @@
|
||||
const { defineConfig } = require('cypress')
|
||||
// require('./.env').config()
|
||||
const process = require('process')
|
||||
|
||||
const getConfig = (key, defaultValue) => {
|
||||
@@ -12,4 +13,17 @@ module.exports = defineConfig({
|
||||
viewportHeight: 1080,
|
||||
pageLoadTimeout: 120000,
|
||||
},
|
||||
env: {
|
||||
// google_username: process.env.GOOGLE_USERNAME,
|
||||
// google_password: process.env.GOOGLE_PASSWORD,
|
||||
// google_client_id: process.env.GOOGLE_CLIENT_ID,
|
||||
// google_client_secret: process.env.GOOGLE_CLIENT_SECRET,
|
||||
// github_username: process.env.GITHUB_USERNAME,
|
||||
// github_password: process.env.GITHUB_PASSWORD,
|
||||
// Cannot read github client id
|
||||
// github_client_id: process.env.GITHUB_CLIENT_ID,
|
||||
// github_client_secret: process.env.GITHUB_CLIENT_SECRET,
|
||||
username: 'alex',
|
||||
password: '123456',
|
||||
},
|
||||
})
|
||||
@@ -142,7 +142,7 @@ describe('example helloworld app', () => {
|
||||
.and('be.visible')
|
||||
})
|
||||
it('Check Terminal', () => {
|
||||
cy.get('#terminal').should('be.visible')
|
||||
cy.get('#terminal', { timeout: 20000 }).should('be.visible')
|
||||
cy.get('#terminal').get('svg[data-icon="terminal"]').should('be.visible')
|
||||
cy.get('#terminal')
|
||||
.findByRole('button')
|
||||
@@ -159,12 +159,14 @@ describe('example helloworld app', () => {
|
||||
cy.get('#hint').get('h1').should('contain', 'Hint').and('be.visible')
|
||||
})
|
||||
it('Check File TreeChart', () => {
|
||||
cy.get('#visualization').should('be.visible')
|
||||
cy.get('#visualization', { timeout: 20000 }).should('be.visible')
|
||||
cy.get('#tree').should('be.visible')
|
||||
cy.get('#tree').get('a').should('contain', '???').and('be.visible')
|
||||
})
|
||||
it('Check Fucnctional Buttons', () => {
|
||||
cy.findByRole('button', { name: 'Solution' }).should('be.visible')
|
||||
cy.findByRole('button', { name: 'Solution' }, { timeout: 20000 }).should(
|
||||
'be.visible'
|
||||
)
|
||||
cy.findByRole('button', { name: 'Reset' }).should('be.visible')
|
||||
cy.findByRole('button', { name: 'Continue' }).should('be.visible')
|
||||
})
|
||||
@@ -179,12 +181,12 @@ describe('example helloworld app', () => {
|
||||
cy.readFile('../quests/helloworld/answer.json', 'utf-8').as('answersheet')
|
||||
})
|
||||
it('Typing in Terminal', () => {
|
||||
cy.get('@Terminaltextbox').type('12345{enter}')
|
||||
cy.get('@Terminaltextbox', { timeout: 20000 }).type('12345{enter}')
|
||||
cy.get('@Terminaltextbox')
|
||||
.should('contain', 'zsh: command not found: 12345')
|
||||
.and('contain', '12345')
|
||||
})
|
||||
it.only('Complete the Game', () => {
|
||||
it('Complete the Game', () => {
|
||||
// get answersheet
|
||||
cy.get('@answersheet').then((answers) => {
|
||||
// Stage1
|
||||
@@ -212,6 +214,10 @@ describe('example helloworld app', () => {
|
||||
.should('contain', 'forgotten_scroll.txt')
|
||||
.and('contain', answers.start2)
|
||||
.and('contain', continueSign)
|
||||
cy.get('#tree')
|
||||
.get('a')
|
||||
.should('contain', 'forgotten_scroll.txt')
|
||||
.and('be.visible')
|
||||
cy.get('@Terminaltextbox').type(answers.story2)
|
||||
getTaskCheckbox('搜索卷軸').should('be.checked')
|
||||
getTaskCheckbox('移動到下一個房間')
|
||||
@@ -227,6 +233,26 @@ describe('example helloworld app', () => {
|
||||
cy.get('#Lbutton').click()
|
||||
cy.get('#Rbutton').should('be.enabled')
|
||||
checkHint(2, 3, answers.hint2)
|
||||
// Stage hidden
|
||||
cy.log('Stage hidden')
|
||||
cy.get('@Terminaltextbox').type(answers.stage_hidden1)
|
||||
cy.get('@Terminaltextbox').type(answers.stage_hidden2)
|
||||
cy.get('#tree').get('a').should('contain', 'jail').and('be.visible')
|
||||
cy.get('@Terminaltextbox').type(answers.stage_hidden3)
|
||||
cy.get('@Terminaltextbox').should(
|
||||
'contain',
|
||||
answers.stage_hidden_story1
|
||||
)
|
||||
cy.get('@Terminaltextbox').type(answers.stage_hidden4)
|
||||
cy.get('@Terminaltextbox').should(
|
||||
'contain',
|
||||
answers.stage_hidden_story2
|
||||
)
|
||||
cy.get('@Terminaltextbox').type(answers.stage_hidden5)
|
||||
cy.get('@Terminaltextbox').type(answers.stage_hidden6)
|
||||
cy.get('@Terminaltextbox').type(answers.stage_hidden7)
|
||||
cy.get('#tree').get('a').contains('jail').and('not.exist')
|
||||
getTaskCheckbox('移動到下一個房間').should('be.checked')
|
||||
// Stage3
|
||||
cy.log('Stage3')
|
||||
cy.get('@Terminaltextbox').type(answers.stage3)
|
||||
|
||||
@@ -28,7 +28,7 @@ import '@testing-library/cypress/add-commands'
|
||||
Cypress.Commands.add('LoginWithPassword', () => {
|
||||
cy.clearAllCookies()
|
||||
cy.get('a.text-text-primary').should('contain', 'Log in').click()
|
||||
cy.get('#username').type('alex')
|
||||
cy.get('#password').type('123456')
|
||||
cy.get('#username').type(Cypress.env('username'))
|
||||
cy.get('#password').type(Cypress.env('password'))
|
||||
cy.findByRole('button', { name: 'Log in' }).click()
|
||||
})
|
||||
Reference in new issue
Block a user