From 535fef247fde8ea9cf3cb549cd15a4e6d78af742 Mon Sep 17 00:00:00 2001 From: wancat Date: Fri, 17 Nov 2023 13:46:42 +0800 Subject: [PATCH] fix: fix login failure by NODE_ENV=developement --- docker-compose.testing.yml | 1 + tests/cypress/support/commands.js | 6 ++++-- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/docker-compose.testing.yml b/docker-compose.testing.yml index c1d2f00..de665b2 100644 --- a/docker-compose.testing.yml +++ b/docker-compose.testing.yml @@ -52,6 +52,7 @@ services: - GITHUB_CLIENT_SECRET=${GITHUB_CLIENT_SECRET} - SURVEY_URL=${SURVEY_URL} - BUG_REPORT_URL=${BUG_REPORT_URL} + - NODE_ENV=development - TESTING=true - TESTING_USERNAME=alex - TESTING_PASSWORD=Alex1234 diff --git a/tests/cypress/support/commands.js b/tests/cypress/support/commands.js index 8d0aef7..fa1d735 100644 --- a/tests/cypress/support/commands.js +++ b/tests/cypress/support/commands.js @@ -2,10 +2,11 @@ import '@testing-library/cypress/add-commands' Cypress.Commands.add('LoginWithPassword', (username, password) => { cy.clearAllCookies({ domain: null }) - cy.get('a.text-text-primary', { timeout: 100000 }).contains('Log in').click() + cy.visit('/login') cy.get('#username').type(username) cy.get('#password').type(password) cy.findByRole('button', { name: 'Log In' }).click() + cy.url().should('include', '/game') }) Cypress.Commands.add('PrepareForGame', () => { cy.visit('/') @@ -13,7 +14,8 @@ Cypress.Commands.add('PrepareForGame', () => { Cypress.env('defaultAccount'), Cypress.env('defaultPassword') ) - cy.get('.xterm-screen', { timeout: 150000 }) + cy.visit('/game/helloworld') + cy.get('.xterm-screen', { timeout: 10000 }) .as('Terminaltextbox') .should('be.visible') cy.findByRole('button', { name: 'Reset' }).click()