From e6ee2634b98d63b81a4877612aafe803a6cc06de Mon Sep 17 00:00:00 2001 From: Richard Schmidt Date: Fri, 9 Feb 2024 20:01:56 +0100 Subject: [PATCH] refactoring: fixed some indentations and added / removed comments in LoginGUITest --- src/test/java/LoginGUITest.java | 19 +++++++------------ 1 file changed, 7 insertions(+), 12 deletions(-) diff --git a/src/test/java/LoginGUITest.java b/src/test/java/LoginGUITest.java index b2b6184..e7eb723 100644 --- a/src/test/java/LoginGUITest.java +++ b/src/test/java/LoginGUITest.java @@ -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()); - } + assertFalse(loginGUI.getStayLoggedInCheckbox().isSelected()); - + loginGUI.getStayLoggedInCheckbox().doClick(); - + assertTrue(loginGUI.getStayLoggedInCheckbox().isSelected()); + } }