From 5e0bc4b7934a76f752cb82dd816f3da251e3a2f1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?James=20Pether=20S=C3=B6rling?= Date: Sun, 26 Jan 2025 00:00:30 +0100 Subject: [PATCH] Refactor view content verification in admin tests; replace calls to deprecated method with direct pageVisit verification --- .../admin/AbstractAdminTest.java | 10 ---------- .../configuration/AdminConfigurationTest.java | 10 +++++----- .../admin/data/AdminDataTest.java | 14 +++++++------- .../admin/operations/AdminOperationsTest.java | 2 +- .../admin/security/AdminSecurityTest.java | 4 ++-- .../systemintegrationtest/ui/UserPageVisit.java | 12 ++++++++++++ 6 files changed, 27 insertions(+), 25 deletions(-) diff --git a/citizen-intelligence-agency/src/test/java/com/hack23/cia/systemintegrationtest/admin/AbstractAdminTest.java b/citizen-intelligence-agency/src/test/java/com/hack23/cia/systemintegrationtest/admin/AbstractAdminTest.java index a8e8ed6854..4104f88c16 100644 --- a/citizen-intelligence-agency/src/test/java/com/hack23/cia/systemintegrationtest/admin/AbstractAdminTest.java +++ b/citizen-intelligence-agency/src/test/java/com/hack23/cia/systemintegrationtest/admin/AbstractAdminTest.java @@ -23,14 +23,4 @@ public void adminSetup() throws Exception { pageVisit.loginAsAdmin(); } - /** - * Verify view content. - * - * @param contentToVerify the content to verify - */ - protected void verifyViewContent(final String... contentToVerify) { - for (final String content : contentToVerify) { - pageVisit.verifyPageContent(content); - } - } } diff --git a/citizen-intelligence-agency/src/test/java/com/hack23/cia/systemintegrationtest/admin/configuration/AdminConfigurationTest.java b/citizen-intelligence-agency/src/test/java/com/hack23/cia/systemintegrationtest/admin/configuration/AdminConfigurationTest.java index 230e2b0087..bf3b90de88 100644 --- a/citizen-intelligence-agency/src/test/java/com/hack23/cia/systemintegrationtest/admin/configuration/AdminConfigurationTest.java +++ b/citizen-intelligence-agency/src/test/java/com/hack23/cia/systemintegrationtest/admin/configuration/AdminConfigurationTest.java @@ -23,7 +23,7 @@ public final class AdminConfigurationTest extends AbstractAdminTest { @Test(timeout = DEFAULT_TIMEOUT) public void verifyPortalConfiguration() throws Exception { pageVisit.visitDirectPage(PageCommandAdminConstants.COMMAND_PORTAL); - verifyViewContent(AdminViewConstants.ADMIN_PORTAL_MANAGEMENT, AdminViewConstants.PORTAL_OVERVIEW, + pageVisit.verifyViewContent(AdminViewConstants.ADMIN_PORTAL_MANAGEMENT, AdminViewConstants.PORTAL_OVERVIEW, AdminViewConstants.PORTAL_MANAGEMENT_OVERVIEW); pageVisit.validatePage(PageCommandAdminConstants.COMMAND_PORTAL); } @@ -36,7 +36,7 @@ public void verifyPortalConfiguration() throws Exception { @Test(timeout = DEFAULT_TIMEOUT) public void verifyCountryConfiguration() throws Exception { pageVisit.visitDirectPage(PageCommandAdminConstants.COMMAND_COUNTRY); - verifyViewContent(AdminViewConstants.ADMIN_COUNTRY_MANAGEMENT, AdminViewConstants.COUNTRY_OVERVIEW, + pageVisit.verifyViewContent(AdminViewConstants.ADMIN_COUNTRY_MANAGEMENT, AdminViewConstants.COUNTRY_OVERVIEW, AdminViewConstants.COUNTRY_OVERVIEW_DESCRIPTION); pageVisit.validatePage(PageCommandAdminConstants.COMMAND_COUNTRY); } @@ -49,7 +49,7 @@ public void verifyCountryConfiguration() throws Exception { @Test(timeout = DEFAULT_TIMEOUT) public void verifyLanguageConfiguration() throws Exception { pageVisit.visitDirectPage(PageCommandAdminConstants.COMMAND_LANGUAGE); - verifyViewContent(AdminViewConstants.ADMIN_LANGUAGE_MANAGEMENT, AdminViewConstants.LANGUAGE_OVERVIEW, + pageVisit.verifyViewContent(AdminViewConstants.ADMIN_LANGUAGE_MANAGEMENT, AdminViewConstants.LANGUAGE_OVERVIEW, AdminViewConstants.LANGUAGE_ADMINISTRATION); pageVisit.validatePage(PageCommandAdminConstants.COMMAND_LANGUAGE); } @@ -62,7 +62,7 @@ public void verifyLanguageConfiguration() throws Exception { @Test(timeout = DEFAULT_TIMEOUT) public void verifyAgencyConfiguration() throws Exception { pageVisit.visitDirectPage(PageCommandAdminConstants.COMMAND_AGENCY); - verifyViewContent(AdminViewConstants.ADMIN_AGENCY_MANAGEMENT, AdminViewConstants.AGENCY_OVERVIEW_HEADER, + pageVisit.verifyViewContent(AdminViewConstants.ADMIN_AGENCY_MANAGEMENT, AdminViewConstants.AGENCY_OVERVIEW_HEADER, AdminViewConstants.AGENCY_OVERVIEW); pageVisit.validatePage(PageCommandAdminConstants.COMMAND_AGENCY); } @@ -75,7 +75,7 @@ public void verifyAgencyConfiguration() throws Exception { @Test(timeout = DEFAULT_TIMEOUT) public void verifyApplicationConfiguration() throws Exception { pageVisit.visitDirectPage(PageCommandAdminConstants.COMMAND_APPLICATION_CONFIGURATION); - verifyViewContent(AdminViewConstants.ADMIN_APPLICATION_CONFIGURATION, + pageVisit.verifyViewContent(AdminViewConstants.ADMIN_APPLICATION_CONFIGURATION, AdminViewConstants.APPLICATION_CONFIGURATION_OVERVIEW, AdminViewConstants.APPLICATION_CONFIGURATION_OVERVIEW); pageVisit.selectFirstGridRow(); diff --git a/citizen-intelligence-agency/src/test/java/com/hack23/cia/systemintegrationtest/admin/data/AdminDataTest.java b/citizen-intelligence-agency/src/test/java/com/hack23/cia/systemintegrationtest/admin/data/AdminDataTest.java index 7f225dde9d..975bf373fb 100644 --- a/citizen-intelligence-agency/src/test/java/com/hack23/cia/systemintegrationtest/admin/data/AdminDataTest.java +++ b/citizen-intelligence-agency/src/test/java/com/hack23/cia/systemintegrationtest/admin/data/AdminDataTest.java @@ -22,7 +22,7 @@ public final class AdminDataTest extends AbstractAdminTest { @Test(timeout = DEFAULT_TIMEOUT) public void verifyDataSummary() throws Exception { pageVisit.visitDirectPage(PageCommandAdminConstants.COMMAND_DATASUMMARY); - verifyViewContent( + pageVisit.verifyViewContent( AdminViewConstants.ADMIN_DATA_SUMMARY_OVERVIEW, AdminViewConstants.DATA_SUMMARY_OVERVIEW ); @@ -39,7 +39,7 @@ public void verifyDataSummary() throws Exception { @Test(timeout = DEFAULT_TIMEOUT) public void verifyDataSummaryAuthor() throws Exception { pageVisit.visitDirectPage(PageCommandAdminConstants.COMMAND_AUTHOR_DATASUMMARY); - verifyViewContent( + pageVisit.verifyViewContent( AdminViewConstants.ADMIN_AUTHOR_SUMMARY, AdminViewConstants.AUTHOR_OVERVIEW, AdminViewConstants.AUTHOR_DETAILED_SUMMARY ); @@ -55,7 +55,7 @@ public void verifyDataSummaryAuthor() throws Exception { @Test(timeout = DEFAULT_TIMEOUT) public void verifyApplicationEvents() throws Exception { pageVisit.visitDirectPage(PageCommandAdminConstants.COMMAND_APPLICATION_EVENTS); - verifyViewContent( + pageVisit.verifyViewContent( AdminViewConstants.ADMIN_APPLICATION_EVENTS, AdminViewConstants.EVENT_DETAILS, AdminViewConstants.EVENT_REVIEW ); @@ -70,7 +70,7 @@ public void verifyApplicationEvents() throws Exception { @Test(timeout = DEFAULT_TIMEOUT) public void verifyApplicationEventsCharts() throws Exception { pageVisit.visitDirectPage(PageCommandAdminConstants.COMMAND_APPLICATION_EVENTS_CHARTS); - verifyViewContent( + pageVisit.verifyViewContent( AdminViewConstants.ADMIN_APPLICATION_EVENT_CHARTS, AdminViewConstants.EVENT_ANALYSIS_HEADER, AdminViewConstants.EVENT_ANALYSIS ); pageVisit.validatePage(PageCommandAdminConstants.COMMAND_APPLICATION_EVENTS_CHARTS); @@ -84,13 +84,13 @@ public void verifyApplicationEventsCharts() throws Exception { @Test(timeout = DEFAULT_TIMEOUT) public void verifyApplicationSessions() throws Exception { pageVisit.visitDirectPage(PageCommandAdminConstants.COMMAND_APPLICATION_SESSION); - verifyViewContent( + pageVisit.verifyViewContent( AdminViewConstants.ADMIN_APPLICATION_SESSIONS, AdminViewConstants.SESSION_DETAILS, AdminViewConstants.SESSION_OVERVIEW ); pageVisit.selectFirstGridRow(); - verifyViewContent( + pageVisit.verifyViewContent( AdminViewConstants.APPLICATION_SESSION_DETAILS, AdminViewConstants.SESSION_TYPE, AdminViewConstants.USER_ID, @@ -107,7 +107,7 @@ public void verifyApplicationSessions() throws Exception { @Test(timeout = DEFAULT_TIMEOUT) public void verifySessionCharts() throws Exception { pageVisit.visitDirectPage(PageCommandAdminConstants.COMMAND_APPLICATION_SESSION_CHARTS); - verifyViewContent( + pageVisit.verifyViewContent( AdminViewConstants.ADMIN_APPLICATION_SESSION_CHARTS, AdminViewConstants.SESSION_ANALYSIS ); diff --git a/citizen-intelligence-agency/src/test/java/com/hack23/cia/systemintegrationtest/admin/operations/AdminOperationsTest.java b/citizen-intelligence-agency/src/test/java/com/hack23/cia/systemintegrationtest/admin/operations/AdminOperationsTest.java index 59c781ea5f..83ef9f8474 100644 --- a/citizen-intelligence-agency/src/test/java/com/hack23/cia/systemintegrationtest/admin/operations/AdminOperationsTest.java +++ b/citizen-intelligence-agency/src/test/java/com/hack23/cia/systemintegrationtest/admin/operations/AdminOperationsTest.java @@ -22,7 +22,7 @@ public final class AdminOperationsTest extends AbstractAdminTest { @Test(timeout = DEFAULT_TIMEOUT) public void verifyAgentOperation() throws Exception { pageVisit.visitDirectPage(PageCommandAdminConstants.COMMAND_AGENT_OPERATION); - verifyViewContent( + pageVisit.verifyViewContent( AdminViewConstants.ADMIN_AGENT_OPERATION_OVERVIEW, AdminViewConstants.ADMIN_AGENT_OPERATION, AdminViewConstants.ADMIN_AGENT_OPERATION_TASKS_OVERVIEW diff --git a/citizen-intelligence-agency/src/test/java/com/hack23/cia/systemintegrationtest/admin/security/AdminSecurityTest.java b/citizen-intelligence-agency/src/test/java/com/hack23/cia/systemintegrationtest/admin/security/AdminSecurityTest.java index 0fa10f3ab5..d18660c757 100644 --- a/citizen-intelligence-agency/src/test/java/com/hack23/cia/systemintegrationtest/admin/security/AdminSecurityTest.java +++ b/citizen-intelligence-agency/src/test/java/com/hack23/cia/systemintegrationtest/admin/security/AdminSecurityTest.java @@ -23,7 +23,7 @@ public final class AdminSecurityTest extends AbstractAdminTest { @Test(timeout = DEFAULT_TIMEOUT) public void verifyUserAccount() throws Exception { pageVisit.visitDirectPage(PageCommandAdminConstants.COMMAND_USERACCOUNT); - verifyViewContent(AdminViewConstants.ADMIN_USER_ACCOUNT_MANAGEMENT, AdminViewConstants.USER_ACCOUNT_OVERVIEW, + pageVisit.verifyViewContent(AdminViewConstants.ADMIN_USER_ACCOUNT_MANAGEMENT, AdminViewConstants.USER_ACCOUNT_OVERVIEW, AdminViewConstants.USER_ACCOUNT_MANAGEMENT_DESCRIPTION); pageVisit.selectFirstGridRow(); pageVisit.validatePage(PageCommandAdminConstants.COMMAND_USERACCOUNT); @@ -37,7 +37,7 @@ public void verifyUserAccount() throws Exception { @Test(timeout = DEFAULT_TIMEOUT) public void verifySessionAccess() throws Exception { pageVisit.visitDirectPage(PageCommandAdminConstants.COMMAND_APPLICATION_SESSION); - verifyViewContent(AdminViewConstants.ADMIN_APPLICATION_SESSIONS, AdminViewConstants.SESSION_DETAILS, + pageVisit.verifyViewContent(AdminViewConstants.ADMIN_APPLICATION_SESSIONS, AdminViewConstants.SESSION_DETAILS, AdminViewConstants.SESSION_OVERVIEW); pageVisit.selectFirstGridRow(); pageVisit.validatePage(PageCommandAdminConstants.COMMAND_APPLICATION_SESSION); diff --git a/citizen-intelligence-agency/src/test/java/com/hack23/cia/systemintegrationtest/ui/UserPageVisit.java b/citizen-intelligence-agency/src/test/java/com/hack23/cia/systemintegrationtest/ui/UserPageVisit.java index f56d315ef2..ee689fcfed 100644 --- a/citizen-intelligence-agency/src/test/java/com/hack23/cia/systemintegrationtest/ui/UserPageVisit.java +++ b/citizen-intelligence-agency/src/test/java/com/hack23/cia/systemintegrationtest/ui/UserPageVisit.java @@ -761,6 +761,18 @@ public void visitDirectPage(final PageModeMenuCommand page) { assertNotNull(driver.getWindowHandle()); } + /** + * Verify view content. + * + * @param contentToVerify the content to verify + */ + public void verifyViewContent(final String... contentToVerify) { + for (final String content : contentToVerify) { + verifyPageContent(content); + } + } + + /** * Visit main view. */