|
|
@ -12,6 +12,7 @@ class LoginGUITest { |
|
|
|
loginGUI = new LoginGUI(); |
|
|
|
} |
|
|
|
|
|
|
|
//Tests initial state of the GUI |
|
|
|
@Test |
|
|
|
public void testInitialState() { |
|
|
|
assertNotNull(loginGUI.getUsernameField()); |
|
|
@ -21,6 +22,7 @@ class LoginGUITest { |
|
|
|
assertNotNull(loginGUI.getSignUpButton()); |
|
|
|
} |
|
|
|
|
|
|
|
//Tests the login button |
|
|
|
@Test |
|
|
|
public void testActionPerformed_LoginButton() { |
|
|
|
LoginGUI loginGUI = new LoginGUI(); |
|
|
@ -28,25 +30,18 @@ class LoginGUITest { |
|
|
|
loginGUI.getPasswordField().setText("testPassword"); |
|
|
|
loginGUI.getStayLoggedInCheckbox().setSelected(true); |
|
|
|
|
|
|
|
// Simulate action performed event on login button |
|
|
|
loginGUI.actionPerformed(new ActionEvent(loginGUI.getLoginButton(), ActionEvent.ACTION_PERFORMED, null)); |
|
|
|
|
|
|
|
// Verify if login was successful |
|
|
|
assertFalse(loginGUI.isVisible()); |
|
|
|
} |
|
|
|
|
|
|
|
//Tests the check-box for staying logged in |
|
|
|
@Test |
|
|
|
public void testStayLoggedInCheckbox() { |
|
|
|
// Initially, checkbox should be unchecked |
|
|
|
assertFalse(loginGUI.getStayLoggedInCheckbox().isSelected()); |
|
|
|
|
|
|
|
// Simulate checking the checkbox |
|
|
|
loginGUI.getStayLoggedInCheckbox().doClick(); |
|
|
|
|
|
|
|
assertTrue(loginGUI.getStayLoggedInCheckbox().isSelected()); |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
} |