Skip to content

Commit

Permalink
refactor: replace hardcoded MAX_RETRIES with TestConstants.DEFAULT_MA…
Browse files Browse the repository at this point in the history
…X_RETRIES in integration tests
  • Loading branch information
pethers authored Jan 17, 2025
1 parent d5c1663 commit 77ce90c
Show file tree
Hide file tree
Showing 8 changed files with 25 additions and 32 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ public void shouldSendValidEmail() {
} catch (Exception e) {
throw new RuntimeException(e);
}
}, MAX_RETRIES);
}, TestConstants.DEFAULT_MAX_RETRIES);
}

@Test(timeout = TestConstants.DEFAULT_TIMEOUT)
Expand All @@ -36,6 +36,6 @@ public void shouldFailWithInvalidEmail() {
} catch (Exception e) {
throw new RuntimeException(e);
}
}, MAX_RETRIES);
}, TestConstants.DEFAULT_MAX_RETRIES);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ public void shouldDenyAccessToAdminPages() {
} catch (Exception e) {
throw new RuntimeException(e);
}
}, MAX_RETRIES);
}, TestConstants.DEFAULT_MAX_RETRIES);
} catch (Exception e) {
throw new RuntimeException(e);
}
Expand All @@ -46,7 +46,7 @@ public void shouldAllowAccessToPublicPages() {
} catch (Exception e) {
throw new RuntimeException(e);
}
}, MAX_RETRIES);
}, TestConstants.DEFAULT_MAX_RETRIES);
} catch (Exception e) {
throw new RuntimeException(e);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@

@Category(IntegrationTest.class)
public final class PartyViewTest extends AbstractUITest {
private static final int MAX_RETRIES = 3;

@Test(timeout = DEFAULT_TIMEOUT)
public void shouldViewPartyCommitteeRoles() throws Exception {
Expand All @@ -22,7 +21,7 @@ public void shouldViewPartyCommitteeRoles() throws Exception {
throw new RuntimeException("Failed to visit party committee roles page", e);
}
pageVisit.verifyPageContent("Committee Roles");
}, MAX_RETRIES);
}, TestConstants.DEFAULT_MAX_RETRIES);
}

@Test(timeout = DEFAULT_TIMEOUT)
Expand All @@ -35,7 +34,7 @@ public void shouldViewPartyDocumentHistory() throws Exception {
e.printStackTrace();
}
pageVisit.verifyPageContent("Document History");
}, MAX_RETRIES);
}, TestConstants.DEFAULT_MAX_RETRIES);
}

// ... other party view tests
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@

@Category(IntegrationTest.class)
public class SearchViewTest extends AbstractUITest {
private static final int DEFAULT_MAX_RETRIES = 3;

@Test(timeout = DEFAULT_TIMEOUT)
public void testSearch() throws Exception {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,7 @@

@Category(IntegrationTest.class)
public final class SessionManagementTest extends AbstractUITest {
private static final int DEFAULT_MAX_RETRIES = 3;
private static final int MAX_RETRIES = 3;
private static final int DEFAULT_TIMEOUT = 60000;


@Test(timeout = DEFAULT_TIMEOUT)
public void shouldHandleSessionPagination() throws Exception {
retryOnFailure(() -> {
Expand Down Expand Up @@ -51,6 +48,6 @@ public void shouldShowSessionDetails() throws Exception {
} catch (Exception e) {
throw new RuntimeException(e);
}
}, MAX_RETRIES);
}, TestConstants.DEFAULT_MAX_RETRIES);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@

@Category(IntegrationTest.class)
public final class UserAuthenticationTest extends AbstractUITest {
private static final int MAX_RETRIES = TestConstants.DEFAULT_MAX_RETRIES;
private static final String EMAIL_SUFFIX = "@test.com";
private static final String PATH_PREFIX = "main/";
private static final String ERROR_USER_EXISTS = "USER_ALREADY_EXISTS";
Expand Down Expand Up @@ -46,7 +45,7 @@ public void shouldRegisterNewUser() throws Exception {
} catch (Exception e) {
throw new RuntimeException(e);
}
}, MAX_RETRIES);
}, TestConstants.DEFAULT_MAX_RETRIES);
}

@Test(timeout = TestConstants.DEFAULT_TIMEOUT)
Expand All @@ -66,7 +65,7 @@ public void shouldRegisterUserWithWeakPasswordFail() throws Exception {
} catch (Exception e) {
throw new RuntimeException(e);
}
}, MAX_RETRIES);
}, TestConstants.DEFAULT_MAX_RETRIES);
}

@Test(timeout = TestConstants.DEFAULT_TIMEOUT)
Expand All @@ -93,7 +92,7 @@ public void shouldNotRegisterDuplicateUser() throws Exception {
} catch (Exception e) {
throw new RuntimeException(e);
}
}, MAX_RETRIES);
}, TestConstants.DEFAULT_MAX_RETRIES);
}

@Test(timeout = TestConstants.DEFAULT_TIMEOUT)
Expand Down Expand Up @@ -128,7 +127,7 @@ public void shouldManageUserSecurity() throws Exception {
} catch (Exception e) {
throw new RuntimeException(e);
}
}, MAX_RETRIES);
}, TestConstants.DEFAULT_MAX_RETRIES);
}

@Test(timeout = TestConstants.DEFAULT_TIMEOUT)
Expand All @@ -152,7 +151,7 @@ public void shouldFailLoginWithWrongPassword() throws Exception {
} catch (Exception e) {
throw new RuntimeException(e);
}
}, MAX_RETRIES);
}, TestConstants.DEFAULT_MAX_RETRIES);
}

@Test(timeout = TestConstants.DEFAULT_TIMEOUT)
Expand All @@ -179,6 +178,6 @@ public void shouldEnableAndDisableGoogleAuthenticator() throws Exception {
} catch (Exception e) {
throw new RuntimeException(e);
}
}, MAX_RETRIES);
}, TestConstants.DEFAULT_MAX_RETRIES);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@

@Category(IntegrationTest.class)
public final class UserNavigationTest extends AbstractUITest {
private static final int MAX_RETRIES = 3;
// Constants for page modes
private static final String DOCUMENT_ACTIVITY = "DOCUMENTACTIVITY";
private static final String ROLE_SUMMARY = "ROLESUMMARY";
Expand Down Expand Up @@ -43,7 +42,7 @@ public void shouldNavigatePoliticianViews() throws Exception {
} catch (Exception e) {
throw new RuntimeException(e);
}
}, MAX_RETRIES);
}, TestConstants.DEFAULT_MAX_RETRIES);
}

@Test(timeout = DEFAULT_TIMEOUT)
Expand All @@ -67,7 +66,7 @@ public void shouldNavigateParliamentViews() throws Exception {
} catch (Exception e) {
throw new RuntimeException(e);
}
}, MAX_RETRIES);
}, TestConstants.DEFAULT_MAX_RETRIES);
}

@Test(timeout = DEFAULT_TIMEOUT)
Expand All @@ -79,7 +78,7 @@ public void shouldNavigateCommitteeRanking() throws Exception {
} catch (Exception e) {
throw new RuntimeException(e);
}
}, MAX_RETRIES);
}, TestConstants.DEFAULT_MAX_RETRIES);
}

@Test(timeout = DEFAULT_TIMEOUT)
Expand All @@ -91,7 +90,7 @@ public void shouldNavigateMinistryRanking() throws Exception {
} catch (Exception e) {
throw new RuntimeException(e);
}
}, MAX_RETRIES);
}, TestConstants.DEFAULT_MAX_RETRIES);
}

@Test(timeout = DEFAULT_TIMEOUT)
Expand All @@ -106,7 +105,7 @@ public void shouldNavigatePartyRanking() throws Exception {
} catch (Exception e) {
throw new RuntimeException(e);
}
}, MAX_RETRIES);
}, TestConstants.DEFAULT_MAX_RETRIES);
}

@Test(timeout = DEFAULT_TIMEOUT)
Expand All @@ -118,7 +117,7 @@ public void shouldNavigatePoliticianRanking() throws Exception {
} catch (Exception e) {
throw new RuntimeException(e);
}
}, MAX_RETRIES);
}, TestConstants.DEFAULT_MAX_RETRIES);
}

// Other navigation tests...
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ public void shouldNavigateCommitteeRanking() throws Exception {
} catch (Exception e) {
throw new RuntimeException(e);
}
}, MAX_RETRIES);
}, TestConstants.DEFAULT_MAX_RETRIES);
}

@Test(timeout = DEFAULT_TIMEOUT)
Expand All @@ -37,7 +37,7 @@ public void shouldNavigateMinistryRanking() throws Exception {
} catch (Exception e) {
throw new RuntimeException(e);
}
}, MAX_RETRIES);
}, TestConstants.DEFAULT_MAX_RETRIES);
}

@Test(timeout = DEFAULT_TIMEOUT)
Expand All @@ -49,7 +49,7 @@ public void shouldNavigatePartyRanking() throws Exception {
} catch (Exception e) {
throw new RuntimeException(e);
}
}, MAX_RETRIES);
}, TestConstants.DEFAULT_MAX_RETRIES);
}

@Test(timeout = DEFAULT_TIMEOUT)
Expand All @@ -61,7 +61,7 @@ public void shouldNavigatePoliticianRanking() throws Exception {
} catch (Exception e) {
throw new RuntimeException(e);
}
}, MAX_RETRIES);
}, TestConstants.DEFAULT_MAX_RETRIES);
}

@Test(timeout = DEFAULT_TIMEOUT)
Expand All @@ -80,6 +80,6 @@ public void shouldNavigatePoliticianViews() throws Exception {
} catch (Exception e) {
throw new RuntimeException(e);
}
}, DEFAULT_MAX_RETRIES);
}, TestConstants.DEFAULT_MAX_RETRIES);
}
}

0 comments on commit 77ce90c

Please sign in to comment.