From ee841b42e70eed2bc66bc0188aae312f93df1b2c Mon Sep 17 00:00:00 2001 From: Annie Huang Date: Sat, 28 Oct 2023 23:41:04 +0800 Subject: [PATCH] fix: command update --- quests/helloworld/answer.sh | 10 ++++++++++ tests/cypress.config.js | 2 -- tests/cypress/support/commands.js | 8 ++++---- 3 files changed, 14 insertions(+), 6 deletions(-) create mode 100644 quests/helloworld/answer.sh diff --git a/quests/helloworld/answer.sh b/quests/helloworld/answer.sh new file mode 100644 index 0000000..eb29a7f --- /dev/null +++ b/quests/helloworld/answer.sh @@ -0,0 +1,10 @@ +echo Hello World!{enter} +ls {enter} +mkdir jail{enter} +ls {enter} +cd jail{enter} +cd ..{enter} +rmdir jail{enter} +ls {enter} +cat forgotten_scroll.txt{enter} +echo Unix,rise and guide me!{enter} \ No newline at end of file diff --git a/tests/cypress.config.js b/tests/cypress.config.js index 838839b..1b37345 100644 --- a/tests/cypress.config.js +++ b/tests/cypress.config.js @@ -23,7 +23,5 @@ module.exports = defineConfig({ // 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', }, }) diff --git a/tests/cypress/support/commands.js b/tests/cypress/support/commands.js index 8c0a7cd..e7ba111 100644 --- a/tests/cypress/support/commands.js +++ b/tests/cypress/support/commands.js @@ -25,10 +25,10 @@ // Cypress.Commands.overwrite('visit', (originalFn, url, options) => { ... }) import '@testing-library/cypress/add-commands' -Cypress.Commands.add('LoginWithPassword', () => { - cy.clearAllCookies() +Cypress.Commands.add('LoginWithPassword', (username, password) => { + cy.clearAllCookies({ domain: null }) cy.get('a.text-text-primary').should('contain', 'Log in').click() - cy.get('#username').type(Cypress.env('username')) - cy.get('#password').type(Cypress.env('password')) + cy.get('#username').type(username) + cy.get('#password').type(password) cy.findByRole('button', { name: 'Log in' }).click() })