diff --git a/webapp/public/locales/en/translation.json b/webapp/public/locales/en/translation.json
index ac691f30..95a319aa 100644
--- a/webapp/public/locales/en/translation.json
+++ b/webapp/public/locales/en/translation.json
@@ -20,7 +20,9 @@
"username": "Username",
"password": "Password",
"email": "Email",
- "confirm_password": "Confirm password"
+ "confirm_password": "Confirm password",
+ "welcome": "Welcome to the WIQ-EN2B page",
+ "account": "Don't have an account?"
},
"error": {
"login": "An ERROR occurred during login"
diff --git a/webapp/public/locales/es/translation.json b/webapp/public/locales/es/translation.json
index 1c48232f..df07fcc4 100644
--- a/webapp/public/locales/es/translation.json
+++ b/webapp/public/locales/es/translation.json
@@ -20,7 +20,9 @@
"username": "Nombre de usuario",
"password": "Contraseña",
"email": "Correo electrónico",
- "confirm_password": "Confirmar contraseña"
+ "confirm_password": "Confirmar contraseña",
+ "welcome": "Bienvenido a la página principal de WIQ-EN2B",
+ "account": "¿No tienes una cuenta?"
},
"error": {
"login": "Ocurrió un ERROR en el login"
diff --git a/webapp/src/pages/Root.jsx b/webapp/src/pages/Root.jsx
index c334a10c..df44626d 100644
--- a/webapp/src/pages/Root.jsx
+++ b/webapp/src/pages/Root.jsx
@@ -1,5 +1,23 @@
+import { Center } from "@chakra-ui/layout";
+import { Heading, Stack } from "@chakra-ui/react";
import React from "react";
+import { useTranslation } from "react-i18next";
+import { useNavigate } from "react-router-dom";
+import ButtonEf from '../components/ButtonEf';
export default function Root() {
- return
Proof of concept
+ const navigate = useNavigate();
+ const { t } = useTranslation();
+
+ return (
+
+ {"WIQ-EN2B"}
+ {t("session.welcome")}
+
+ navigate("/login")}/>
+ navigate("/signup")} style={{ cursor: 'pointer' }}>{t("session.account")}
+
+
+ );
}
\ No newline at end of file
diff --git a/webapp/src/pages/Signup.jsx b/webapp/src/pages/Signup.jsx
index bfba8cca..00154018 100644
--- a/webapp/src/pages/Signup.jsx
+++ b/webapp/src/pages/Signup.jsx
@@ -1,5 +1,5 @@
import { Center } from "@chakra-ui/layout";
-import { Heading, Input, Button, InputGroup, Stack, InputLeftElement, chakra, Box, Avatar, FormControl, InputRightElement, Text, FormHelperText } from "@chakra-ui/react";
+import { Heading, Input, Button, InputGroup, Stack, InputLeftElement, chakra, Box, Avatar, FormControl, InputRightElement, Text, FormHelperText, IconButton } from "@chakra-ui/react";
import { ViewIcon, ViewOffIcon } from '@chakra-ui/icons'
import axios, { HttpStatusCode } from "axios";
import React, { useState } from "react";
@@ -104,10 +104,8 @@ export default function Signup() {
value={password}
onChange={(e) => setPassword(e.target.value)}
/>
-
-
+
+ setShowPassword(!showPassword)} icon={showPassword ? : }/>
@@ -120,10 +118,8 @@ export default function Signup() {
value={confirmPassword}
onChange={(e) => setConfirmPassword(e.target.value)}
/>
-
-
+
+ setShowConfirmPassword(!showConfirmPassword)} icon={showConfirmPassword ? : }/>
{confirmPassword && password && confirmPassword !== password && (
diff --git a/webapp/src/tests/Root.test.js b/webapp/src/tests/Root.test.js
new file mode 100644
index 00000000..3cedc219
--- /dev/null
+++ b/webapp/src/tests/Root.test.js
@@ -0,0 +1,36 @@
+import React from 'react';
+import { render, screen, fireEvent, getByTestId } from '@testing-library/react';
+import { MemoryRouter, createMemoryRouter } from 'react-router';
+import Root from '../pages/Root';
+
+describe('Root component', () => {
+
+ it('renders WIQ-EN2B heading', () => {
+ render();
+ const headingElement = screen.getByText('WIQ-EN2B');
+ expect(headingElement).toBeInTheDocument();
+ });
+
+ it('renders welcome message', () => {
+ render();
+ const welcomeMessage = screen.getByText('session.welcome');
+ expect(welcomeMessage).toBeInTheDocument();
+ });
+
+ it('renders Log In button', () => {
+ render();
+ expect(getByTestId(document.body, 'Login')).toBeInTheDocument();
+ });
+
+ it('navigates to /login when Log In button is clicked', () => {
+ const { container } = render();
+ fireEvent.click(getByTestId(document.body, 'Login'));
+ expect(container.innerHTML).toMatch('WIQ-EN2B
session.welcome
session.account
');
+ });
+
+ it('navigates to /signup when "You don\'t have an account?" message is clicked', () => {
+ const { container } = render();
+ fireEvent.click(screen.getByText('session.account'));
+ expect(container.innerHTML).toMatch('WIQ-EN2B
session.welcome
session.account
');
+ });
+});
\ No newline at end of file