diff --git a/webapp/src/components/Register/Register.js b/webapp/src/components/Register/Register.js
index 00d522a2..028250d5 100644
--- a/webapp/src/components/Register/Register.js
+++ b/webapp/src/components/Register/Register.js
@@ -34,6 +34,7 @@ const AddUser = () => {
margin="normal"
fullWidth
label="Username"
+ placeholder="Username"
value={username}
onChange={(e) => setUsername(e.target.value)}
/>
@@ -43,6 +44,7 @@ const AddUser = () => {
fullWidth
label="Password"
type="password"
+ placeholder="Password"
value={password}
onChange={(e) => setPassword(e.target.value)}
/>
diff --git a/webapp/src/components/Register/Register.test.js b/webapp/src/components/Register/Register.test.js
index 87334886..93bfedca 100644
--- a/webapp/src/components/Register/Register.test.js
+++ b/webapp/src/components/Register/Register.test.js
@@ -2,20 +2,20 @@ import React from 'react';
import { render, fireEvent, screen, waitFor } from '@testing-library/react';
import axios from 'axios';
import MockAdapter from 'axios-mock-adapter';
-import AddUser from './AddUser';
+import Register from './Register';
const mockAxios = new MockAdapter(axios);
-describe('AddUser component', () => {
+describe('Register component', () => {
beforeEach(() => {
mockAxios.reset();
});
it('should add user successfully', async () => {
- render();
+ render();
- const usernameInput = screen.getByLabelText(/Username/i);
- const passwordInput = screen.getByLabelText(/Password/i);
+ const usernameInput = screen.getByPlaceholderText(/Username/i);
+ const passwordInput = screen.getByPlaceholderText(/Password/i);
const addUserButton = screen.getByRole('button', { name: /Add User/i });
// Mock the axios.post request to simulate a successful response
@@ -35,10 +35,10 @@ describe('AddUser component', () => {
});
it('should handle error when adding user', async () => {
- render();
+ render();
- const usernameInput = screen.getByLabelText(/Username/i);
- const passwordInput = screen.getByLabelText(/Password/i);
+ const usernameInput = screen.getByPlaceholderText(/Username/i);
+ const passwordInput = screen.getByPlaceholderText(/Password/i);
const addUserButton = screen.getByRole('button', { name: /Add User/i });
// Mock the axios.post request to simulate an error response