diff --git a/webapp/e2e/steps/game-steps.js b/webapp/e2e/steps/game-steps.js index 84102218..f0ecf044 100644 --- a/webapp/e2e/steps/game-steps.js +++ b/webapp/e2e/steps/game-steps.js @@ -30,14 +30,14 @@ defineFeature(feature, test => { given('An authenticated user', async () => { username = "game1"; password = "game"; - await expect(page).toClick('button', { text: 'SignUp' }); + await expect(page).toClick('button', { text: 'Registrarse' }); await expect(page).toFill('input[name="username"]', username); await expect(page).toFill('input[name="password"]', password); - await expect(page).toClick('button', { text: 'Add User' }); - await expect(page).toClick('a', { text: 'Already have an account? Login here.' }); + await expect(page).toClick('button', { text: 'Registrarse' }); + await expect(page).toClick('a', { text: '¿Ya tienes una cuenta? Inicia sesión aquí.' }); await expect(page).toFill('input[name="username"]', username); await expect(page).toFill('input[name="password"]', password); - await expect(page).toClick('button', { text: 'Login' }); + await expect(page).toClick('button', { text: 'Iniciar sesión' }); }); when('I navigate to the game page and I click the correct answer', async () => { @@ -65,14 +65,14 @@ defineFeature(feature, test => { given('An authenticated user', async () => { username = "game2"; password = "game"; - await expect(page).toClick('button', { text: 'SignUp' }); + await expect(page).toClick('button', { text: 'Registrarse' }); await expect(page).toFill('input[name="username"]', username); await expect(page).toFill('input[name="password"]', password); - await expect(page).toClick('button', { text: 'Add User' }); - await expect(page).toClick('a', { text: 'Already have an account? Login here.' }); + await expect(page).toClick('button', { text: 'Registrarse' }); + await expect(page).toClick('a', { text: '¿Ya tienes una cuenta? Inicia sesión aquí.' }); await expect(page).toFill('input[name="username"]', username); await expect(page).toFill('input[name="password"]', password); - await expect(page).toClick('button', { text: 'Login' }); + await expect(page).toClick('button', { text: 'Iniciar sesión' }); }); when('I navigate to the game page and I click an incorrect answer', async () => { diff --git a/webapp/e2e/steps/login-form.steps.js b/webapp/e2e/steps/login-form.steps.js index 7d0f62d1..edaf563d 100644 --- a/webapp/e2e/steps/login-form.steps.js +++ b/webapp/e2e/steps/login-form.steps.js @@ -31,18 +31,18 @@ defineFeature(feature, test => { given('A registered user', async () => { username = "login1" password = "test" - await expect(page).toClick('button', { text: 'SignUp' }) + await expect(page).toClick('button', { text: 'Registrarse' }) await expect(page).toFill('input[name="username"]', username); await expect(page).toFill('input[name="password"]', password); - await expect(page).toClick('button', { text: 'Add User' }); - await expect(page).toClick('a', { text: 'Already have an account? Login here.' }); - await expect(page).toClick('button', { text: 'Login' }) + await expect(page).toClick('button', { text: 'Registrarse' }); + await expect(page).toClick('a', { text: '¿Ya tienes una cuenta? Inicia sesión aquí.' }); + await expect(page).toClick('button', { text: 'Iniciar sesión' }) }); when('I fill the data in the form and press submit', async () => { await expect(page).toFill('input[name="username"]', username); await expect(page).toFill('input[name="password"]', password); - await expect(page).toClick('button', { text: 'Login' }) + await expect(page).toClick('button', { text: 'Iniciar sesión' }) }); then('Home should be shown in the screen', async () => { diff --git a/webapp/e2e/steps/record-button.steps.js b/webapp/e2e/steps/record-button.steps.js index c5ac8c86..e7939142 100644 --- a/webapp/e2e/steps/record-button.steps.js +++ b/webapp/e2e/steps/record-button.steps.js @@ -30,15 +30,15 @@ defineFeature(feature, test => { given('An authenticated user', async () => { username = "record2"; password = "record1"; - await expect(page).toClick('button', { text: 'SignUp' }); + await expect(page).toClick('button', { text: 'Registrarse' }); await expect(page).toFill('input[name="username"]', username); await expect(page).toFill('input[name="password"]', password); - await expect(page).toClick('button', { text: 'Add User' }); - await expect(page).toClick('a', { text: 'Already have an account? Login here.' }); - await expect(page).toClick('button', { text: 'Login' }); + await expect(page).toClick('button', { text: 'Registrarse' }); + await expect(page).toClick('a', { text: '¿Ya tienes una cuenta? Inicia sesión aquí.' }); + await expect(page).toClick('button', { text: 'Iniciar sesión' }); await expect(page).toFill('input[name="username"]', username); await expect(page).toFill('input[name="password"]', password); - await expect(page).toClick('button', { text: 'Login' }); + await expect(page).toClick('button', { text: 'Iniciar sesión' }); }); when('I navigate to the records page', async () => { diff --git a/webapp/e2e/steps/register-form.steps.js b/webapp/e2e/steps/register-form.steps.js index 77e04826..6aff8702 100644 --- a/webapp/e2e/steps/register-form.steps.js +++ b/webapp/e2e/steps/register-form.steps.js @@ -31,17 +31,17 @@ defineFeature(feature, test => { given('An unregistered user', async () => { username = "register1" password = "test" - await expect(page).toClick('button', { text: 'SignUp' }) + await expect(page).toClick('button', { text: 'Registrarse' }) }); when('I fill the data in the form and press submit', async () => { await expect(page).toFill('input[name="username"]', username); await expect(page).toFill('input[name="password"]', password); - await expect(page).toClick('button', { text: 'Add User' }) + await expect(page).toClick('button', { text: 'Registrarse' }) }); then('A confirmation message should be shown in the screen', async () => { - await expect(page).toMatchElement("div", { text: "User added successfully" }); + await expect(page).toMatchElement("div", { text: "Usuario añadido con éxito" }); }); }) diff --git a/webapp/src/components/AddUser.js b/webapp/src/components/AddUser.js index 3251d677..3ac60708 100644 --- a/webapp/src/components/AddUser.js +++ b/webapp/src/components/AddUser.js @@ -28,13 +28,13 @@ const AddUser = () => { return ( - Add User + Registrarse setUsername(e.target.value)} /> @@ -42,22 +42,22 @@ const AddUser = () => { name="password" margin="normal" fullWidth - label="Password" + label="Contraseña" type="password" value={password} onChange={(e) => setPassword(e.target.value)} /> - + {error && ( setError('')} message={`Error: ${error}`} /> )}

- Already have an account? Login here. + ¿Ya tienes una cuenta? Inicia sesión aquí.
); diff --git a/webapp/src/components/AddUser.test.js b/webapp/src/components/AddUser.test.js index d97b78ce..028cbe48 100644 --- a/webapp/src/components/AddUser.test.js +++ b/webapp/src/components/AddUser.test.js @@ -19,9 +19,9 @@ describe('AddUser component', () => { ); - const usernameInput = screen.getByLabelText(/Username/i); - const passwordInput = screen.getByLabelText(/Password/i); - const addUserButton = screen.getByRole('button', { name: /Add User/i }); + const usernameInput = screen.getByLabelText(/Nombre de usuario/i); + const passwordInput = screen.getByLabelText(/Contraseña/i); + const addUserButton = screen.getByRole('button', { name: /Registrarse/i }); // Mock the axios.post request to simulate a successful response mockAxios.onPost('http://localhost:8000/adduser').reply(200); @@ -35,7 +35,7 @@ describe('AddUser component', () => { // Wait for the Snackbar to be open await waitFor(() => { - expect(screen.getByText(/User added successfully/i)).toBeInTheDocument(); + expect(screen.getByText(/Usuario añadido con éxito/i)).toBeInTheDocument(); }); }); @@ -46,9 +46,9 @@ describe('AddUser component', () => { ); - const usernameInput = screen.getByLabelText(/Username/i); - const passwordInput = screen.getByLabelText(/Password/i); - const addUserButton = screen.getByRole('button', { name: /Add User/i }); + const usernameInput = screen.getByLabelText(/Nombre de usuario/i); + const passwordInput = screen.getByLabelText(/Contraseña/i); + const addUserButton = screen.getByRole('button', { name: /Registrarse/i }); // Mock the axios.post request to simulate an error response mockAxios.onPost('http://localhost:8000/adduser').reply(500, { error: 'Internal Server Error' }); @@ -73,9 +73,9 @@ describe('AddUser component', () => { ); - const usernameInput = screen.getByLabelText(/Username/i); - const passwordInput = screen.getByLabelText(/Password/i); - const addUserButton = screen.getByRole('button', { name: /Add User/i }); + const usernameInput = screen.getByLabelText(/Nombre de usuario/i); + const passwordInput = screen.getByLabelText(/Contraseña/i); + const addUserButton = screen.getByRole('button', { name: /Registrarse/i }); // Mock the axios.post request to simulate an error response mockAxios.onPost('http://localhost:8000/adduser').reply(400, { error: 'El nombre de usuario no puede estar vacío' }); @@ -99,9 +99,9 @@ describe('AddUser component', () => { ); - const usernameInput = screen.getByLabelText(/Username/i); - const passwordInput = screen.getByLabelText(/Password/i); - const addUserButton = screen.getByRole('button', { name: /Add User/i }); + const usernameInput = screen.getByLabelText(/Nombre de usuario/i); + const passwordInput = screen.getByLabelText(/Contraseña/i); + const addUserButton = screen.getByRole('button', { name: /Registrarse/i }); // Mock the axios.post request to simulate an error response mockAxios.onPost('http://localhost:8000/adduser').reply(400, { error: 'La contraseña no puede estar vacía' }); @@ -126,9 +126,9 @@ describe('AddUser component', () => { ); - const usernameInput = screen.getByLabelText(/Username/i); - const passwordInput = screen.getByLabelText(/Password/i); - const addUserButton = screen.getByRole('button', { name: /Add User/i }); + const usernameInput = screen.getByLabelText(/Nombre de usuario/i); + const passwordInput = screen.getByLabelText(/Contraseña/i); + const addUserButton = screen.getByRole('button', { name: /Registrarse/i }); // Mock the axios.post request to simulate an error response mockAxios.onPost('http://localhost:8000/adduser').reply(400, { error: 'Este nombre de usuario está en uso' }); diff --git a/webapp/src/components/Login.js b/webapp/src/components/Login.js index 9d676679..ee87e25c 100644 --- a/webapp/src/components/Login.js +++ b/webapp/src/components/Login.js @@ -38,13 +38,13 @@ const Login = () => {
- Login + Iniciar sesión setUsername(e.target.value)} /> @@ -52,22 +52,22 @@ const Login = () => { name="password" margin="normal" fullWidth - label="Password" + label="Contraseña" type="password" value={password} onChange={(e) => setPassword(e.target.value)} /> - + {error && ( setError('')} message={`Error: ${error}`} /> )}

- Don't have an account? Register here. + ¿No tienes cuenta? Regístrate aquí.
diff --git a/webapp/src/components/Login.test.js b/webapp/src/components/Login.test.js index a12ed777..032c00cf 100644 --- a/webapp/src/components/Login.test.js +++ b/webapp/src/components/Login.test.js @@ -23,9 +23,9 @@ describe('Login component', () => { ); - const usernameInput = screen.getByLabelText(/Username/i); - const passwordInput = screen.getByLabelText(/Password/i); - const loginButton = screen.getByRole('button', { name: /Login/i }); + const usernameInput = screen.getByLabelText(/Nombre de usuario/i); + const passwordInput = screen.getByLabelText(/Contraseña/i); + const loginButton = screen.getByRole('button', { name: /Iniciar sesión/i }); // Simulamos la respuesta de la petición axios.post mockAxios.onPost('http://localhost:8000/login').reply(200, { token: 'testToken' }); @@ -39,7 +39,7 @@ describe('Login component', () => { // Esperamos que se muestre el SnackBar de loggin exitoso await waitFor(() => { - expect(screen.getByText(/Login successful/i)).toBeInTheDocument(); + expect(screen.getByText(/Inicio de sesión existoso/i)).toBeInTheDocument(); }); // Verificar que el token ha sido almacenado en localStorage @@ -57,12 +57,12 @@ describe('Login component', () => { ); - const usernameInput = screen.getByLabelText(/Username/i); - const passwordInput = screen.getByLabelText(/Password/i); - const loginButton = screen.getByRole('button', { name: /Login/i }); + const usernameInput = screen.getByLabelText(/Nombre de usuario/i); + const passwordInput = screen.getByLabelText(/Contraseña/i); + const loginButton = screen.getByRole('button', { name: /Iniciar sesión/i }); // Simular que ha ocurrido un error en el login - mockAxios.onPost('http://localhost:8000/login').reply(401, { error: 'Unauthorized' }); + mockAxios.onPost('http://localhost:8000/login').reply(401, { error: 'Credenciales inválidas' }); // Simulamos la entrada incorrecta de un usuario fireEvent.change(usernameInput, { target: { value: 'testUserError' } }); @@ -73,7 +73,7 @@ describe('Login component', () => { // Texto del Snackbar de error await waitFor(() => { - expect(screen.getByText(/Error: Unauthorized/i)).toBeInTheDocument(); + expect(screen.getByText(/Error: Credenciales inválidas/i)).toBeInTheDocument(); }); // Verificar que no hay token en localStorage @@ -87,13 +87,13 @@ describe('Login component', () => { ); - const button = screen.getByRole('button', { name: /Login/i }); + const button = screen.getByRole('button', { name: /Iniciar sesión/i }); fireEvent.click(button); const logoutButton = screen.queryByRole('button', { name: /Cerrar sesión/i }); expect(logoutButton).toBeNull(); - const usernameInput = screen.getByLabelText(/Username/i); - const passwordInput = screen.getByLabelText(/Password/i); - const loginButton = screen.getByRole('button', { name: /Login/i }); + const usernameInput = screen.getByLabelText(/Nombre de usuario/i); + const passwordInput = screen.getByLabelText(/Contraseña/i); + const loginButton = screen.getByRole('button', { name: /Iniciar sesión/i }); mockAxios.onPost('http://localhost:8000/login').reply(200, { token: 'testToken' }); diff --git a/webapp/src/components/Welcome.js b/webapp/src/components/Welcome.js index a9223a84..c35d1e83 100644 --- a/webapp/src/components/Welcome.js +++ b/webapp/src/components/Welcome.js @@ -26,10 +26,10 @@ const HomeScreen = () => {

- +
- +
diff --git a/webapp/src/components/Welcome.test.js b/webapp/src/components/Welcome.test.js index 4c80e7c7..5179fbcf 100644 --- a/webapp/src/components/Welcome.test.js +++ b/webapp/src/components/Welcome.test.js @@ -23,7 +23,7 @@ describe('Welcome Component', () => { ); - const loginButton = screen.getByRole('button', { name: /login/i }); + const loginButton = screen.getByRole('button', { name: /Iniciar sesión/i }); fireEvent.click(loginButton); expect(window.location.pathname).toBe('/login'); }); @@ -34,7 +34,7 @@ describe('Welcome Component', () => { ); - const signupButton = screen.getByRole('button', { name: /signup/i }); + const signupButton = screen.getByRole('button', { name: /Registrarse/i }); fireEvent.click(signupButton); expect(window.location.pathname).toBe('/adduser'); });