def test_search_data_not_found(self): """ Test case to search data with unregistered account number """ # create Login page object self.loginpage = LoginPage(self.driver) # Step 1 - Login self.loginpage.login_admin_success() # create Dashboard page object self.dashboardpage = DashboardPage(self.driver) # Step 2 - Click menu Cashflow and choose 'Atur Pengeluaran' self.dashboardpage.redirect_to_atur_pengeluaran_page() # create 'Atur Pengeluaran' page object self.aturpengeluaranpage = AturPengeluaranPage(self.driver) # Step 3 - Input unregistered account number on the search bar self.aturpengeluaranpage.search_data_atur_pengeluaran_not_found() # Step 4 - Assertion : No data is presented element_text = self.aturpengeluaranpage.get_text(Locators.ATUR_PENGELUARAN_INFORMATION_COUNT_DATA) self.assertEqual('Menampilkan semua "0 atur pengeluaran"', element_text)
def test_serach_data_not_found(self): """ Test case untuk mencari data atur pengeluaran dengan account number yang tidak ada """ # membuat objek loginpage self.loginpage = LoginPage(self.driver) # Step 1 - login self.loginpage.login_admin_success() # membuat objek dashboard page self.dashboardpage = DashboardPage(self.driver) # Step 2 - Click menu cashflow and choose atur pengengeluaran self.dashboardpage.redirect_to_atur_pengeluaran_page() # membuat objek atur pengeluaran page self.aturpengeluaranpage = AturPengeluaranPage(self.driver) # Step 3 - input no rekening di search bar self.aturpengeluaranpage.search_data_atur_pengeluaran_not_found() # Step 4 - Assertion element_text = self.aturpengeluaranpage.get_text( Locators.ATUR_PENGELUARAN_INFORMATION_COUNT_DATA) self.assertEqual('Menampilkan semua "0 atur pengeluaran"', element_text)
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_login_admin_success(self): """ Test case untuk berhasil login sebagai admin """ # membuat objek loginpage self.loginpage = LoginPage(self.driver) # Step 1 - input username dan password sebagai admiin kemudian klik login self.loginpage.login_admin_success() # membuat objek dashboard page self.dashboardpage = DashboardPage(self.driver) # Step 2 - Assertion self.dashboardpage.is_visible(Locators.LOGO_DASHBOARD_HEADER)
def test_login_admin_success(self): """ Test case Login success as an Admin """ # create Login page object self.loginpage = LoginPage(self.driver) # Step 1 - Input username and password as an admin then click Login button self.loginpage.login_admin_success() # create Dashboard page object self.dashboardpage = DashboardPage(self.driver) # Step 2 - Assertion : Admin Management side menu is not visible self.dashboardpage.is_invisible(Locators.ADMIN_MANAGEMENT_MENU_SIDE)
def test_MissedS3folder(self): """Test mandatory s3folder field""" dashboardPage = DashboardPage(self.driver) dashboardPage.goToOnboard() dashboardPage.createCustomer(USER_NAME, "") errMes = dashboardPage.getErrorNoS3() self.assertEqual(errMes.text, ERR_S3)
def goToDashboard(user): result = Result('goToDashboard') try: find(user.driver, locator['dashboardLink']).click() except: result.fail("unexpected failure navigating to dashboard") traceback.print_exc() if not DashboardPage.checkPageLoaded(user): result.fail("dashboard page did not load") return result
def test_MissedName(self): """Test mandatory name field""" dashboardPage = DashboardPage(self.driver) dashboardPage.goToOnboard() dashboardPage.createCustomer("", S3FOLDER) err1, err2 = dashboardPage.getErrorsNoName() self.assertEqual(err1.text, ERR_MSG1) self.assertEqual(err2.text, ERR_MSG2)
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 LoginDashboardTest(BaseTest): def test_login_superadmin_success(self): """ Test case untuk berhasil login sebagai superadmin """ # membuat objek loginpage self.loginpage = LoginPage(self.driver) # Step 1 - input username dan password sebagai superadmin kemudian klik login self.loginpage.login_superadmin_success() # membuat objek dashboard page self.dashboardpage = DashboardPage(self.driver) # Step 2 - Assertion self.dashboardpage.is_visible(Locators.LOGO_DASHBOARD_HEADER) self.dashboardpage.is_visible(Locators.ADMIN_MANAGEMENT_MENU_SIDER) def test_login_admin_success(self): """ Test case untuk berhasil login sebagai admin """ # membuat objek loginpage self.loginpage = LoginPage(self.driver) # Step 1 - input username dan password sebagai admiin kemudian klik login self.loginpage.login_admin_success() # membuat objek dashboard page self.dashboardpage = DashboardPage(self.driver) # Step 2 - Assertion self.dashboardpage.is_visible(Locators.LOGO_DASHBOARD_HEADER) def test_login_failed_wrong_username(self): """ Test case untuk memastikan bahwa login akan gagal kemudian muncul toast alert jika username salah """ # membuat objek loginpage self.loginpage = LoginPage(self.driver) # Step 1 - input wrong username, input password kemudian klik tombol login self.loginpage.login_failed_if_wrong_username() # Step 2 - Assertion self.loginpage.is_visible(Locators.LOGIN_ALERT_TOAST) def test_login_failed_wrong_password(self): """ Test case untuk memastikan bahwa login akan gagal kemudian muncul toast alert jika password salah """ # membuat objek loginpage self.loginpage = LoginPage(self.driver) # Step 1 - input username, input wrong password kemudian klik tombol login self.loginpage.login_failed_if_wrong_password() # Step 2 - Assertion self.loginpage.is_visible(Locators.LOGIN_ALERT_TOAST) def test_login_failed_no_fill_username_password(self): """ Test case untuk memastikan bahwa login akan gagal kemudian mucul warning alert jika tidak menginput username dan password """ # membuat objek loginpage self.loginpage = LoginPage(self.driver) # Step 1 - no fill username and password, click login button self.loginpage.login_login_failed_if_no_fill_username_password() # Step 2 - Assertion element_text = self.loginpage.get_text( Locators.LOGIN_ERROR_ALERT_USERNAME) element_text1 = self.loginpage.get_text( Locators.LOGIN_ERROR_ALERT_PASSWORD) self.assertEqual("Mohon masukkan username", element_text) self.assertEqual("Mohon masukkan password", element_text1)
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)
class LoginDashboardTest(BaseTest): def test_login_superadmin_success(self): """ Test case Login success as a Super Admin """ # create Login page object self.loginpage = LoginPage(self.driver) # Step 1 - Input username and password as a Super Admin then click Login button self.loginpage.login_superadmin_success() # create Dashboard page object self.dashboardpage = DashboardPage(self.driver) # Step 2 - Assertion : Admin Management side menu is visible self.dashboardpage.is_visible(Locators.ADMIN_MANAGEMENT_MENU_SIDE) def test_login_admin_success(self): """ Test case Login success as an Admin """ # create Login page object self.loginpage = LoginPage(self.driver) # Step 1 - Input username and password as an admin then click Login button self.loginpage.login_admin_success() # create Dashboard page object self.dashboardpage = DashboardPage(self.driver) # Step 2 - Assertion : Admin Management side menu is not visible self.dashboardpage.is_invisible(Locators.ADMIN_MANAGEMENT_MENU_SIDE) def test_login_failed_wrong_username(self): """ Test case Login failed with wrong username """ # create Login page object self.loginpage = LoginPage(self.driver) # Step 1 - Input wrong username, input correct password then click Login button self.loginpage.login_failed_if_wrong_username() # Step 2 - Assertion : Toast alert is visible self.loginpage.is_visible(Locators.LOGIN_ALERT_TOAST) def test_login_failed_wrong_password(self): """ Test case Login failed with wrong password """ # create Login page object self.loginpage = LoginPage(self.driver) # Step 1 - Input correct username, input wrong password then click Login button self.loginpage.login_failed_if_wrong_password() # Step 2 - Assertion : Toast alert is visible self.loginpage.is_visible(Locators.LOGIN_ALERT_TOAST) def test_login_failed_no_fill_username_password(self): """ Test case Login failed with no input """ # create Login page object self.loginpage = LoginPage(self.driver) # Step 1 - Fill no username and password, then click Login button self.loginpage.login_login_failed_if_no_fill_username_password() # Step 2 - Assertion : Alert message is visible element_text1 = self.loginpage.get_text(Locators.LOGIN_ERROR_ALERT_USERNAME) element_text2 = self.loginpage.get_text(Locators.LOGIN_ERROR_ALERT_PASSWORD) self.assertEqual("Mohon masukkan username", element_text1) self.assertEqual("Mohon masukkan password", element_text2)
def test_newCustomer(self): """Verify customer record was created""" dashboardPage = DashboardPage(self.driver) dashboardPage.goToOnboard() dashboardPage.createCustomer(USER_NAME, S3FOLDER) dashboardPage.goToCustomerList() dashboardPage.sortRecentCustomer() initialId = dashboardPage.getId() editPage = dashboardPage.goToEditPage() checkId, checkName, checkS3Folder, maxSize, panoMaxSize, checkBox = editPage.getParameters( ) self.assertEqual(initialId, checkId) self.assertEqual(checkName, USER_NAME) self.assertEqual(checkS3Folder, S3FOLDER) self.assertEqual(maxSize, MAX_SIZE) self.assertEqual(panoMaxSize, PANO_MAX_SIZE) self.assertEqual(CHECK_BOX, checkBox)