def open_newcreate_submission(self): AllQuotes = WebDriverWait(self.driver, 30, 0.5).until( EC.visibility_of_element_located((By.XPATH, "//div[@class='wizard-sidebar-policies']"))) lis = AllQuotes.find_elements_by_xpath('div') lis[-1].click() Functions.wait_element_visible(self.driver, By.XPATH, "//h3[@class ='modal-title']") Functions.wait_element_not_visible(self.driver, By.XPATH, "//h3[@class ='modal-title']") sleep(1)
def click_quote_button(self): WebDriverWait(self.driver, 15, 0.5).until( EC.element_to_be_clickable( (By.XPATH, "//button[@class='nbs-button orange-button next-button']" ))).click() Functions.wait_element_visible(self.driver, By.XPATH, "//h3[@class ='modal-title']") Functions.wait_element_not_visible(self.driver, By.XPATH, "//h3[@class ='modal-title']")
def click_supplementalinfo_tab(self): js = "var q=document.documentElement.scrollTop=0" self.driver.execute_script(js) gltab = self.driver.find_elements_by_xpath( "//a[@ng-click='switchTab(tab)']") gltab[6].click() if Functions.wait_element_visible(self.driver, By.XPATH, "//h3[@class ='modal-title']"): Functions.wait_element_not_visible(self.driver, By.XPATH, "//h3[@class ='modal-title']")
def click_next_button(self): js = "window.scrollTo(0,document.body.scrollHeight)" self.driver.execute_script(js) WebDriverWait(self.driver, 30, 0.5).until( EC.element_to_be_clickable(( By.XPATH, "//button[@ng-click='submitSelectedProducts(newSubmissionForm)']" ))).click() Functions.wait_element_visible(self.driver, By.XPATH, "//h3[@class ='modal-title']") Functions.wait_element_not_visible(self.driver, By.XPATH, "//h3[@class ='modal-title']")
def input_annualbasis(self, annualbasis): WebDriverWait(self.driver, 15, 0.5).until( EC.presence_of_element_located( (By.XPATH, "//input[@ng-model='premABDisplayValue.value']" ))).send_keys(annualbasis) self.driver.find_element_by_xpath( "//input[@ng-model='premABDisplayValue.value']").send_keys( Keys.TAB) if Functions.wait_element_visible(self.driver, By.XPATH, "//h3[@class ='modal-title']"): Functions.wait_element_not_visible(self.driver, By.XPATH, "//h3[@class ='modal-title']")
def input_searchkeyword(self, keyword): sleep(2) WebDriverWait(self.driver, 15, 0.5).until( EC.presence_of_element_located( (By.XPATH, "//input[@type='search']"))).send_keys(keyword) sleep(1) self.driver.find_element_by_xpath("//input[@type='search']").send_keys( Keys.ENTER) Functions.wait_element_visible(self.driver, By.XPATH, "//h3[@class ='modal-title']") Functions.wait_element_not_visible(self.driver, By.XPATH, "//h3[@class ='modal-title']")
def input_classcode(self, classcode): WebDriverWait(self.driver, 15, 0.5).until( EC.presence_of_element_located( (By.XPATH, "//textarea[@name='ClassCode']"))).send_keys(classcode) WebDriverWait(self.driver, 15, 0.5).until( EC.element_to_be_clickable( (By.XPATH, "//span[@ng-click='clickOnSuggestionItem(item)']"))).click() if Functions.wait_element_visible(self.driver, By.XPATH, "//h3[@class ='modal-title']"): Functions.wait_element_not_visible(self.driver, By.XPATH, "//h3[@class ='modal-title']")
def test_new_gl_draft(self): # Create screenshot excel book = xlsxwriter.Workbook( '..\MIG_Portal_Automation\TestReports\Create_GL_Indicative_Draft.xlsx' ) # Load test data wb = load_workbook( '..\MIG_Portal_Automation\TestData/test_Create_GL_Indicative_Draft.xlsx' ) ws = wb['GLDraft'] AccountNumber = ws.cell(2, 1).value # Login Portal Functions.login_portal(self.driver) # Home page homeScreen = Common_HomeScreen.Home(self.driver) homeScreen.click_search_icon() # Search Screen searchScreen = Common_SearchScreen.Search(self.driver) searchScreen.input_searchkeyword(AccountNumber) Functions.get_screenshot(self.driver, book, "SearchAccount") searchScreen.click_view_button() # Account Summary Screen accountSummary = Common_AccountSummaryScreen.AccountSummary( self.driver) Functions.get_screenshot(self.driver, book, "AccountSummary") accountSummary.click_startquote() # Start A Quote Screen startQuote = Common_StartAQuoteScreen.StartAQuote(self.driver) startQuote.click_indicative() Functions.get_screenshot(self.driver, book, "StartAQuote") startQuote.click_generalliability() startQuote.click_next_button() # GL Coverage Parts Screen coverageParts = GL_CoveragePartsScreen.CoverageParts(self.driver) quotestatus = coverageParts.get_quote_status() self.assertEqual(quotestatus, 'DRAFT') print(coverageParts.get_quote_status()) Functions.get_screenshot(self.driver, book, "CoverageParts") book.close()
def test_new_gl_draft(self): # Create screenshot excel book = xlsxwriter.Workbook( '..\MIG_Portal_Automation\TestReports\Create_CA_Issuable_Draft.xlsx' ) # Login Portal Functions.login_portal(self.driver) # Home page homeScreen = Common_HomeScreen.Home(self.driver) homeScreen.click_search_icon() # Search Screen searchScreen = Common_SearchScreen.Search(self.driver) searchScreen.input_searchkeyword("4000006373") Functions.get_screenshot(self.driver, book, "SearchAccount") searchScreen.click_view_button() # Account Summary Screen accountSummary = Common_AccountSummaryScreen.AccountSummary( self.driver) Functions.get_screenshot(self.driver, book, "AccountSummary") accountSummary.click_startquote() # Start A Quote Screen startQuote = Common_StartAQuoteScreen.StartAQuote(self.driver) Functions.get_screenshot(self.driver, book, "StartAQuote") startQuote.click_generalliability() startQuote.click_commercialauto() startQuote.click_next_button() # Open CA submission common = Common_CommonScreen.Common(self.driver) common.open_newcreate_submission() # Policy Info Screen policyInfo = Common_BasicPolicyInfoScreen.BasicPolicyInfo(self.driver) submissionnumber = policyInfo.get_submission_number() print(submissionnumber) Functions.get_screenshot(self.driver, book, "PolicyInfo") book.close()
def click_next_button(self): WebDriverWait(self.driver, 15, 0.5).until( EC.presence_of_element_located( (By.XPATH, "//button[@type='submit']"))).click() Functions.wait_element_visible(self.driver, By.XPATH, "//h3[@class ='modal-title']") Functions.wait_element_not_visible(self.driver, By.XPATH, "//h3[@class ='modal-title']") Functions.wait_element_visible(self.driver, By.XPATH, "//h3[@class ='modal-title']") Functions.wait_element_not_visible(self.driver, By.XPATH, "//h3[@class ='modal-title']")
def click_makeissuablequote(self): WebDriverWait(self.driver, 15, 0.5).until( EC.element_to_be_clickable(( By.XPATH, "//button[@class='nbs-button orange-button back-button xs-smaller']" ))).click() Functions.wait_element_visible(self.driver, By.XPATH, "//h3[@class ='modal-title']") Functions.wait_element_not_visible(self.driver, By.XPATH, "//h3[@class ='modal-title']") if Functions.wait_element_visible(self.driver, By.XPATH, "//h3[@class ='modal-title']"): Functions.wait_element_not_visible(self.driver, By.XPATH, "//h3[@class ='modal-title']")
def click_view_button(self): js = "var q=document.documentElement.scrollTop=10000" self.driver.execute_script(js) WebDriverWait(self.driver, 20, 0.5).until( EC.visibility_of_element_located( (By.XPATH, "//button[@class='secondary-button desktop-only medium']" ))).click() Functions.wait_element_visible(self.driver, By.XPATH, "//h3[@class ='modal-title']") Functions.wait_element_not_visible(self.driver, By.XPATH, "//h3[@class ='modal-title']") if (Functions.wait_element_visible(self.driver, By.XPATH, "//h3[@class ='modal-title']")): Functions.wait_element_not_visible(self.driver, By.XPATH, "//h3[@class ='modal-title']")
def test_new_account(self): # Create screenshot excel book = xlsxwriter.Workbook( '..\MIG_Portal_Automation\TestReports\Create_NewAccount.xlsx') # Load test data wb = load_workbook( '..\MIG_Portal_Automation\TestData/test_Create_New_Account.xlsx') ws = wb['NewAccount'] Company = ws.cell(2, 1).value + datetime.now().strftime('%Y%m%d%H%M%S') Address1 = ws.cell(2, 2).value ZipCode = ws.cell(2, 3).value City = ws.cell(2, 4).value County = ws.cell(2, 5).value State = ws.cell(2, 6).value # Login Portal Functions.login_portal(self.driver) # Home Screen homeScreen = Common_HomeScreen.Home(self.driver) homeScreen.click_search_icon() # Search Screen searchScreen = Common_SearchScreen.Search(self.driver) searchScreen.click_createanewone_button() # New Account Details Screen newAccount = Common_NewAccountDetailsScreen.NewAccount(self.driver) newAccount.input_company(Company) Functions.get_screenshot(self.driver, book, "NewAccount") newAccount.click_currentcustomer_no() newAccount.input_address(Address1) newAccount.input_postalcode(ZipCode) newAccount.input_city(City) newAccount.select_state(State) newAccount.input_county(County) newAccount.select_addresstype() newAccount.input_officephone("201-555-1234") newAccount.select_contactmethod() newAccount.click_next_button() # Account Summary Screen accountSummary = Common_AccountSummaryScreen.AccountSummary( self.driver) accountStatus = accountSummary.get_accountstatus() accountnumber = accountSummary.get_accountnumber() self.assertEqual(accountStatus, 'Pending') print(accountnumber) Functions.get_screenshot(self.driver, book, "AccountSummary") book.close()
def test_new_gl_indicative_Issued(self): # Create screenshot excel book = xlsxwriter.Workbook( '..\MIG_Portal_Automation\TestReports\Create_GL_Indicative_Issued.xlsx' ) # Load test data wb = load_workbook( '..\MIG_Portal_Automation\TestData/test_Create_GL_Indicative_Issued.xlsx' ) ws = wb['GLIssued'] AccountNumber = ws.cell(2, 1).value ClassCode = ws.cell(2, 2).value AnnualBasis = ws.cell(2, 3).value # Login Portal Functions.login_portal(self.driver) # Home page homeScreen = Common_HomeScreen.Home(self.driver) homeScreen.click_search_icon() # Search Screen searchScreen = Common_SearchScreen.Search(self.driver) searchScreen.input_searchkeyword(AccountNumber) Functions.get_screenshot(self.driver, book, "SearchAccount") searchScreen.click_view_button() # Account Summary Screen accountSummary = Common_AccountSummaryScreen.AccountSummary( self.driver) Functions.get_screenshot(self.driver, book, "AccountSummary") accountSummary.click_startquote() # Start A Quote Screen startQuote = Common_StartAQuoteScreen.StartAQuote(self.driver) startQuote.click_indicative() Functions.get_screenshot(self.driver, book, "StartAQuote") startQuote.click_generalliability() startQuote.click_next_button() # GL Coverage Parts Screen coverageParts = GL_CoveragePartsScreen.CoverageParts(self.driver) coverageParts.click_commercialgeneralliability() Functions.get_screenshot(self.driver, book, "CoverageParts") coverageParts.click_epli() coverageParts.click_cyberliability() coverageParts.click_next_button() # Policy Info Screen policyInfo = Common_BasicPolicyInfoScreen.BasicPolicyInfo(self.driver) submissionnumber = policyInfo.get_submission_number() print(submissionnumber) Functions.get_screenshot(self.driver, book, "PolicyInfo") policyInfo.click_next_button() # Locations Screen locations = Common_LocationsScreen.Locations(self.driver) Functions.get_screenshot(self.driver, book, "Locations") locations.click_next_button() # CGL Screen cgl = GL_CGLScreen.CGL(self.driver) cgl.click_classcodes_tab() cgl.input_classcode(ClassCode) Functions.get_screenshot(self.driver, book, "ClassCodes") cgl.input_annualbasis(AnnualBasis) cgl.click_next_button() # Loss History losshistory = Common_LossHistoryScreen.LossHistory(self.driver) losshistory.select_lengthofpriorlosshistory("Unknown") losshistory.select_priorlosshistory("Unknown") Functions.get_screenshot(self.driver, book, "Loss History") losshistory.click_next_button() # Policy Review policyreview = Common_PolicyReviewScreen.PolicyReview(self.driver) Functions.get_screenshot(self.driver, book, "PolicyReview") policyreview.click_quote_button() # Quote Summary quotesummary = Common_QuoteSummaryScreen.QuoteSummary(self.driver) print(quotesummary.get_quote_status()) # self.assertEqual(quotesummary.get_quote_status(), 'QUOTED') # Agent Notes refertounderwriter = Common_ReferToUnderwriterScreen.ReferToUnderwriter( self.driver) #refertounderwriter.input_note("amy_notes") #Functions.get_screenshot(self.driver, book, "AddNote") refertounderwriter.click_cancel() # Make issueable quote quotesummary.click_makeissuablequote() Functions.get_screenshot(self.driver, book, "QuoteSummary") quotesummary.click_gotoerror() sleep(2) quotesummary.click_folderror() #Functions.page_scroll_down(self.driver) Functions.get_screenshot(self.driver, book, "SupplementalInfo") cgl.answer_all_questions() cgl.click_next_button() losshistory.click_next_button() policyreview.click_quote_button() refertounderwriter.input_note("amy_notes") Functions.get_screenshot(self.driver, book, "AddNote") refertounderwriter.click_submit() # Policy Center pc = Common_PCScreen.PC(self.driver) Functions.login_pc(self.driver) pc.search_submission(submissionnumber) Functions.get_screenshot(self.driver, book, "PC") pc.click_riskanalysis() pc.checkon_uwissues() pc.click_approve() pc.click_ok() pc.uncheck_hide() pc.click_next() # Return to portal to issue Functions.login_portal(self.driver) homeScreen.click_search_icon() searchScreen.input_searchkeyword(submissionnumber) searchScreen.click_view_button() Functions.get_screenshot(self.driver, book, "PayandIssue") payandissue = Common_PayAndIssueScreen.PayAndIssue(self.driver) payandissue.click_payandissue_button() Functions.get_screenshot(self.driver, book, "IssueSucsess") book.close()
def click_startquote(self): WebDriverWait(self.driver, 30, 0.5).until( EC.element_to_be_clickable((By.XPATH, "//div[@class='row align-middle']/div[2]/div/div[2]/button"))).click() Functions.wait_element_visible(self.driver, By.XPATH, "//h3[@class ='modal-title']") Functions.wait_element_not_visible(self.driver, By.XPATH, "//h3[@class ='modal-title']")
def test_new_gl_indicative_quoted(self): # Create screenshot excel book = xlsxwriter.Workbook( '..\MIG_Portal_Automation\TestReports\Create_GL_Indicative_Quoted.xlsx' ) # Load test data wb = load_workbook( '..\MIG_Portal_Automation\TestData/test_Create_GL_Indicative_Quoted.xlsx' ) ws = wb['GLQuoted'] AccountNumber = ws.cell(2, 1).value ClassCode = ws.cell(2, 2).value AnnualBasis = ws.cell(2, 3).value # Login Portal Functions.login_portal(self.driver) # Home page homeScreen = Common_HomeScreen.Home(self.driver) homeScreen.click_search_icon() # Search Screen searchScreen = Common_SearchScreen.Search(self.driver) searchScreen.input_searchkeyword(AccountNumber) Functions.get_screenshot(self.driver, book, "SearchAccount") searchScreen.click_view_button() # Account Summary Screen accountSummary = Common_AccountSummaryScreen.AccountSummary( self.driver) Functions.get_screenshot(self.driver, book, "AccountSummary") accountSummary.click_startquote() # Start A Quote Screen startQuote = Common_StartAQuoteScreen.StartAQuote(self.driver) startQuote.click_indicative() Functions.get_screenshot(self.driver, book, "StartAQuote") startQuote.click_generalliability() startQuote.click_next_button() # GL Coverage Parts Screen coverageParts = GL_CoveragePartsScreen.CoverageParts(self.driver) Functions.get_screenshot(self.driver, book, "CoverageParts") coverageParts.click_commercialgeneralliability() coverageParts.click_epli() coverageParts.click_cyberliability() coverageParts.click_next_button() # Policy Info Screen policyInfo = Common_BasicPolicyInfoScreen.BasicPolicyInfo(self.driver) Functions.get_screenshot(self.driver, book, "PolicyInfo") policyInfo.click_next_button() # Locations Screen locations = Common_LocationsScreen.Locations(self.driver) Functions.get_screenshot(self.driver, book, "Locations") locations.click_next_button() # CGL Screen cgl = GL_CGLScreen.CGL(self.driver) cgl.click_classcodes_tab() cgl.input_classcode(ClassCode) Functions.get_screenshot(self.driver, book, "ClassCodes") cgl.input_annualbasis(AnnualBasis) cgl.click_next_button() # Loss History losshistory = Common_LossHistoryScreen.LossHistory(self.driver) losshistory.select_lengthofpriorlosshistory("Unknown") losshistory.select_priorlosshistory("Unknown") Functions.get_screenshot(self.driver, book, "Loss History") losshistory.click_next_button() # Policy Review policyreview = Common_PolicyReviewScreen.PolicyReview(self.driver) Functions.get_screenshot(self.driver, book, "PolicyReview") policyreview.click_quote_button() # Quote Summary quotesummary = Common_QuoteSummaryScreen.QuoteSummary(self.driver) refertounderwriter = Common_ReferToUnderwriterScreen.ReferToUnderwriter( self.driver) refertounderwriter.click_cancel() Functions.get_screenshot(self.driver, book, "QuoteSummary") #self.assertEqual(quotesummary.get_quote_status(self.driver), 'QUOTED') print(quotesummary.get_quote_status()) book.close()