def test_add_admin_failed_username_registered(self): """ Test case untuk memastikan bahwa superadmin tidak dapat menambahkan admin jika username telah terdaftar """ # membuat objek loginpage self.loginpage = LoginPage(self.driver) # Step 1 - login sebagai superadmin self.loginpage.login_superadmin_success() # membuat objek dashboard page self.dashboardpage = DashboardPage(self.driver) # Step 2 - Click menu admin management self.dashboardpage.redirect_to_admin_management_page() # membuat objek admin management page self.adminmanagementpage = AdminManagementPage(self.driver) # Step 3 - Click add admin button dan lengkapi form tambah data admin self.adminmanagementpage.superadmin_failed_add_admin_if_username_registered( ) # Step 4 - Assertion element_text = self.adminmanagementpage.get_text( Locators.ALERT_FAILED_ADD_ADMIN) self.assertEqual("Username is already in use!", element_text)
def test_add_admin_success(self): """ Test case Super Admin success add new admin """ # create Login page object self.loginpage = LoginPage(self.driver) # Step 1 - Login as Super Admin self.loginpage.login_superadmin_success() # create Dashboard page object self.dashboardpage = DashboardPage(self.driver) # Step 2 - Click menu admin management self.dashboardpage.redirect_to_admin_management_page() # create Admin Management page object self.adminmanagementpage = AdminManagementPage(self.driver) # Step 3 - Click add admin button fill the form with correct requirements self.adminmanagementpage.superadmin_success_add_admin() # Step 4 - Assertion : Redirected back to Admin Management page self.adminmanagementpage.is_visible(Locators.ADD_ADMIN_BUTTON)
def test_add_admin_failed_username_registered(self): """ Test case Super Admin failed add new admin with registered username """ # create Login page object self.loginpage = LoginPage(self.driver) # Step 1 - Login as Super Admin self.loginpage.login_superadmin_success() # create Dashboard page object self.dashboardpage = DashboardPage(self.driver) # Step 2 - Click menu admin management self.dashboardpage.redirect_to_admin_management_page() # create Admin Management page object self.adminmanagementpage = AdminManagementPage(self.driver) # Step 3 - Click add admin button and fill the form with registered username self.adminmanagementpage.superadmin_failed_add_admin_if_username_registered() # Step 4 - Assertion : Alert message is visible element_text = self.adminmanagementpage.get_text(Locators.ALERT_FAILED_ADD_ADMIN) self.assertEqual("Username is already in use!", element_text)
def test_add_admin_success(self): """ Test case untuk super admin berhasil menambah admin """ # membuat objek loginpage self.loginpage = LoginPage(self.driver) # Step 1 - login sebagai superadmin self.loginpage.login_superadmin_success() # membuat objek dashboard page self.dashboardpage = DashboardPage(self.driver) # Step 2 - Click menu admin management self.dashboardpage.redirect_to_admin_management_page() #membuat objek admin management page self.adminmanagementpage = AdminManagementPage(self.driver) # Step 3 - Click add admin button dan lengkapi form tambah data admin self.adminmanagementpage.superadmin_success_add_admin() # Step 4 - Assertion self.adminmanagementpage.is_visible(Locators.ADD_ADMIN_BUTTON)
class AdminManagementTest(BaseTest): def test_add_admin_success(self): """ Test case Super Admin success add new admin """ # create Login page object self.loginpage = LoginPage(self.driver) # Step 1 - Login as Super Admin self.loginpage.login_superadmin_success() # create Dashboard page object self.dashboardpage = DashboardPage(self.driver) # Step 2 - Click menu admin management self.dashboardpage.redirect_to_admin_management_page() # create Admin Management page object self.adminmanagementpage = AdminManagementPage(self.driver) # Step 3 - Click add admin button fill the form with correct requirements self.adminmanagementpage.superadmin_success_add_admin() # Step 4 - Assertion : Redirected back to Admin Management page self.adminmanagementpage.is_visible(Locators.ADD_ADMIN_BUTTON) def test_add_admin_failed_email_registered(self): """ Test case Super Admin failed add new admin with registered email """ # create Login page object self.loginpage = LoginPage(self.driver) # Step 1 - Login as Super Admin self.loginpage.login_superadmin_success() # create Dashboard page object self.dashboardpage = DashboardPage(self.driver) # Step 2 - Click menu admin management self.dashboardpage.redirect_to_admin_management_page() # create Admin Management page object self.adminmanagementpage = AdminManagementPage(self.driver) # Step 3 - Click add admin button dan fill the form with registered email self.adminmanagementpage.superadmin_failed_add_admin_if_email_registered() # Step 4 - Assertion : Alert message is visible element_text = self.adminmanagementpage.get_text(Locators.ALERT_FAILED_ADD_ADMIN) self.assertEqual("Email is already in use!", element_text) def test_add_admin_failed_username_registered(self): """ Test case Super Admin failed add new admin with registered username """ # create Login page object self.loginpage = LoginPage(self.driver) # Step 1 - Login as Super Admin self.loginpage.login_superadmin_success() # create Dashboard page object self.dashboardpage = DashboardPage(self.driver) # Step 2 - Click menu admin management self.dashboardpage.redirect_to_admin_management_page() # create Admin Management page object self.adminmanagementpage = AdminManagementPage(self.driver) # Step 3 - Click add admin button and fill the form with registered username self.adminmanagementpage.superadmin_failed_add_admin_if_username_registered() # Step 4 - Assertion : Alert message is visible element_text = self.adminmanagementpage.get_text(Locators.ALERT_FAILED_ADD_ADMIN) self.assertEqual("Username is already in use!", element_text)