Browse Source

test_Actions performed for signup fields

remotes/origin/server
Richard Schmidt 11 months ago
parent
commit
016947c6e2
  1. 18
      src/test/java/SignUpGUITest.java
  2. 9
      user.json

18
src/test/java/SignUpGUITest.java

@ -4,6 +4,10 @@ import org.junit.jupiter.api.AfterEach;
import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.BeforeEach;
import java.awt.event.ActionEvent;
class SignUpGUITest { class SignUpGUITest {
private SignUpGUI signUpGUI; private SignUpGUI signUpGUI;
@ -19,17 +23,21 @@ import org.junit.jupiter.api.BeforeEach;
} }
@Test @Test
void testSignUpButtonActionPerformed() {
signUpGUI.getUsernameField().setText("testuser");
public void testSignUpButtonActionPerformed() {
// Set up text fields
signUpGUI.getUsernameField().setText("testUser");
signUpGUI.getPasswordField().setText("password"); signUpGUI.getPasswordField().setText("password");
signUpGUI.getConfirmPasswordField().setText("password"); signUpGUI.getConfirmPasswordField().setText("password");
signUpGUI.getBirthdayField().setText("2000-01-01");
signUpGUI.getBirthdayField().setText("1990-01-01");
signUpGUI.getFirstNameField().setText("John"); signUpGUI.getFirstNameField().setText("John");
signUpGUI.getSurnameField().setText("Doe"); signUpGUI.getSurnameField().setText("Doe");
signUpGUI.getSignUpButton().doClick();
// Perform action
ActionEvent actionEvent = new ActionEvent(signUpGUI.getSignUpButton(), ActionEvent.ACTION_PERFORMED, "");
signUpGUI.actionPerformed(actionEvent);
assertFalse(signUpGUI.isVisible());
} }
} }

9
user.json

@ -25,5 +25,14 @@
"firstName": "John", "firstName": "John",
"surname": "Doe", "surname": "Doe",
"stayLoggedIn": false "stayLoggedIn": false
},
{
"id": "27ffc70f-dd76-4765-81e3-76fde9b618e5",
"userName": "testUser",
"password": "5e884898da28047151d0e56f8dc6292773603d0d6aabbdd62a11ef721d1542d8",
"birthday": "1990-01-01",
"firstName": "John",
"surname": "Doe",
"stayLoggedIn": false
} }
] ]
Loading…
Cancel
Save