示例#1
0
class Filter():
    global objCommon, objActions, objConfig
    objCommon = CommonFunctions()
    objActions = PerformActions()
    objConfig=MyConfigFiles()

    def ClickCreate(self):
        objActions.clickElement(QET.Create_button_xpath, "xpath")

# Method to navigate to the screen from login page
    def NavigateToSCAR(self, ScarID):
        objActions.clickElement(QET.SCARs_link_xpath, "xpath")
        objActions.clickElement("//a[text()='" + ScarID + "']", "xpath")
        time.sleep(2)

# Method to navigate to the screen from login page
    def NavigateToQIP(self, QIPID):
        objActions.clickElement(QET.QIPs_link_xpath, "xpath")
        objActions.clickElement("//a[text()='" + QIPID + "']", "xpath")
        time.sleep(2)


# Method to navigate to the screen from login page
    def NavigateToQI(self, QIID):
        objActions.clickElement(QET.QIs_link_xpath, "xpath")
        objActions.clickElement("//a[text()='" + QIID + "']", "xpath")
        time.sleep(2)
示例#2
0
class login_Page():
    global objCommon, objActions, objPCN
    objCommon = CommonFunctions()
    objActions = PerformActions()

    def PCN_Login(self, UserName, Password):
        objActions.enterText(PCN.username_textbox_id, "id", UserName)
        objActions.enterText(PCN.password_textbox_id, "id", Password)
        objActions.clickElement(PCN.submit_button_xpath, "xpath")
        objCommon.capture_screenshot('Login Page Successfull')

    def PCN_LogOut(self):
        objActions.clickElement(PCN.logout_link_xpath, "xpath")
class SwitchToRoles_Page():
    global objCommon, objActions, objConfig, objHome, objFilter
    objCommon = CommonFunctions()
    objActions = PerformActions()
    objConfig = MyConfigFiles()
    objFilter = Filter()
    objHome = Home()

    #Role Types Available[Context CE, Global Commodity Manager, NPI Material PM, NPI MPM]
    def SwitchToRole(self, roleType):
        time.sleep(3)
        objHome.ClickSwitchRolesLnk()
        time.sleep(2)
        objActions.clickElement(PCN.Submit_SR_button_xpath, "xpath")
        objActions.clickElement("//span[text()='" + roleType + "']/input",
                                "xpath")
        print("Sucessfully selected the role: " + roleType)
        objCommon.capture_screenshot("Role Selected")
        objActions.clickElement(PCN.Submit_SR_button_xpath, "xpath")
class CompleteAssessment_Page():
    global objCommon, objActions ,objConfig,objFilter,objHome,objCreateJPCN,objJPCNStatusOverview
    objCommon = CommonFunctions()
    objActions = PerformActions()
    objConfig=MyConfigFiles()
    objFilter=Filter()
    objHome=Home()
    objCreateJPCN = createJPCN_Page()
    objJPCNStatusOverview=JPCNstatusoverview_Page()



    def Verify_CompleteAssessment(self,strJPNID):
        time.sleep(2)
        objActions.clickElement(PCN.DashBoard_ContextCE_CompleteAssessment_WebElement_xapth, "xpath")
        objJPCNStatusOverview.SelectJCPN(strJPNID)
        objCommon.capture_screenshot("Completed Assessment page display")
        strPageHeader=objActions.getText(PCN.Completed_Assessement_PageHeader_WebElement_xpath, "xpath")
        assert (objActions.getText(PCN.Completed_Assessement_PageHeader_WebElement_xpath, "xpath"))
        print("Completed Assessment page displayed Sucessfully:"  +strPageHeader )
示例#5
0
class Home():
    global objCommon, objActions, objConfig
    objCommon = CommonFunctions()
    objActions = PerformActions()
    objConfig = MyConfigFiles()

    def ClickSwitchRolesLnk(self):
        objActions.clickElement(PCN.Switch_Roles_link_xpath, "xpath")

    def DashboardLnk(self):
        objActions.clickElement(PCN.DashBoard_Button_xpath, "xpath")

    def ClickAdminlnk(self):
        objActions.clickElement(PCN.Admin_link_xpath, "xpath")

    def ClickReportsLnk(self):
        objActions.clickElement(PCN.Reports_link_xpath, "xpath")

    def ClickSearchLnk(self):
        objActions.clickElement(PCN.Search_link_xpath, "xpath")
示例#6
0
class ClosureAssessment_Page():
    global objCommon, objActions, objConfig, objFilter, objHome, objCreateJPCN
    objCommon = CommonFunctions()
    objActions = PerformActions()
    objConfig = MyConfigFiles()
    objFilter = Filter()
    objHome = Home()
    objCreateJPCN = createJPCN_Page()

    def Closure_Assesement_DashBorad_Link(self):
        time.sleep(2)
        objActions.clickElement(
            PCN.DashBoard_ContextCE_ClosureAssessment_WebElement_xapth,
            "xpath")
        time.sleep(3)
        objCommon.capture_screenshot("Closure Assessment  Page intiiated")

    def ValidationcheckFor_JPNMPNInfor_Section(self):
        objCreateJPCN.ClickOnJPN_MPN_Exapnd()
        time.sleep(3)
        global flag
        time.sleep(2)
        strPages = objActions.getText(PCN.ContextCE_TablePage_Count_xpath,
                                      "xpath")
        strPagesCount = strPages.split(" ")
        intPagesCount = int(strPagesCount[4])
        flag = False
        for pages in range(1, intPagesCount + 1):
            objTable = MyConfigFiles.driver.find_elements_by_xpath(
                "//table[@id='upload-jpn']/tbody/tr")
            intRowCount = len(objTable)
            for i in range(2, intRowCount + 1):
                stri = str(i)
                objTablecol = MyConfigFiles.driver.find_elements_by_xpath(
                    "//table[@id='upload-jpn']/tbody/tr/th")
                intColCount = len(objTablecol)
                for j in range(i, intColCount + 1):
                    strj = str(j)
                    strchoosefile = objActions.getText(
                        "//table[@id='upload-jpn']/tbody/tr[" + stri +
                        "]/td[2]", "xpath")
                    if strchoosefile == "MAXIM":
                        time.sleep(2)
                        objActions.clickElement(
                            "//table[@id='upload-jpn']/tbody/tr[" + stri +
                            "]/td[2]//a[1]", "xpath")
                        time.sleep(2)
                        LTB_Decision = MyConfigFiles.driver.find_element_by_xpath(
                            "//div[contains(@class,'supplier-info-section padding-around show-it')]//select[@id='selectDrpDwn']"
                        )
                        LTB_DStatus = LTB_Decision.is_enabled()
                        LTB_Comments = MyConfigFiles.driver.find_element_by_xpath(
                            "//tr[8]//td[2]//div[1]//div[1]//div[1]//input[1]")
                        LTB_CStatus = LTB_Comments.is_enabled()
                        if (LTB_DStatus) and (LTB_CStatus) == True:
                            print("LTB Decision and Comments are  Editable")
                            objActions.selectDropdown(
                                "//div[contains(@class,'supplier-info-section padding-around show-it')]//select[@id='selectDrpDwn']",
                                "xpath", "visibletext", "Bridge Buy")
                            time.sleep(3)
                            objActions.enterText(
                                "//tr[8]//td[2]//div[1]//div[1]//div[1]//input[1]",
                                "xpath", "Comments")
                            time.sleep(3)
                            objCommon.capture_screenshot(
                                "LTB Decision and LTB comments sucessfully edited and saved"
                            )
                            objActions.clickElement(PCN.Submit_SR_button_xpath,
                                                    "xpath")
                            time.sleep(3)
                        else:
                            print("LTB Decision and Comments are not Editable")
                            objCommon.capture_screenshot(
                                "LTB Decision and Comments are not Editable")
                            time.sleep(3)
                            objActions.clickElement(PCN.Cancel_Button_xpath,
                                                    "xpath")
                            flag = True
                            break

    def ValidationcheckFor_CONTEXTCE_DETAILS_Section_ClosureAssessment(
            self, PCNStatus):
        time.sleep(2)
        objActions.selectDropdown(PCN.Validate_PCNStatus_Value_name, "name",
                                  "visibletext", PCNStatus)
        html = MyConfigFiles.driver.find_element_by_tag_name('html')
        html.send_keys(Keys.TAB)
        time.sleep(2)
        strIPCNS_Act = objActions.getText(
            PCN.Validation_msg_ClosureAssesment_WebElement_xapth, "xpath")
        time.sleep(2)
        strIPCNS_Exp = "Invalid pcn status"
        if strIPCNS_Act == strIPCNS_Exp:
            print("Passed - Validation Message is dispalying as::"
                  " " + strIPCNS_Act)
        else:
            print("Failed -NO validation message is displayed")
        assert strIPCNS_Act == strIPCNS_Exp

    def Fill_CONTEXTCE_Drtails_Section_ClosureAssessment(
            self, PCNStatus, pcnComments, pcnClosedComments):
        time.sleep(2)
        objActions.selectDropdown(PCN.Validate_PCNStatus_Value_name, "name",
                                  "visibletext", PCNStatus)
        time.sleep(3)
        objActions.enterText(PCN.Validate_PCNStatusComment_Value_name, "name",
                             pcnComments)
        time.sleep(3)
        objActions.enterText(PCN.PCNStatusClose_Comments_name, "name",
                             pcnClosedComments)
        time.sleep(3)
        objActions.clickElement(PCN.Close_Assessment_WebElement_xpath, "xpath")
        # Waring_Msg=objActions.getText(PCN.Close_Assessment_Warning_WebElement_xpath, "xpath")
        # print(Waring_Msg)
        # assert (objActions.AssertObjectExists(PCN.Close_Assessment_Warning_WebElement_xpath, "xpath"))

    def EDit_PR_Section_ClosureAssessment(self, PCNStatus, pcnComments,
                                          pcnClosedComments):
        time.sleep(3)
        global flag
        time.sleep(4)
        objTable = MyConfigFiles.driver.find_elements_by_xpath(
            "//div[@class='context-ce-details-section padding-around show-it']//div[@class='inline']//div//table[@id='pr']/tbody/tr"
        )
        intRowCount = len(objTable)
        for i in range(2, intRowCount + 1):
            stri = str(i)
            strEcoMcoStatus = objActions.getText(
                "//div[@class='context-ce-details-section padding-around show-it']//div[@class='inline']//div//table[@id='pr']/tbody/tr["
                + stri + "]/td[7]", "xpath")
            if strEcoMcoStatus != '':
                objActions.clickElement(
                    "//div[@class='context-ce-details-section padding-around show-it']//div[@class='inline']//div//table[@id='pr']/tbody/tr["
                    + stri + "]/td[1]", "xpath")
                time.sleep(2)
                MyConfigFiles.driver.find_element_by_name("mcoEco").clear()
                objActions.enterText(PCN.AddNewRecord_ECOMCO_WebEdit_name,
                                     "name", "Invailddata")
                objCommon.capture_screenshot(
                    "MCOECO Values is edited Sucessfully with invalid data")
                objActions.clickElement(PCN.AddNewAttachement_SubmitBtn_xpath,
                                        "xpath")
                time.sleep(1)
                objActions.selectDropdown(PCN.Validate_PCNStatus_Value_name,
                                          "name", "visibletext", PCNStatus)
                time.sleep(2)
                objActions.enterText(PCN.Validate_PCNStatusComment_Value_name,
                                     "name", pcnComments)
                time.sleep(2)
                objActions.enterText(PCN.PCNStatusClose_Comments_name, "name",
                                     pcnClosedComments)
                time.sleep(2)
                objActions.clickElement(PCN.Close_Assessment_WebElement_xpath,
                                        "xpath")
                Waring_Msg = objActions.getText(
                    PCN.Close_Assessment_Warning_WebElement_xpath, "xpath")
                print(Waring_Msg)
                assert (objActions.AssertObjectExists(
                    PCN.Close_Assessment_Warning_WebElement_xpath, "xpath"))
                objActions.clickElement(PCN.Completed_Page_OK_button_xpath,
                                        "xpath")
                time.sleep(2)
                objActions.clickElement(
                    "//div[@class='context-ce-details-section padding-around show-it']//div[@class='inline']//div//table[@id='pr']/tbody/tr["
                    + stri + "]/td[1]", "xpath")
                time.sleep(2)
                MyConfigFiles.driver.find_element_by_name("mcoEco").clear()
                objActions.clickElement(PCN.AddNewAttachement_SubmitBtn_xpath,
                                        "xpath")
                time.sleep(2)
                objActions.clickElement(PCN.Close_Assessment_WebElement_xpath,
                                        "xpath")
            break
class JPCNstatusoverview_Page():
    global objCommon, objActions, objConfig, objFilter, objHome
    objCommon = CommonFunctions()
    objActions = PerformActions()
    objConfig = MyConfigFiles()
    objFilter = Filter()
    objHome = Home()

    def ClickContextCE_Create_Items(self):
        time.sleep(2)
        objActions.clickElement(PCN.DashBoard_CreateItem_WebElement_xpath,
                                "xpath")
        objCommon.capture_screenshot('Clicked on Create Item Sections')

    def ClickContextCE_InitialAssessment_Items(self):
        time.sleep(2)
        objActions.clickElement(
            PCN.DashBoard_InitialAssessment_WebElement_xpath, "xpath")
        objCommon.capture_screenshot('Clicked on InitialAssessment Sections')

    def ClickDashboard_Link(self):
        time.sleep(3)
        html = MyConfigFiles.driver.find_element_by_tag_name('html')
        html.send_keys(Keys.PAGE_UP)
        time.sleep(2)
        objActions.clickElement(PCN.DashBoard_Button_xpath, "xpath")
        assert (objActions.AssertObjectExists(PCN.DashBoard_Button_xpath,
                                              "xpath"))
        print("Dashboard link clicked sucessfully")

    def ClickCoreCE_AssesmnetPending_Items(self):
        time.sleep(2)
        objActions.clickElement(
            PCN.DashBoard_CoreCEAssessment_WebElement_xpath, "xpath")
        objCommon.capture_screenshot(
            'Clicked on CoreCE Assessment Item Sections')
        time.sleep(3)

    def SelectJCPN(self, JCPNInput):
        global flag
        time.sleep(2)
        # self.ClickContextCE_Create_Items()
        strPages = objActions.getText(PCN.ContextCE_TablePage_Count_xpath,
                                      "xpath")
        strPagesCount = strPages.split(" ")
        intPagesCount = int(strPagesCount[4])
        if intPagesCount <= 1:
            time.sleep(30)
        # print("Number of pages displayed: "+str(intPagesCount))
        flag = False
        for pages in range(1, intPagesCount + 1):
            objTable = MyConfigFiles.driver.find_elements_by_xpath(
                "//table[@id='created-jpcn']/tbody/tr")
            intRowCount = len(objTable)
            # print("Rows Count in page "+str(pages)+" is: "+str(intRowCount-1))
            for i in range(2, intRowCount + 1):
                stri = str(i)
                strJCPN = objActions.getText(
                    "//table[@id='created-jpcn']/tbody/tr[" + stri + "]/td[2]",
                    "xpath")
                # print(strJCPN)
                if strJCPN == JCPNInput:
                    time.sleep(2)
                    objActions.clickElement(
                        "//table[@id='created-jpcn']/tbody/tr[" + stri +
                        "]/td[2]", "xpath")
                    flag = True
                    # print("JPCN is displayed on Page: "+str(pages))
                    break
                    time.sleep(10)
            if flag == True:
                break
            else:
                time.sleep(3)
                objActions.clickElement("//a[text()='" + str(pages + 1) + "']",
                                        "xpath")
                time.sleep(4)
        if flag == False:
            sys.exit("FAILED:: Could not find the JPCNNumber: " + JCPNInput)

    def SendBack_with_AssignBacktoContextCE(self, AssginbackComments):
        time.sleep(2)
        objActions.clickElement(PCN.JPCNStatus_Overivew_Button_xpath, "xpath")
        time.sleep(3)
        objActions.enterText(PCN.AssignBack_Comments_WebEdit_xpath, "xpath",
                             AssginbackComments)
        time.sleep(2)
        assert (objActions.AssertObjectExists(PCN.submit_button_xpath,
                                              "xpath"))
        objActions.clickElement(PCN.submit_button_xpath, "xpath")
        objCommon.capture_screenshot("Sendback to Context CE")

    def Reassign_Assessment(self):
        time.sleep(2)
        objActions.clickElement(
            PCN.DashBoard_ReassignAssessment_WebElement_xpath, "xpath")

    def Validation_OnCoreCE_ManadtoryFields(self, strFilePath, QRAS, QRRC,
                                            CoreCERecommendations,
                                            CoreCeREComments, ReasonforNC):
        time.sleep(2)
        # objCommon.AttachFile(strFilePath, PCN.QualDataReview_CoreCE_Attachement_xpath, "xpath")
        # time.sleep(3)
        # objActions.clickElement(PCN.QualDateReview_CoreCe_Upload_xpath, "xpath")
        # time.sleep(4)
        time.sleep(2)
        objActions.selectDropdown(PCN.QualReport_AcceptStaus_CoreCE_xpath,
                                  "xpath", "visibletext", QRAS)
        time.sleep(3)
        objActions.enterText(PCN.QualReport_ReviewComments_CoreCE_xpath,
                             "xpath", QRRC)
        time.sleep(2)
        objActions.selectDropdown(PCN.CoreCe_Recommendation_name, "name",
                                  "visibletext", CoreCERecommendations)
        time.sleep(2)
        objActions.enterText(PCN.CoreCe_Recommendation_comments_name, "name",
                             CoreCeREComments)
        time.sleep(3)
        self.CoreCE_PCN_ChangeComplianceSelect_Validations(ReasonforNC)
        time.sleep(2)
        strMsg1 = objActions.getText(PCN.CoreCE_ChangeStatus_xapth, "xpath")
        strMsg2 = objActions.getText(PCN.CoreCE_Gobackmsg_xpath, "xpath")
        strValidationMsg = strMsg1 + strMsg2
        time.sleep(2)
        print("Display Validations message" + strValidationMsg)
        time.sleep(2)

    def Goabck_button(self):
        time.sleep(3)
        objActions.clickElement(PCN.Goback_Button_xpath, "xpath")
        time.sleep(3)
        # self.CoreCE_PCN_ChangeComplianceSelect_Validations(ReasonforNC)

    def Submit_CoreCE_Assessment(self):
        objActions.clickElement(PCN.submit_button_xpath, "xpath")
        time.sleep(3)
        objActions.clickElement(
            PCN.DashBoard_CoreCECompAssessment_WebElement_xpath, "xpath")
        time.sleep(3)
        self.SelectJCPN()
        time.sleep(3)
        JPCNStatus = objActions.getText(PCN.JPCN_Analyis_Stage_Status_xpath,
                                        "xpath")
        print("JPCN Analyis stage is completed sucessfully" + JPCNStatus)
        objCommon.capture_screenshot("JPCN Closed sucessfully")

    def CoreCE_PCN_ChangeComplianceSelect_Validations(self, ReasonforNC):
        time.sleep(3)
        # strPCNComplience = objActions.getText(PCN.PCNCompliance_CoreCE_SelectBox_xpath, "xpath")
        strPCNComplience = objActions.ValidationOnSelectedtext(
            PCN.Compliance_CoreCE_SelectBox_xpath, "xpath")
        print(strPCNComplience)
        time.sleep(2)
        if strPCNComplience == "Compliant":
            time.sleep(2)
            objActions.selectDropdown(PCN.Compliance_CoreCE_SelectBox_xpath,
                                      "xpath", "visibletext", "Non-Compliant")
            time.sleep(2)
            objActions.selectDropdown(
                PCN.PCNReason_NonCompliance_CoreCE_SelectBox_xpath, "xpath",
                "visibletext", ReasonforNC)
        else:
            time.sleep(2)
            objActions.selectDropdown(PCN.Compliance_CoreCE_SelectBox_xpath,
                                      "xpath", "visibletext", "Compliant")
            time.sleep(2)
            objActions.enterText(PCN.CoreCE_Justifications_name, "name",
                                 "Justificaion")
            time.sleep(3)
        objActions.clickElement(PCN.Complete_Assessment_Button_xpath, "xpath")
示例#8
0
class Test_PCN():
    global objLogin, objCreateJPCN, objCommon, objJPCNStatusOverview, objSwitchToRoles, objHome, objInitalAssessment, objClosureAssessment, objCompleteAssessment, objSearch
    objLogin = login_Page()
    objCreateJPCN = createJPCN_Page()
    objCommon = CommonFunctions()
    objJPCNStatusOverview = JPCNstatusoverview_Page()
    objSwitchToRoles = SwitchToRoles_Page()
    objHome = Home()
    objInitalAssessment = InitilaAssessment_Page()
    objClosureAssessment = ClosureAssessment_Page()
    objCompleteAssessment = CompleteAssessment_Page()
    objSearch = Search_Page()

    # PCN login and  Switch roles to ContextCE for Creating PCN
    @pytest.mark.dependency()
    @pytest.mark.regression
    @pytest.mark.P1
    def test_TC001_PCN_Switchtootherroles(self, setup, TestData):
        objLogin.PCN_Login(TestData['UserName'], TestData['Password'])
        objSwitchToRoles.SwitchToRole("Context CE")

    #************************** NON-IMPACT FLOW**************************************************************
    @pytest.mark.regression
    @pytest.mark.P1
    # @pytest.mark.dependency(depends=["Test_PCN::test_TC001_PCN_Switchtootherroles"])
    def test_TC002_PCN_CreateJPCN(self, setup, TestData):
        self.test_TC001_PCN_Switchtootherroles(setup, TestData)
        objCreateJPCN.CreateJPCN(TestData['SupplierName'],
                                 TestData['SupplierPCN'])
        datelist = objCreateJPCN.PCN_DateSelections(TestData['PCN_EffDays'],
                                                    TestData['PCNTYPE'],
                                                    TestData['LT_BuyDays'],
                                                    TestData['LT_ShipDays'])
        # objCreateJPCN.PCNType_Dropdown_selections(TestData['PCNTYPE'],TestData['PDNLSDays'],TestData['PDNLBDays'])
        strJPNID = objCreateJPCN.PDNinfo_form(
            TestData['PCNSource'], TestData['DescriptionChange'],
            TestData['Natureofchange'], TestData['Typeofchange'],
            TestData['PendingConcernsComments'])
        return strJPNID, datelist

    @pytest.mark.regression
    @pytest.mark.P1
    # @pytest.mark.dependency(depends=["Test_PCN::test_TC002_PCN_CreateJPCN"])
    def test_TC003_PCN_Horizon_PrePCN_Validations(self, setup, TestData):
        self.test_TC002_PCN_CreateJPCN(setup, TestData)
        objCreateJPCN.Validate_CCE_PrePoulated_Values()
        objCreateJPCN.Validate_InvalidPCN_Status(TestData['PCNStatus_Open'])
        objCreateJPCN.Validate_InvalidPCN_Status(TestData['PCNStatus_Reopen'])
        objCreateJPCN.ClosethisPCN(TestData['PCNStatus_Closed'])

    @pytest.mark.regression
    @pytest.mark.P1
    @pytest.mark.dependency()
    # @pytest.mark.dependency(depends=["Test_PCN::test_TC003_PCN_Horizon_PrePCN_Validations"])
    def test_TC004_PCN_InformationalNotice_Validations(self, setup, TestData):
        self.test_TC003_PCN_Horizon_PrePCN_Validations(setup, TestData)

#**************************************NO-IMPACT FLOW*************************************************

    @pytest.mark.dependency()
    @pytest.mark.regression
    @pytest.mark.P1
    # @pytest.mark.dependency(depends=["Test_PCN::test_TC002_PCN_CreateJPCN"])
    def test_TC005_PCN_ProcessChange_Validations(self, setup, TestData):
        strJPNID = self.test_TC002_PCN_CreateJPCN(setup, TestData)
        objCreateJPCN.JPN_MPN_Info('NoImpactFound1')
        objCreateJPCN.Uploadvalidation()
        objJPCNStatusOverview.ClickContextCE_Create_Items()
        objJPCNStatusOverview.SelectJCPN(strJPNID)
        objCreateJPCN.JPN_MPN_Info_ValidationCheck()
        objCreateJPCN.Validate_CCE_PrePoulated_Values()
        objCreateJPCN.Validate_InvalidPCN_Status(TestData['PCNStatus_Open'])
        objCreateJPCN.Validate_InvalidPCN_Status(TestData['PCNStatus_Reopen'])
        objCreateJPCN.ClosethisPCN(TestData['PCNStatus_Closed'])

    @pytest.mark.dependency()
    @pytest.mark.regression
    @pytest.mark.P1
    # @pytest.mark.dependency(depends=["Test_PCN::test_TC005_PCN_ProcessChange_Validations"])
    def test_TC006_PCN_DesignChange_Validations(self, setup, TestData):
        strJPNID = self.test_TC005_PCN_ProcessChange_Validations(
            setup, TestData)
        return strJPNID

    @pytest.mark.dependency()
    @pytest.mark.regression
    @pytest.mark.P1
    # @pytest.mark.dependency(depends=["Test_PCN::test_TC005_PCN_ProcessChange_Validations"])
    def test_TC007_PCN_EOL_Validations(self, setup, TestData):
        strJPNID = self.test_TC005_PCN_ProcessChange_Validations(
            setup, TestData)
        return strJPNID

# ********************************PCN Flow-Create Stage For Process Change************************************************************

    @pytest.mark.dependency()
    @pytest.mark.regression
    @pytest.mark.P1
    # @pytest.mark.dependency(depends=["Test_PCN::test_TC002_PCN_CreateJPCN"])
    def test_TC008_PCN_CreatePCN_For_PCNTYPE_Process_Change(
            self, setup, TestData):
        [strJPNID, datelist] = self.test_TC002_PCN_CreateJPCN(setup, TestData)
        objCreateJPCN.JPN_MPN_Info('MaximSupplierStatus1')
        objCreateJPCN.Uploadvalidation()
        objJPCNStatusOverview.ClickContextCE_Create_Items()
        objJPCNStatusOverview.SelectJCPN(strJPNID)
        objCreateJPCN.Verify_BackButton_Navigation()
        objCreateJPCN.Edit_EnterPCNDetails_Page(TestData['SupplierPCN'])
        objCreateJPCN.EOL_InvistigationFileUpload_fromJPNTable1(
            'EOL-Investigation-Form')
        objCreateJPCN.EOL_Upload_Validations(TestData['strResponsibleCoreCE'])
        objCreateJPCN.AddNewAttachement_JPNMPN(TestData['strCategory'], 'MPN4',
                                               'enter')
        objCreateJPCN.DeleteAttachement()
        objCreateJPCN.PreviewScreen_Validations(
            TestData['PendingConcernsComments'])
        objCreateJPCN.Verify_SupplierInfo_Edit_ProductData_Section()
        objCreateJPCN.Verify__PCN_PDNinfo_Edit_ProductData_Section(
            TestData['DescriptionChange'])
        objCreateJPCN.WhereUserAnalysis(TestData['PCNTYPE'],
                                        TestData['strCategory'], 'MPN4',
                                        'enter')
        return strJPNID, datelist

# ********************************PCN Flow-Create Stage For Design Changee************************************************************

    @pytest.mark.dependency()
    @pytest.mark.regression
    @pytest.mark.P1
    # @pytest.mark.dependency(depends=["Test_PCN::test_TC008_PCN_CreatePCN_For_PCNTYPE_Process_Change"])
    def test_TC009_PCN_CreatePCN_For_PCNTYPE_Design_Change(
            self, setup, TestData):
        [strJPNID,
         datelist] = self.test_TC008_PCN_CreatePCN_For_PCNTYPE_Process_Change(
             setup, TestData)
        return strJPNID, datelist

    # ********************************PDN Flow-Create Stage For EOL************************************************************
    @pytest.mark.dependency()
    @pytest.mark.regression
    @pytest.mark.P1
    # @pytest.mark.dependency(depends=["Test_PCN::test_TC008_PCN_CreatePCN_For_PCNTYPE_Process_Change"])
    def test_TC010_PCN_CreatePDN_For_PCNTYPE_EOL(self, setup, TestData):
        [strJPNID,
         datelist] = self.test_TC008_PCN_CreatePCN_For_PCNTYPE_Process_Change(
             setup, TestData)
        return strJPNID, datelist

# ***************************************PCN Initial Assessment Workflow-Create Stage*************************************************

    @pytest.mark.regression
    @pytest.mark.P1
    @pytest.mark.dependency()
    # @pytest.mark.dependency(depends=["Test_PCN::test_TC008_PCN_CreatePCN_For_PCNTYPE_Process_Change"])
    def test_TC011_PCN_InitialAssessment_For_ProcessChangePCNType_Verify_Morethan90days(
            self, setup, TestData):
        [strJPNID,
         datelist] = self.test_TC008_PCN_CreatePCN_For_PCNTYPE_Process_Change(
             setup, TestData)
        objJPCNStatusOverview.ClickContextCE_InitialAssessment_Items()
        objJPCNStatusOverview.SelectJCPN(strJPNID)
        objCreateJPCN.Verify_SupplierInfo_Edit_ProductData_Section()
        objCreateJPCN.Verify__PCN_PDNinfo_Edit_ProductData_Section(
            TestData['DescriptionChange'])
        objInitalAssessment.InitialAssessment_ContextCE_Details(
            TestData['CCER'], TestData['priorityType'], TestData['CCERC'],
            TestData['PCNTYPE'], TestData['ASQNeeded'],
            TestData['ASQNComments'])
        objInitalAssessment.InitialAssessment_AddNewRecord(
            TestData['PR'], TestData['Deviation'], TestData['DeviationStatus'],
            TestData['Seventeneleveen'], TestData['JPN'], TestData['MPN'],
            TestData['HTR'], TestData['MCOECO'], TestData['QPET'],
            TestData['Comments'], TestData['JuniperAssembly'])
        objInitalAssessment.QualDataReview_Attachement(
            'QualReport', TestData['QualReportStatus'],
            TestData['QualReportComments'])
        objInitalAssessment.InitialAssessment_Checking_AutoPopulationOfPCNCompliance(
            TestData['PCNTYPE'], datelist['intEFRCDiff'], 'intBRDiff',
            'intSBDiff', TestData['ReasonforNC'])
        objInitalAssessment.Complete_Assessment()
        return strJPNID, datelist

    @pytest.mark.regression
    @pytest.mark.P1
    @pytest.mark.dependency()
    # @pytest.mark.dependency(depends=["Test_PCN::test_TC011_PCN_InitialAssessment_For_ProcessChangePCNType_Verify_Morethan90days"])
    def test_TC012_PCN_InitialAssessment_For_DesignChangePCNType_Verify_Morethan90days(
            self, setup, TestData):
        self.test_TC011_PCN_InitialAssessment_For_ProcessChangePCNType_Verify_Morethan90days(
            setup, TestData)

    @pytest.mark.regression
    @pytest.mark.P1
    @pytest.mark.dependency()
    # @pytest.mark.dependency(depends=["Test_PCN::test_TC011_PCN_InitialAssessment_For_ProcessChangePCNType_Verify_Morethan90days"])
    def test_TC013_PCN_InitialAssessment_For_DesignChangePCNType_Verify_lessthan90days(
            self, setup, TestData):
        self.test_TC011_PCN_InitialAssessment_For_ProcessChangePCNType_Verify_Morethan90days(
            setup, TestData)

    @pytest.mark.regression
    @pytest.mark.P1
    @pytest.mark.dependency()
    # @pytest.mark.dependency(depends=["Test_PCN::test_TC011_PCN_InitialAssessment_For_ProcessChangePCNType_Verify_Morethan90days"])
    def test_TC014_PCN_InitialAssessment_For_ProcessChangePCNType_Verify_lessthan90days(
            self, setup, TestData):
        self.test_TC011_PCN_InitialAssessment_For_ProcessChangePCNType_Verify_Morethan90days(
            setup, TestData)

# PDN work flow with Combinations of (Last Time Buy Date) - (PCN Received Date) and (Last Time Ship Date) - (Last Time Buy Date) >= 180

    @pytest.mark.regression
    @pytest.mark.P1
    @pytest.mark.dependency()
    # @pytest.mark.dependency(depends=["Test_PCN::test_TC011_PCN_InitialAssessment_For_ProcessChangePCNType_Verify_Morethan90days"])
    def test_TC015_PCN_PDN_InitialAssessment_For_EOLPCNType_Verify_Morethan180days(
            self, setup, TestData):
        [strJPNID,
         datelist] = self.test_TC008_PCN_CreatePCN_For_PCNTYPE_Process_Change(
             setup, TestData)
        objJPCNStatusOverview.ClickContextCE_InitialAssessment_Items()
        objJPCNStatusOverview.SelectJCPN(strJPNID)
        objCreateJPCN.Verify_SupplierInfo_Edit_ProductData_Section()
        objCreateJPCN.Verify__PCN_PDNinfo_Edit_ProductData_Section(
            TestData['DescriptionChange'])
        objInitalAssessment.InitialAssessment_ContextCE_Details(
            TestData['CCER'], TestData['priorityType'], TestData['CCERC'],
            TestData['PCNTYPE'], TestData['ASQNeeded'],
            TestData['ASQNComments'])
        objInitalAssessment.InitialAssessment_AddNewRecord(
            TestData['PR'], TestData['Deviation'], TestData['DeviationStatus'],
            TestData['Seventeneleveen'], TestData['JPN'], TestData['MPN'],
            TestData['HTR'], TestData['MCOECO'], TestData['QPET'],
            TestData['Comments'], TestData['JuniperAssembly'])
        objInitalAssessment.QualDataReview_Attachement(
            'QualReport', TestData['QualReportStatus'],
            TestData['QualReportComments'])
        objInitalAssessment.InitialAssessment_Checking_AutoPopulationOfPCNCompliance(
            TestData['PCNTYPE'], datelist['intEFRCDiff'],
            datelist['intBRDiff'], datelist['intSBDiff'],
            TestData['ReasonforNC'])
        objInitalAssessment.Complete_Assessment()

# PDN work flow with Combinations of (Last Time Buy Date) - (PCN Received Date) and (Last Time Ship Date) - (Last Time Buy Date) < 180

    @pytest.mark.regression
    @pytest.mark.P1
    @pytest.mark.dependency()
    # @pytest.mark.dependency(depends=["Test_PCN::test_TC015_PCN_PDN_InitialAssessment_For_EOLPCNType_Verify_Morethan180days"])
    def test_TC016_PCN_PDN_InitialAssessment_For_EOLPCNType_Verify_lessthan180days(
            self, setup, TestData):
        self.test_TC015_PCN_PDN_InitialAssessment_For_EOLPCNType_Verify_Morethan180days(
            setup, TestData)

# PDN work flow with Combinations of (Last Time Buy Date) - (PCN Received Date) and (Last Time Ship Date) - (Last Time Buy Date) < 180

    @pytest.mark.regression
    @pytest.mark.P1
    @pytest.mark.dependency()
    # @pytest.mark.dependency(depends=["Test_PCN::test_TC011_PCN_InitialAssessment_For_ProcessChangePCNType_Verify_Morethan90days"])
    def test_TC017_PCN_CoreSE_SendBack_For_ProcessChangePCNType(
            self, setup, TestData):
        [
            strJPNID, datelist
        ] = self.test_TC011_PCN_InitialAssessment_For_ProcessChangePCNType_Verify_Morethan90days(
            setup, TestData)
        # objLogin.PCN_Login(TestData['UserName'], TestData['Password'])
        objSwitchToRoles.SwitchToRole("Core CE")
        objJPCNStatusOverview.ClickDashboard_Link()
        objJPCNStatusOverview.ClickCoreCE_AssesmnetPending_Items()
        objJPCNStatusOverview.SelectJCPN(strJPNID)
        objJPCNStatusOverview.SendBack_with_AssignBacktoContextCE(
            TestData['AssginbackComments'])
        return strJPNID, datelist

    @pytest.mark.regression
    @pytest.mark.P1
    @pytest.mark.dependency()
    # @pytest.mark.dependency(depends=["Test_PCN::test_TC017_PCN_CoreSE_SendBack_For_ProcessChangePCNType"])
    def test_TC018_PCN_Reassign_Assessment(self, setup, TestData):
        [strJPNID, datelist
         ] = self.test_TC017_PCN_CoreSE_SendBack_For_ProcessChangePCNType(
             setup, TestData)
        objSwitchToRoles.SwitchToRole("Context CE")
        objJPCNStatusOverview.ClickDashboard_Link()
        objJPCNStatusOverview.Reassign_Assessment()
        objJPCNStatusOverview.SelectJCPN(strJPNID)
        objCreateJPCN.Verify_SupplierInfo_Edit_ProductData_Section()
        objCreateJPCN.Verify__PCN_PDNinfo_Edit_ProductData_Section(
            TestData['DescriptionChange'])
        objInitalAssessment.InitialAssessment_AddNewRecord(
            TestData['PR'], TestData['Deviation'], TestData['DeviationStatus'],
            TestData['Seventeneleveen'], TestData['JPN'], TestData['MPN'],
            TestData['HTR'], TestData['MCOECO'], TestData['QPET'],
            TestData['Comments'], TestData['JuniperAssembly'])
        objInitalAssessment.Complete_Assessment()
        return strJPNID, datelist

    @pytest.mark.regression
    @pytest.mark.P1
    @pytest.mark.dependency()
    # @pytest.mark.dependency(depends=["Test_PCN::test_TC018_PCN_Reassign_Assessment"])
    def test_TC019_PCN_CompletedCoreCE_Assessment(self, setup, TestData):
        [strJPNID,
         datelist] = self.test_TC018_PCN_Reassign_Assessment(setup, TestData)
        objSwitchToRoles.SwitchToRole("Core CE")
        objJPCNStatusOverview.ClickDashboard_Link()
        objJPCNStatusOverview.ClickCoreCE_AssesmnetPending_Items()
        objJPCNStatusOverview.SelectJCPN(strJPNID)
        objCreateJPCN.Verify_SupplierInfo_Edit_ProductData_Section()
        objCreateJPCN.Verify__PCN_PDNinfo_Edit_ProductData_Section(
            TestData['DescriptionChange'])
        objInitalAssessment.InitialAssessment_AddNewRecord(
            TestData['PR'], TestData['Deviation'], TestData['DeviationStatus'],
            TestData['Seventeneleveen'], TestData['JPN'], TestData['MPN'],
            TestData['HTR'], TestData['MCOECO'], TestData['QPET'],
            TestData['Comments'], TestData['JuniperAssembly'])
        objCreateJPCN.ClickOnJPN_MPN_Exapnd()
        objCreateJPCN.EOL_InvistigationFileUpload_fromJPNTable1(
            'EOL-Investigation-Form')
        objCreateJPCN.DeleteAttachement_PRrows()
        objJPCNStatusOverview.Validation_OnCoreCE_ManadtoryFields(
            'MPN4', TestData['QRAS'], TestData['QRRC'],
            TestData['CoreCERecommendations'], TestData['CoreCeREComments'],
            TestData['ReasonforNC'])
        objJPCNStatusOverview.Goabck_button()
        objJPCNStatusOverview.CoreCE_PCN_ChangeComplianceSelect_Validations(
            TestData['ReasonforNC'])
        objJPCNStatusOverview.Goabck_button()
        objInitalAssessment.Complete_Assessment()
        objInitalAssessment.Submit_OnWarringWindow()
        return strJPNID, datelist

    @pytest.mark.regression
    @pytest.mark.P1
    @pytest.mark.dependency()
    # @pytest.mark.dependency(depends=["Test_PCN::test_TC019_PCN_CompletedCoreCE_Assessment"])
    def test_TC020_PCN_ContextCE_ClosureAssessment(self, setup, TestData):
        [strJPNID, datelist
         ] = self.test_TC019_PCN_CompletedCoreCE_Assessment(setup, TestData)
        # objLogin.PCN_Login(TestData['UserName'], TestData['Password'])
        objSwitchToRoles.SwitchToRole("Context CE")
        objJPCNStatusOverview.ClickDashboard_Link()
        objClosureAssessment.Closure_Assesement_DashBorad_Link()
        objJPCNStatusOverview.SelectJCPN(strJPNID)  #JPCN-100100085
        objClosureAssessment.ValidationcheckFor_JPNMPNInfor_Section()
        objClosureAssessment.ValidationcheckFor_CONTEXTCE_DETAILS_Section_ClosureAssessment(
            TestData['PCNStatus_Reopen'])
        objClosureAssessment.ValidationcheckFor_CONTEXTCE_DETAILS_Section_ClosureAssessment(
            TestData['PCNStatus_Open'])
        objClosureAssessment.EDit_PR_Section_ClosureAssessment(
            TestData['PCNStatus_Closed'], TestData['pcnComments'],
            TestData['pcnClosedComments'])
        objCompleteAssessment.Verify_CompleteAssessment(strJPNID)
        return strJPNID, datelist

    @pytest.mark.regression
    @pytest.mark.P1
    @pytest.mark.dependency()
    # @pytest.mark.dependency(depends=["Test_PCN::test_TC019_PCN_CompletedCoreCE_Assessment"])
    def test_TC021_PCN_SolvingMultiple_CoreCE_Problem(self, setup, TestData):
        [strJPNID, datelist] = self.test_TC002_PCN_CreateJPCN(setup, TestData)
        objCreateJPCN.JPN_MPN_Info('MaximSupplierStatus1')
        objCreateJPCN.Uploadvalidation()
        objJPCNStatusOverview.ClickContextCE_Create_Items()
        objJPCNStatusOverview.SelectJCPN(strJPNID)
        objCreateJPCN.MultipleCoreCE_Selection(strJPNID)

    @pytest.mark.regression
    @pytest.mark.P1
    @pytest.mark.dependency()
    # @pytest.mark.dependency(depends=["Test_PCN::test_TC019_PCN_CompletedCoreCE_Assessment"])
    def test_TC022_PCN_ContextCE_ClosureAssessment_EOL(self, setup, TestData):
        [strJPNID, datelist
         ] = self.test_TC020_PCN_ContextCE_ClosureAssessment(setup, TestData)
        return strJPNID, datelist
示例#9
0
class InitilaAssessment_Page():
    global objCommon, objActions, objConfig, objHome, objFilter
    objCommon = CommonFunctions()
    objActions = PerformActions()
    objConfig = MyConfigFiles()
    objFilter = Filter()
    objHome = Home()

    def InitialAssessment_ContextCE_Details(self, CCER, priorityType, CCERC,
                                            PCNTYPE, ASQNeeded, ASQNComments):
        time.sleep(2)
        objActions.selectDropdown(PCN.ContextCE_Recommendation_SelectBox_name,
                                  "name", "visibletext", CCER)
        time.sleep(2)
        objActions.enterText(PCN.ContextCE_RecommendationComments_WebEdit_name,
                             "name", CCERC)
        objActions.selectDropdown(PCN.Priority_Type_selectBox_name, "name",
                                  "visibletext", priorityType)
        time.sleep(2)
        if PCNTYPE == 'EOL':
            time.sleep(2)
            objActions.selectDropdown(
                PCN.IA_Alternative_SourceQN_SelectBox_name, "name",
                "visibletext", ASQNeeded)
            time.sleep(2)
            objActions.enterText(
                PCN.IA_FFF_Alternative_SourceComments_WedEdit_name, "name",
                ASQNComments)
        #    assert PCNTYPE == 'EOL'
        # else:
        #     print("PCNType is not EOL"+PCNTYPE)

    def InitialAssessment_AddNewRecord(self, PR, Deviation, DeviationStatus,
                                       Seventeneleveen, JPN, MPN, HTR, MCOECO,
                                       QPET, Comments, JuniperAssembly):
        objActions.clickElement(PCN.IA_AddNewRecord_WebElement_xpath, "xpath")
        time.sleep(2)
        objActions.enterText(PCN.AddNewRecord_PR_WebEdit_name, "name", PR)
        objActions.enterText(PCN.AddNewReocrd_Deviation_WebEdit_name, "name",
                             Deviation)
        objActions.selectDropdown(
            PCN.AddNewRecord_DeviationStatus_selectBox_name, "name",
            "visibletext", DeviationStatus)
        time.sleep(3)
        objActions.enterText(PCN.AddNewRecord_710_711_WebEdit_name, "name",
                             Seventeneleveen)
        objActions.enterText(PCN.AddNewRecord_JPN_WebEdit_name, "name", JPN)
        objActions.enterText(PCN.AddNewRecord_MPN_WebEdit_name, "name", MPN)
        objActions.enterText(PCN.AddNewRecord_HTR_WebEdit_name, "name", HTR)
        time.sleep(2)
        objActions.enterText(PCN.AddNewRecord_ECOMCO_WebEdit_name, "name",
                             MCOECO)
        # objActions.enterText(PCN.AddNewRecord_ECOMCO_Status_WebEdit_name, "name", MCOECOStatus)
        objActions.enterText(PCN.AddNewRecord_qpet_WebEdit_name, "name", QPET)
        time.sleep(2)
        objActions.enterText(PCN.AddNewRecord_Comment_WebEdit_name, "name",
                             Comments)
        objActions.enterText(PCN.AddNewRecord_JA_WebEdit_name, "name",
                             JuniperAssembly)
        time.sleep(3)
        objActions.clickElement(PCN.AddNewAttachement_SubmitBtn_xpath, "xpath")

    def QualDataReview_Attachement(self, strFilePath, QualReportStatus,
                                   QualReportComments):
        time.sleep(2)
        objCommon.AttachFile(strFilePath, PCN.QualDataReview_Attachement_xpath,
                             "xpath")
        objActions.clickElement(PCN.QualDataReview_Upload_xpath, "xpath")
        time.sleep(3)
        objActions.selectDropdown(PCN.QualReport_AcceptStaus_name, "name",
                                  "visibletext", QualReportStatus)
        time.sleep(3)
        objActions.enterText(PCN.QualReport_ReviewComments_name, "name",
                             QualReportComments)
        time.sleep(2)

    def Complete_Assessment(self):
        time.sleep(2)
        objActions.clickElement(PCN.Complete_Assessment_Button_xpath, "xpath")
        time.sleep(2)

    def Submit_OnWarringWindow(self):
        time.sleep(2)
        objActions.clickElement(PCN.submit_button_xpath, "xpath")
        time.sleep(2)

    def InitialAssessment_Checking_AutoPopulationOfPCNCompliance(
            self, PCNTYPE, intEFRCDiff, intBRDiff, intSBDiff, ReasonforNC):
        time.sleep(2)
        objActions.ValidationOnSelectedtext(
            PCN.IA_PCNCompliance_SelectBox_name, "name")
        if (PCNTYPE == ('Process Change' or 'Design Change')):
            strPCNComplience = objActions.ValidationOnSelectedtext(
                PCN.IA_PCNCompliance_SelectBox_name, "name")
            if intEFRCDiff >= 90:
                if strPCNComplience == "Compliant":
                    print(
                        "Where:" + PCNTYPE +
                        "and Effective and Received date >=90 then PCN Compliance is Autopopulates to :"
                        " " + strPCNComplience)
                    objCommon.capture_screenshot(
                        "PCN Compliance as: Compliant ")
                else:
                    print("PCNComplience dropdown displaying as :"
                          " " + strPCNComplience + "insted of : Compliant")
                    assert strPCNComplience == "Compliant"
            elif intEFRCDiff < 90:
                if strPCNComplience == "Non-Compliant":
                    time.sleep(2)
                    objActions.selectDropdown(
                        PCN.Reasonfor_NonCompliance_SelectBox_name, "name",
                        "visibletext", ReasonforNC)
                    time.sleep(2)
                    print(
                        "Where:" + PCNTYPE +
                        "and Effective and Received date < 90 then PCN Compliance is Autopopulates to :"
                        " " + strPCNComplience)
                    objCommon.capture_screenshot(
                        "PCN Compliance as: Non-Compliant ")
                else:
                    print("PCNComplience dropdown displaying as :"
                          " " + strPCNComplience + "insted of: Non-Compliant ")
                    assert strPCNComplience == "Non-Compliant"
        elif PCNTYPE == 'EOL':
            strPCNComplience = objActions.ValidationOnSelectedtext(
                PCN.IA_PCNCompliance_SelectBox_name, "name")
            if intBRDiff >= 180:
                if strPCNComplience == "Compliant":
                    print(
                        "Where:" + PCNTYPE +
                        "and Effective and Received date >=180 then PCN Compliance is Autopopulates to :"
                        " " + strPCNComplience)
                    objCommon.capture_screenshot(
                        "PCN Compliance as: Compliant ")
                else:
                    print("PCNComplience dropdown displaying as :"
                          " " + strPCNComplience + "insted of : Compliant")
                    assert strPCNComplience == "Compliant"
            elif intBRDiff < 180:
                if strPCNComplience == "Non-Compliant":
                    time.sleep(2)
                    objActions.selectDropdown(
                        PCN.Reasonfor_NonCompliance_SelectBox_name, "name",
                        "visibletext", ReasonforNC)
                    time.sleep(2)
                    print(
                        "Where:" + PCNTYPE +
                        "and Effective and Received date < 180 then PCN Compliance is Autopopulates to :"
                        " " + strPCNComplience)
                    objCommon.capture_screenshot(
                        "PCN Compliance as: Non-Compliant ")
                else:
                    print("PCNComplience dropdown displaying as :"
                          " " + strPCNComplience + "insted of: Non-Compliant ")
                    assert strPCNComplience == "Non-Compliant"
            elif intSBDiff >= 180:
                if strPCNComplience == "Compliant":
                    print(
                        "Where:" + PCNTYPE +
                        "and Effective and Received date >=180 then PCN Compliance is Autopopulates to :"
                        " " + strPCNComplience)
                    objCommon.capture_screenshot(
                        "PCN Compliance as: Compliant ")
                else:
                    print("PCNComplience dropdown displaying as :"
                          " " + strPCNComplience + "insted of : Compliant")
                    assert strPCNComplience == "Compliant"
            elif intSBDiff < 180:
                if strPCNComplience == "Non-Compliant":
                    time.sleep(2)
                    objActions.selectDropdown(
                        PCN.Reasonfor_NonCompliance_SelectBox_name, "name",
                        "visibletext", ReasonforNC)
                    time.sleep(2)
                    print(
                        "Where:" + PCNTYPE +
                        "and Effective and Received date < 180 then PCN Compliance is Autopopulates to :"
                        " " + strPCNComplience)
                    objCommon.capture_screenshot(
                        "PCN Compliance as: Non-Compliant ")
                else:
                    print("PCNComplience dropdown displaying as :"
                          " " + strPCNComplience + "insted of: Non-Compliant ")
                    assert strPCNComplience == "Non-Compliant"
        else:
            print(
                "Failed: PCN Compliance not displaying Expected values  and  conditions are not satisfied"
            )
            objCommon.capture_screenshot("No Such element found")
示例#10
0
class createJPCN_Page():
    global objCommon, objActions, objConfig,objHome,objFilter,objSearch
    objCommon = CommonFunctions()
    objActions = PerformActions()
    objConfig=MyConfigFiles()
    objFilter=Filter()
    objHome=Home()


    def PCNIssue_DateSelection(self):
        time.sleep(2)
        objActions.clickElement(PCN.PCNIssue_Date_WebEdit_xpath, "xpath")
        intDay = objCommon.GetCurrentDay()
        strConcDate = "day-" + str(intDay)
        objActions.clickElement("//div[@aria-label='" + strConcDate + "']", "xpath")


    def PCNReceived_DateSelection(self):
        time.sleep(2)
        objActions.clickElement(PCN.PCNReceived_Date_WebEdit_xapth, "xpath")
        time.sleep(3)
        today = datetime.datetime.now(timezone('US/Pacific'))
        strReceivedDate = today.strftime("%d-%b-%Y")
        objActions.enterText(PCN.PCNReceived_Date_WebEdit_xapth, "xpath", strReceivedDate)
        date1 = datetime.datetime.strptime(strReceivedDate, "%d-%b-%Y")
        return date1

    def PCNEffective_DateSelection(self,PCN_EffDays):
        time.sleep(2)
        objActions.clickElement(PCN.PCNEffective_date_WebEdit_xpath, "xpath")
        time.sleep(3)
        UScurrent_date = datetime.datetime.now(timezone('US/Pacific'))
        UScurrent_date += datetime.timedelta(days=int(PCN_EffDays))
        strEffDate = UScurrent_date.strftime("%d-%b-%Y")
        objActions.enterText(PCN.PCNEffective_date_WebEdit_xpath, "xpath", strEffDate)
        date2 = datetime.datetime.strptime(strEffDate, "%d-%b-%Y")
        return date2


    def PCNLastTImeBuy_DateSelection(self,LT_BuyDays):
        time.sleep(2)
        objActions.clickElement(PCN.PCNLastTime_BuyDate_WebEdit_xpath, "xpath")
        time.sleep(3)
        UScurrent_date = datetime.datetime.now(timezone('US/Pacific'))
        UScurrent_date += datetime.timedelta(days=int(LT_BuyDays))
        strLasttimeBuyDate = UScurrent_date.strftime("%d-%b-%Y")
        objActions.enterText(PCN.PCNLastTime_BuyDate_WebEdit_xpath, "xpath", strLasttimeBuyDate)
        LBdate = datetime.datetime.strptime(strLasttimeBuyDate, "%d-%b-%Y")
        return LBdate

    def PCNLastTImeShip_DateSelection(self,LT_ShipDays):
        time.sleep(2)
        objActions.clickElement(PCN.PCNLastTime_ShipDate_WebEdit_xpath, "xpath")
        time.sleep(2)
        UScurrent_date = datetime.datetime.now(timezone('US/Pacific'))
        UScurrent_date += datetime.timedelta(days=int(LT_ShipDays))
        strLasttimeship = UScurrent_date.strftime("%d-%b-%Y")
        objActions.enterText(PCN.PCNLastTime_ShipDate_WebEdit_xpath, "xpath", strLasttimeship)
        LShipdate = datetime.datetime.strptime(strLasttimeship, "%d-%b-%Y")
        return LShipdate

    def CreateJPCN(self,SupplierName,SupplierPCN):
        objActions.clickElement(PCN.CreateJPCN_link_xpath, "xpath")
        print("Initiated Create JPCN Page and to fill Supplier info section")
        objActions.enterText(PCN.Suppliername_WebEdit_name, "name", SupplierName)
        time.sleep(2)
        objActions.clickElement("//div[text()='" + SupplierName + "']", "xpath")
        time.sleep(1)
        objActions.enterText(PCN.SupplierPCN_WebEdit_name, "name", SupplierPCN)
        time.sleep(2)
        strSC=objActions.getAttributeValue(PCN.SupplierContact_WebEdit_name, "name", "value")
        strSCE=objActions.getAttributeValue(PCN.SupplierContactEmail_WebEdit_name, "name", "value")
        strSP=objActions.getAttributeValue(PCN.SupplierPhone_WebEdit_name, "name", "value")
        strEC=objActions.getAttributeValue(PCN.SupplierEscalation_WebEdit_name, "name", "value")
        strECE=objActions.getAttributeValue(PCN.SupplierEscalationEmail_WebEdit_name, "name", "value")
        time.sleep(2)
        Supplier_allData=[SupplierName: '',SupplierPCN,strSC,strSCE,strSP,strEC,strECE]
        html = MyConfigFiles.driver.find_element_by_tag_name('html')
        html.send_keys(Keys.DOWN)
        # objActions.Page_Scroll_Actions("pcnReceivedDt", "name")
        print("sucessfully Filled the Supplier info section ")
        time.sleep(3)
        return Supplier_allData


    def PCN_DateSelections(self,PCN_EffDays, SelectPCNType, LT_BuyDays, LT_ShipDays):
        datelist = {}
        global intEFRCDiff,intBRDiff,intSBDiff
        print("Initiated to fill the  PCN/PDN INFO section")
        ReceivedDate=self.PCNReceived_DateSelection()
        time.sleep(2)
        EffectiveDate=self.PCNEffective_DateSelection(PCN_EffDays)
        time.sleep(2)
        self.PCNIssue_DateSelection()
        time.sleep(2)
        intEFRCDiff = int((EffectiveDate - ReceivedDate).days)
        print(intEFRCDiff)
        datelist['intEFRCDiff']=intEFRCDiff
        time.sleep(2)
        AllDate_ERdata = [ReceivedDate, EffectiveDate]
        if SelectPCNType == "EOL":
            objActions.selectDropdown(PCN.PCNType_Selectbox_name, "name", "visibletext", SelectPCNType)
            time.sleep(2)
            LTBuyDate = self.PCNLastTImeBuy_DateSelection(LT_BuyDays)
            time.sleep(2)
            LTShipDate = self.PCNLastTImeShip_DateSelection(LT_ShipDays)
            time.sleep(3)
            intBRDiff = int((LTBuyDate - ReceivedDate).days)
            time.sleep(2)
            print(intBRDiff)
            intSBDiff = int((LTShipDate - LTBuyDate).days)
            print(intSBDiff)
            datelist['intBRDiff']= intBRDiff
            datelist['intSBDiff']= intSBDiff
            time.sleep(5)
            html = MyConfigFiles.driver.find_element_by_tag_name('html')
            html.send_keys(Keys.TAB)
            time.sleep(7)
            AllDate_BSdata = [LTBuyDate, LTShipDate]
            return AllDate_BSdata
        else:
            objActions.selectDropdown(PCN.PCNType_Selectbox_name, "name", "visibletext", SelectPCNType)
        return datelist,SelectPCNType,AllDate_ERdata



    def PDNinfo_form(self,PCNSource,DescriptionChange,Natureofchange,Typeofchange,PendingConcernsComments):
        time.sleep(3)
        strPCNSource=objActions.selectDropdown(PCN.PCNSource_Selectbox_name, "name", "visibletext", PCNSource)
        time.sleep(3)
        strDC=objActions.enterText(PCN.Descriptionchange_WebEdit_name, "name" , DescriptionChange)
        time.sleep(3)
        strNC=objActions.selectDropdown(PCN.NatureofChange_Selectbox_name, "name", "visibletext", Natureofchange)
        time.sleep(3)
        strTC=objActions.selectDropdown(PCN.Typeofchange_Selectbox_xpath, "xpath", "visibletext", Typeofchange)
        time.sleep(3)
        objActions.clickElement(PCN.Add_Button_xpath, "xpath")
        time.sleep(3)
        print("sucessfully Filled the PCN/PDN INFO section")
        time.sleep(3)
        strPCC=objActions.enterText(PCN.OpenConcerns_Comments_WebEdit_name, "name", PendingConcernsComments)
        time.sleep(2)
        PCNPDN_allData=[strPCNSource,strDC,strNC,strTC,strPCC]
        objActions.clickElement(PCN.submit_button_xpath, "xpath")
        strJPCNID = objActions.getText(PCN.Jnpr_PCNID_xpath, "xpath")
        print("PCN/PDN & Supplier details are saved and PCN ID Created Successfully:" + strJPCNID)
        objCommon.capture_screenshot('Enter JPN-MPN details page.')
        return strJPCNID


    def Validate_CCE_PrePoulated_Values(self):
        objActions.getText(PCN.Verify_Context_CE_sections_xpath, "xpath")
        assert (objActions.AssertObjectExists(PCN.Verify_Context_CE_sections_xpath, "xpath"))
        time.sleep(1)
        strCCER_Act = objActions.ValidationOnSelectedtext(PCN.Validate_ContextCeRecommend_Value_name, "name")
        strCCER_Exp="No Action Needed"
        if strCCER_Act==strCCER_Act:
            print("Passed- Context CE Recommend Value is  " + strCCER_Act)
        else:
            print("Failed- Context CE Recommend Value is " + strCCER_Act +  "instead of"  + strCCER_Exp)
        assert strCCER_Act == strCCER_Act
        time.sleep(2)
        strPCNStatus_Act = objActions.ValidationOnSelectedtext(PCN.Validate_PCNStatus_Value_name, "name")
        strPCNStatus_Exp = "Closed - No Usage at Juniper"
        if strPCNStatus_Act==strPCNStatus_Act:
            print("Passed- PCN Status is  " + strPCNStatus_Act)
        else:
            print("Failed- PCN Status is " + strPCNStatus_Act +  "instead of"  + strPCNStatus_Exp)
        assert strPCNStatus_Act == strPCNStatus_Act
        time.sleep(2)
        strPCNStatusComm_Act = objActions.getText(PCN.Validate_PCNStatusComment_Value_name, "name")
        strPCNStatusComm_Exp = "MPNs included in this PCN are not in use at Juniper. Thus JPCN created at Juniper for records and closed as No Action Needed."
        if strPCNStatusComm_Act==strPCNStatusComm_Act:
            print("Passed- PCN Status comments is  " + strPCNStatusComm_Act)
        else:
            print("Failed- PCN Status comments is "  + strPCNStatusComm_Act +  "instead of" + strPCNStatusComm_Exp)
        assert strPCNStatusComm_Act == strPCNStatusComm_Act
        time.sleep(2)
        strResponsibleCE_Act = objActions.ValidationOnSelectedtext(PCN.Validate_ResponsibleCE_Value_name, "name")
        strResponsibleCEUN = objActions.getText(PCN.Login_Username_WebElement_xpath, "xpath")
        s= strResponsibleCEUN.split(",")[1]
        strResponsibleCE_Exp=s.strip()
        print(strResponsibleCE_Exp)
        if strResponsibleCE_Act==strResponsibleCE_Exp:
            print("Passed- Respobible CE is  " +  strResponsibleCE_Act)
        else:
            print("Failed- Respobible CE is " +  strResponsibleCE_Act +  "instead of" +  strResponsibleCE_Exp)
        assert strResponsibleCE_Act == strResponsibleCE_Exp
        time.sleep(2)
        strPCNCompliance_Act = objActions.ValidationOnSelectedtext(PCN.Validate_PCNCompliance_Value_name, "name")
        strPCNCompliance_Exp = "Not-Applicable"
        if strPCNCompliance_Act == strPCNCompliance_Exp:
            print("Passed- PCN Compliance is  " + strPCNCompliance_Act)
        else:
            print("Failed- PCN Compliance is " + strPCNCompliance_Act + "instead of" + strPCNCompliance_Exp)
        assert strPCNCompliance_Act == strPCNCompliance_Exp
        time.sleep(3)

    def ClosethisPCN(self,PCNStatus_Closed):
         objActions.selectDropdown(PCN.Validate_PCNStatus_Value_name, "name", "visibletext", PCNStatus_Closed)
         time.sleep(2)
         objActions.clickElement(PCN.Close_ThisPCN_Button_xpath, "xpath")
         print("PCN Closed sucessfully")

    def Validate_InvalidPCN_Status(self,PCNStatus):
        objActions.selectDropdown(PCN.Validate_PCNStatus_Value_name, "name", "visibletext", PCNStatus)
        time.sleep(2)
        objActions.clickElement(PCN.Close_ThisPCN_Button_xpath, "xpath")
        time.sleep(2)
        strIPCNS_Act=objActions.getText(PCN.Validation_msg_WebElement_xpath, "xpath")
        time.sleep(2)
        strIPCNS_Exp="Invalid PCN Status"
        if strIPCNS_Act==strIPCNS_Exp:
            print("Passed - Validation Message is dispalying as::"  " "+strIPCNS_Act)
        else:
            print("Failed -NO validation message is displayed")
        assert strIPCNS_Act == strIPCNS_Exp


    def Uploadvalidation(self):
        strAcknowMsg=objActions.getText(PCN.Acknowledgement_Notification_msg_xapth, "xpath")
        print("Acknowledgement Notification Message is :" +strAcknowMsg)
        assert (objActions.AssertObjectExists(PCN.Acknowledgement_Notification_msg_xapth, "xpath"))
        time.sleep(1)
        objActions.clickElement(PCN.Acknowledgement_Notification_button_xpath, "xpath")
        print("Acknowledgement Notification button: OK button clicked sucessfully")

    def JPN_MPN_Info(self,strFilePath):
        objCommon.AttachFile(strFilePath,PCN.Choosefile_button_name, "name")
        objActions.clickElement(PCN.Upload_button_xpath,"xpath")

    def EOL_Upload_Validations(self,strResponsibleCoreCE):
    #     time.sleep(2)
    #     # objCommon.AttachFile(strFilePath,PCN.EOL_Investigation_button_xpath,"xpath")
    #     # time.sleep(10)
    #     # html = MyConfigFiles.driver.find_element_by_tag_name('html')
    #     # html.send_keys(Keys.PAGE_UP)
    #     # time.sleep(5)
    #     # objActions.clickElement(PCN.EOL_Investigation_Upload_Lnk_xpath, "xpath")
    #     # time.sleep(20)
        strUploadtxt=objActions.getText(PCN.EOL_UPload_WebElement_xpath, "xpath")
        print("Expected linke is dislaying is:" " "+strUploadtxt)
        objActions.AssertObjectExists(PCN.EOL_UPload_WebElement_xpath, "xpath")
        time.sleep(2)
        strDownloadtxt = objActions.getText(PCN.EOL_Download_WebElement_xpath, "xpath")
        print("Expected linke is dislaying is:" " " + strDownloadtxt)
        objActions.AssertObjectExists(PCN.EOL_Download_WebElement_xpath, "xpath")
        time.sleep(2)
        strDeletetxt = objActions.getText(PCN.EOL_Delete_WebElement_xpath, "xpath")
        print("Expected linke is dislaying is:" " " + strDeletetxt)
        objActions.AssertObjectExists(PCN.EOL_Delete_WebElement_xpath, "xpath")
        objCommon.capture_screenshot("EOL file Uploaded sucessfully with all the buttons.")
        time.sleep(2)
        element = MyConfigFiles.driver.find_element_by_xpath("//button[contains(text(),'Save & Continue')]")
        print("Save and Continue button  is  Enabled:",element.is_enabled())
        time.sleep(2)
        objActions.selectDropdown(PCN.JPN_MPN_Responsible_CoreCE_Selectbox_name, "name", "visibletext", strResponsibleCoreCE)
        time.sleep(2)
        print("Save and Continue button is Enabled:" "" , element.is_enabled())
        time.sleep(2)
        objCommon.capture_screenshot("Save and Continue is enabled")


    def JPN_MPN_Info_ValidationCheck(self):
        strNRF_Act=objActions.getText(PCN.Jnpr_UA_Validation_msg_xpath, "xpath")
        strNRF_Exp= "No Record Found!"
        if strNRF_Act==strNRF_Exp:
            print("Passed- MPNs such should not have any impact on agile it is display:" +strNRF_Act)
        else:
            print("Failed- No Error messge is displayed as :" +strNRF_Act)
        assert strNRF_Act==strNRF_Exp

    def Verify_BackButton_Navigation(self):
        time.sleep(2)
        objActions.clickElement(PCN.Back_JPCNPage_button_xpath, "xpath")
        objCommon.capture_screenshot(" Enter PCN details page displyed sucessfully")


    def Edit_EnterPCNDetails_Page(self,SupplierPCN):
        SPCNUpdate="edit"
        time.sleep(2)
        objActions.enterText(PCN.SupplierPCN_WebEdit_name, "name", SPCNUpdate)
        time.sleep(2)
        objActions.clickElement(PCN.submit_button_xpath, "xpath")
        time.sleep(2)
        objActions.clickElement(PCN.Back_JPCNPage_button_xpath, "xpath")
        time.sleep(1)
        strupdated=objActions.getAttributeValue(PCN.SupplierPCN_WebEdit_name, "name", "value")
        print("the values is:"+strupdated)
        if SupplierPCN != strupdated:
            print("Successfully Edited Supplier PCN value:-"," "+strupdated)
        else:
            print("Not Edited the Supplier PCN Value:", " "+strupdated)
        assert SupplierPCN != strupdated
        time.sleep(2)
        objActions.clickElement(PCN.submit_button_xpath, "xpath")
        time.sleep(2)

    def AddNewAttachement_JPNMPN(self,strCategory,strFilePath,Comments):
        objActions.clickElement(PCN.JPN_MPN_AddNew_Attachment_button_xpath, "xpath")
        time.sleep(2)
        objActions.selectDropdown(PCN.AddNewAttachement_Category_Selectbox_xpath, "xpath", "visibletext", strCategory)
        time.sleep(2)
        objCommon.AttachFile(strFilePath, PCN.AddNewAttachement_Choose_file_xapth, "xpath")
        time.sleep(5)
        objActions.enterText(PCN.AddNewAttachement_Comments_xpath, "xpath", Comments)
        objActions.clickElement(PCN.AddNewAttachement_SubmitBtn_xpath, "xpath")
        time.sleep(3)

    def DeleteAttachement(self):
        global flag
        time.sleep(2)
        objTable = MyConfigFiles.driver.find_elements_by_xpath("//table[@id='attachment']/tbody/tr")
        intRowCount = len(objTable)
        flag = False
        for i in range(2, intRowCount + 1):
            stri = str(i)
            objActions.getText("//table[@id='attachment']/tbody/tr[" + stri + "]/td[1]", "xpath")
            time.sleep(2)
            objActions.clickElement("//table[@id='attachment']/tbody/tr[" + stri + "]/td[1]", "xpath")
            time.sleep(2)
            alert_obj = MyConfigFiles.driver.switch_to.alert
            alert_obj.accept()
            time.sleep(2)
            objTable = MyConfigFiles.driver.find_elements_by_xpath("//table[@id='attachment']/tbody/tr")
            intRowCountafterdel = len(objTable)
            if intRowCount != intRowCountafterdel:
                print("Present Row count is :"+str(intRowCountafterdel))
                objCommon.capture_screenshot("Selected Row deleted sucessfully")
                break
            if flag == True:
                 break
            else:
                sys.exit("FAILED:: Row Not delected: " + stri)


    # def EOL_InvistigationFileUpload_fromJPNTable(self,strFilePath):
    #     time.sleep(2)
    #     objTablerow = MyConfigFiles.driver.find_elements_by_xpath("//table[@id='upload-jpn']/tbody/tr")
    #     intRowCount = len(objTablerow)
    #     # print("Rows Count in page  is: " + str(intRowCount - 1))
    #     flag = False
    #     for i in range(1, intRowCount + 1):
    #         stri = str(i)
    #         # print(stri)
    #         objTablecol = MyConfigFiles.driver.find_elements_by_xpath("//table[@id='upload-jpn']/tbody/tr/th")
    #         intColCount = len(objTablecol)
    #         for j in range(i, intColCount + 1):
    #              strj = str(j)
    #         print("Column count is :" + str(intColCount - 1))
    #         strColumheaders = objActions.getText("//table[@id='upload-jpn']//tbody//tr[" + stri + "]//th[" + strj + "]", "xpath")
    #         time.sleep(2)
    #         # print(strColumheaders)
    #         time.sleep(2)
    #         if "EOL" in strColumheaders:
    #             for k in range(i + 1, intRowCount - 1):
    #                 strk = str(k)
    #                 # print(strk)
    #                 strChoosefile = objActions.getText("//table[@id='upload-jpn']/tbody//tr[" + strk + "]//td[" + strj + "]", "xpath")
    #                 print(strChoosefile)
    #                 if strChoosefile == '':
    #                     time.sleep(3)
    #                     objActions.getText("//table[@id='upload-jpn']/tbody//tr[" + strk + "]//td[" + strj + "]//span[1]//input[1]", "xpath")
    #                     time.sleep(3)
    #                     objCommon.AttachFile(strFilePath, "//table[@id='upload-jpn']/tbody//tr[" + strk + "]//td[" + strj + "]//span[1]//input[1]","xpath")
    #                     time.sleep(1)
    #                     objActions.Page_Scroll_Actions("JpnInput", "id")
    #                     time.sleep(3)
    #                     objActions.clickElement("//table[@id='upload-jpn']/tbody//tr[" + strk + "]//td[" + strj + "]//span[1]//p[1]//a[1]", "xpath")
    #                     time.sleep(5)
    #                     flag = True
    #                     print("EOL Form is uploaded sucessfully: ")
    #                     # break
    #         break




    def PreviewScreen_Validations(self,PendingConcernsComments):
        objActions.clickElement(PCN.JPN_MPN_Button_xpath, "xpath")
        time.sleep(2)
        objActions.clickElement(PCN.MultipleCoreCE_POpUp_Button_xpath, "xpath")
        time.sleep(2)
        objCommon.capture_screenshot("Preview screen popup text ")
        time.sleep(2)
        PlaceHolder_Acttext=objActions.getText(PCN.Placeholder_text_WebElement_name, "name")
        # print(PlaceHolder_Acttext)
        if PlaceHolder_Acttext == PendingConcernsComments:
            print("Preview screen will appear with the Pending Info Comments given in the first page as :"+PlaceHolder_Acttext)
            objCommon.capture_screenshot("Preview Screen comments")
            objActions.clickElement(PCN.PreviewScreen_button_xpath, "xpath")
        else:
            print("Failed: Preview screen not displaying comments")
            time.sleep(2)
        assert PlaceHolder_Acttext == PendingConcernsComments


    def MultipleCoreCE_Selection(self,strJPNID):
        objActions.clickElement(PCN.JPN_MPN_Button_xpath, "xpath")
        time.sleep(2)
        objCommon.capture_screenshot("JPCN is having multiple Core CE.")
        objActions.clickElement(PCN.MultipleCoreCE_POpUp_NoButton_xpath, "xpath")
        objCommon.capture_screenshot("How would you like to solve the multiple Core CE issue?.")
        time.sleep(2)
        objActions.clickElement(PCN.MultipleCoreCE_Duplicate_Button_xpath, "xpath")
        objCommon.capture_screenshot("Preview screen popup text ")
        time.sleep(2)
        html = MyConfigFiles.driver.find_element_by_tag_name('html')
        html.send_keys(Keys.PAGE_UP)
        strJPCNDuplicate_Msg= objActions.getText(PCN.MultipleCoreCE_Duplication_Msg_xpath, "xpath")
        objCommon.capture_screenshot("JPCN Duplication is Completed!")
        assert(strJPCNDuplicate_Msg)
        time.sleep(2)
        objActions.clickElement(PCN.Newly_duplicatedJPCN_Link_xpath, "xpath")
        time.sleep(2)
        JPCN_Duplicate=objActions.getText(PCN.Jnpr_PCNID_xpath, "xpath")
        if JPCN_Duplicate != strJPNID:
            print("New Duplicate JPCN id created Sucessfully")

        # PlaceHolder_Acttext=objActions.getText(PCN.Placeholder_text_WebElement_name, "name")
        # # print(PlaceHolder_Acttext)
        # if PlaceHolder_Acttext == PendingConcernsComments:
        #     print("Preview screen will appear with the Pending Info Comments given in the first page as :"+PlaceHolder_Acttext)
        #     objCommon.capture_screenshot("Preview Screen comments")
        #     objActions.clickElement(PCN.PreviewScreen_button_xpath, "xpath")
        # else:
        #     print("Failed: Preview screen not displaying comments")
        #     time.sleep(2)
        # assert PlaceHolder_Acttext == PendingConcernsComments


    # Expand Supplier info sections and Edit the few details.

    def Verify_SupplierInfo_Edit_ProductData_Section(self):
        time.sleep(3)
        objActions.Page_Scroll_Actions("//p[contains(text(),'Supplier Info')]", "xpath")
        time.sleep(3)
        objActions.clickElement(PCN.Expand_SupplierInfo_Button_xpath, "xpath")
        time.sleep(2)
        strGetItems=MyConfigFiles.driver.find_elements_by_xpath("//div[@class='supplier-info-section padding-around show-it']//button[contains(text(),'Edit')]")
        print(len(strGetItems))
        intcount=len(strGetItems)
        if intcount > 0:
            objActions.clickElement(PCN.Expand_SupplierInfo_Edit_Button_xpath, "xpath")
            time.sleep(2)
            objActions.enterText(PCN.SampleOwner_Contact_WebEdit_name, "name", "automation")
            time.sleep(2)
            objActions.clickElement(PCN.Expand_SupplierInfo_Save_Button_xpath, "xpath")
            objCommon.capture_screenshot("Supplier info sections edited sucessfully with sample Owner Conatct:")
            time.sleep(2)
            objActions.clickElement(PCN.Expand_SupplierInfo_Button_xpath, "xpath")
        else:
            objActions.clickElement(PCN.Expand_SupplierInfo_Button_xpath, "xpath")
            print("Edit button not  displyed in the Supplier info secession and all the fields are read only ")




    # Compare SupplierInfo data from first page and verify productData page

    def Compare_Supplierinfodata_in_verifyproductsection(self,SupplierName,strupdated,strSC,strSCE,strSP,strEC,strECE):
        time.sleep(3)
        objActions.Page_Scroll_Actions("//p[contains(text(),'Supplier Info')]", "xpath")
        time.sleep(3)
        objActions.clickElement(PCN.Expand_SupplierInfo_Button_xpath, "xpath")
        time.sleep(2)
        strSN=objActions.getAttributeValue(PCN.Suppliername_WebEdit_name, "name", "value")
        if SupplierName == strSN:
           print("Passed: SupplierName from the fistpage and VerifyProduct page are same :"  " " +strSN)
        else:
            print("Failed: SupplierName displaying as:" +strSN+ "insted of:"  +SupplierName)
        assert SupplierName == strSN
        time.sleep(2)
        # strPCN = objActions.getAttributeValue(PCN.SupplierPCN_WebEdit_name, "name", "value")
        # if strupdated == strPCN:
        #     print("Passed: SupplierPCN from the fistpage and VerifyProduct page are same :"  " " +strPCN)
        # else:
        #     print("Failed: SupplierPCN displaying as:" +strPCN + "insted of:" +strupdated)
        # assert strupdated == strPCN
        time.sleep(2)
        strSC_VPD=objActions.getAttributeValue(PCN.SupplierContact_WebEdit_name, "name", "value")
        if strSC == strSC_VPD:
            print("Passed: SupplierContact from the fistpage and VerifyProduct page are same :"  " " +strSC_VPD)
        else:
            print("Failed: SupplierContact displaying as:" +strSC_VPD + "insted of:" +strSC)
        assert strSC== strSC_VPD
        time.sleep(2)
        strSCE_VPD = objActions.getAttributeValue(PCN.SupplierContactEmail_WebEdit_name, "name", "value")
        if strSCE == strSCE_VPD:
            if strSC == strSC_VPD:
                print("Passed: SupplierContactEmail from the fistpage and VerifyProduct page are same :"  " " +strSCE_VPD)
        else:
                print("Failed: SupplierContactEmail displaying as:" +strSCE_VPD+ "insted of:" +strSCE)
        assert strSCE == strSCE_VPD
        time.sleep(2)
        strSP_VPD = objActions.getAttributeValue(PCN.SupplierPhone_WebEdit_name, "name", "value")
        if  strSP ==  strSP_VPD:
            print("Passed: SupplierPhone from the fistpage and VerifyProduct page are same :"  " " +strSP_VPD)
        else:
            print("Failed: Supplier phone displaying as:" +strSP_VPD+ "insted of:" +strSP)
        assert strSP == strSP_VPD
        time.sleep(2)
        strEC_VPD = objActions.getAttributeValue(PCN.SupplierEscalation_WebEdit_name, "name", "value")
        if strEC == strEC_VPD:
            print("Passed: SupplierEC from the fistpage and VerifyProduct page are same :"  " "  +strEC_VPD)
        else:
            print("Failed: SupplierEC displaying as:" +strEC_VPD+ "insted of:" +strEC)
        assert strEC == strEC_VPD
        time.sleep(2)
        strECE_VPD = objActions.getAttributeValue(PCN.SupplierEscalationEmail_WebEdit_name, "name", "value")
        if strECE == strECE_VPD:
            print("Passed: SupplierECEmail from the fistpage and VerifyProduct page are same :"  " "  +strECE_VPD)
        else:
            print("Failed: SupplierECEmail displaying as" +strECE_VPD+ "insted of:" +strECE)
        assert strECE == strECE_VPD
        time.sleep(2)



    def Verify__PCN_PDNinfo_Edit_ProductData_Section(self,DescriptionChange):
        time.sleep(3)
        objActions.clickElement(PCN.Expand_PCN_PDNinfo_Button_xpath, "xpath")
        time.sleep(2)
        strGetItems = MyConfigFiles.driver.find_elements_by_xpath("//div[@class='PCN-PDN-info-section padding-around show-it']//button[contains(text(),'Edit')]")
        print(len(strGetItems))
        intcount = len(strGetItems)
        if intcount > 0:
            objActions.clickElement(PCN.Expand_PCN_PDNInfo_Edit_Button_xpath, "xpath")
            AppendValue= "Edited"
            objActions.enterText(PCN.Descriptionchange_WebEdit_name, "name" , AppendValue)
            time.sleep(2)
            html = MyConfigFiles.driver.find_element_by_tag_name('html')
            html.send_keys(Keys.PAGE_UP)
            time.sleep(3)
            objActions.clickElement(PCN.Expand_PCN_PDNInfo_Save_Button_xpath, "xpath")
            time.sleep(2)
            Act_DescChange = objActions.getAttributeValue(PCN.Descriptionchange_WebEdit_name, "name", "value")
            if DescriptionChange != Act_DescChange:
                print("Successfully Edited Description Change  value:", " " + Act_DescChange)
            else:
                print("Failed: Description values displaying:" +DescriptionChange+ "Insted of ", " " + Act_DescChange)
            assert DescriptionChange != Act_DescChange
            time.sleep(2)
            objActions.clickElement(PCN.Expand_PCN_PDNinfo_Button_xpath, "xpath")
        else:
            objActions.clickElement(PCN.Expand_PCN_PDNinfo_Button_xpath, "xpath")
            print("Edit button not displyed in the PDN_PCN info secession and all the fields are read only")



    def WhereUserAnalysis(self,PCNTYPE,strCategory,strFilePath,Comments):
        if PCNTYPE == "EOL":
            objActions.clickElement(PCN.submit_button_xpath, "xpath")
            time.sleep(2)
            UserAnalysis_Required = objActions.getText(PCN.Validation_Msg_UserAanlysis_xpath, "xpath")
            print("Where Use Analysis is Mandatory to click and otherwise validation message is:" +UserAnalysis_Required)
            time.sleep(2)
            objActions.clickElement(PCN.Where_UserAnalysis_button_xapth, "xpath")
            objCommon.capture_screenshot("Where User analysis clicked sucessfully")
            objActions.clickElement(PCN.Completed_Page_OK_button_xpath, "xpath")
            time.sleep(2)
            objActions.clickElement(PCN.Back_JPCNPage_button_xpath, "xpath")
            objCommon.capture_screenshot("Page navigates to Enter JPN-MPN Deatils page")
            time.sleep(2)
            self.AddNewAttachement_JPNMPN(strCategory,strFilePath,Comments)
            time.sleep(3)
            objActions.clickElement(PCN.JPN_MPN_Button_xpath, "xpath")
            objCommon.capture_screenshot("Page navigates to Verify produce  page")
            objActions.clickElement(PCN.submit_button_xpath, "xpath")
            time.sleep(2)
            PCN_CompletedMsg = objActions.getText(PCN.Validation_Msg_PCNCreations_xpath, "xpath")
            print(PCN_CompletedMsg)
            objCommon.capture_screenshot("New PCN Create sucessfully")
            objActions.clickElement(PCN.Completed_Page_OK_button_xpath, "xpath")
            objCommon.capture_screenshot("Sucessfully navigate to the JPCN Status Overview page")
        else:
            objActions.clickElement(PCN.submit_button_xpath, "xpath")
            time.sleep(2)
            PCN_CompletedMsg = objActions.getText(PCN.Validation_Msg_PCNCreations_xpath, "xpath")
            print(PCN_CompletedMsg)
            objCommon.capture_screenshot("New PCN Create sucessfully")
            objActions.clickElement(PCN.Completed_Page_OK_button_xpath, "xpath")
            time.sleep(2)
            objCommon.capture_screenshot("Sucessfully navigate to the JPCN Status Overview page")


# Count the highest occurrence of core CE names

    def GetCoreCENames(self):
        objTablerow = MyConfigFiles.driver.find_elements_by_xpath("//table[@id='upload-jpn']/tbody/tr")
        intRowCount = len(objTablerow)
        print(intRowCount)
        strCoreCEList1 = []
        for strCoreCEList in MyConfigFiles.driver.find_elements_by_xpath("//table[@id='upload-jpn']/tbody/tr/td[14]"):
            strCoreCEList1.append(strCoreCEList.text)
            print(strCoreCEList.text)
            print(strCoreCEList1)
            CoreCESet = set(strCoreCEList1)
            CoreCEList = list(CoreCESet)
            print(CoreCEList)
            CoreCENames = len(CoreCEList)
            print(CoreCENames)
            CoreCount = 0
            for x in CoreCEList:
                CoreCount1 = CoreCount
                CoreCount=0
                # CoreCount = strCoreCEList1.count(x)
                # print(CoreCount)
                if CoreCount > CoreCount1:
                    CoreCount1 = CoreCount
                    print(x)

    # def Page_Scroll_Actions(self,element):
    #     actions = ActionChains(MyConfigFiles.driver)
    #     element = MyConfigFiles.driver.find_element_by_name('name')
    #     actions.move_to_element(element)
    #     actions.perform()

    def DeleteAttachement_PRrows(self):
        global flag
        time.sleep(4)
        objTable = MyConfigFiles.driver.find_elements_by_xpath("//div[@id='Core-Ce-Details']//table[@id='pr']/tbody/tr")
        intRowCount = len(objTable)
        flag = False
        for i in range(2, intRowCount + 1):
            stri = str(i)
            objActions.getText("//div[@id='Core-Ce-Details']//table[@id='pr']/tbody/tr[" + stri + "]/td[1]", "xpath")
            time.sleep(2)
            objActions.clickElement("//div[@id='Core-Ce-Details']//table[@id='pr']/tbody/tr[" + stri + "]/td[1]", "xpath")
            time.sleep(2)
            alert_obj = MyConfigFiles.driver.switch_to.alert
            alert_obj.accept()
            time.sleep(2)
            objTable = MyConfigFiles.driver.find_elements_by_xpath("//div[@id='Core-Ce-Details']//table[@id='pr']/tbody/tr")
            intRowCountafterdel = len(objTable)
            if intRowCount != intRowCountafterdel:
                print("Present Row count is :"+str(intRowCountafterdel))
                objCommon.capture_screenshot("Selected Row deleted sucessfully")
                break
            if flag == True:
                 break
            else:
                sys.exit("FAILED:: Row Not delected: " + stri)



    def ClickOnJPN_MPN_Exapnd(self):
        time.sleep(4)
        objActions.clickElement(PCN.Expand_JPN_MPN_Button_xpath, "xpath")
        time.sleep(4)



#***********************************************************************************************************
    def EOL_InvistigationFileUpload_fromJPNTable1(self, strFilePath):
        global flag
        time.sleep(2)
        strPages = objActions.getText(PCN.ContextCE_TablePage_Count_xpath, "xpath")
        strPagesCount = strPages.split(" ")
        intPagesCount = int(strPagesCount[4])
        if intPagesCount <= 1:
            time.sleep(30)
        flag = False
        for pages in range(1, intPagesCount + 1):
            objTable = MyConfigFiles.driver.find_elements_by_xpath("//table[@id='upload-jpn']/tbody/tr")
            intRowCount = len(objTable)
            for i in range(2, intRowCount + 1):
                stri = str(i)
                objTablecol = MyConfigFiles.driver.find_elements_by_xpath("//table[@id='upload-jpn']/tbody/tr/th")
                intColCount = len(objTablecol)
                for j in range(i, intColCount + 1):
                    strj = str(j)
                    strchoosefile = objActions.getText("//table[@id='upload-jpn']/tbody/tr[" + stri + "]/td[" + strj + "]", "xpath")
                    if strchoosefile == "Upload":
                        time.sleep(2)
                        objActions.getText("//table[@id='upload-jpn']/tbody//tr[" + stri + "]//td[" + strj + "]//span[1]//input[1]", "xpath")
                        time.sleep(3)
                        objCommon.AttachFile(strFilePath, "//table[ @ id = 'upload-jpn']/ tbody// tr[" + stri + "]//td[" + strj + "]// span[1]// input[1]", "xpath")
                        time.sleep(1)
                        objActions.Page_Scroll_Actions("JpnInput", "id")
                        time.sleep(3)
                        objActions.clickElement("//table[@id='upload-jpn']/tbody//tr[" + stri + "]//td[" + strj + "]//span[1]//p[1]//a[1]", "xpath")
                        time.sleep(5)
                        flag = True
                        print("EOL file Upload sucessfully and file name is: "+strFilePath)
                        break
                        time.sleep(10)
                if flag == True:
                    break
        if flag == False:
                sys.exit("FAILED:: Could not find the Upload Choose file option: " + strFilePath)


    def get_all_data(self):
        # get number of rows
        noOfRows = len(MyConfigFiles.driver.find_elements_by_xpath("//table[@class='font-size-regular']/tbody/tr"))
        print(noOfRows)
        # get number of columns
        noOfColumns = len(MyConfigFiles.driver.find_elements_by_xpath("//table[@class='font-size-regular']/tbody/tr/td"))
        print(noOfColumns)
        allData = []
        print(allData)
        # iterate over the rows, to ignore the headers we have started the i with '1'
        for i in range(1, noOfRows):
            # reset the row data every time
            ro = []
            # iterate over columns
            for j in range(i, noOfColumns):
                # get text from the i th row and j th column
                ro.append(objActions.getText("//table[@class='font-size-regular']/tbody/tr[" + str(i) + "]/td[" + str(j) + "]", "xpath"))
                # ro.append(MyConfigFiles.driver.find_elements_by_xpath("//table[@class='font-size-regular']/tbody/tr[" + str(i) + "]/td[" + str(j) + "]")
            # add the row data to allData of the self.table
            allData.append(ro)
        return allData
示例#11
0
def TestData():
    global objDic
    objData = CommonFunctions()
    objDic = objData.readExcelData()
    return objDic
示例#12
0
from QA.Utilities.CommonLib import CommonFunctions
from QA.Base.Config import MyConfigFiles
import pytest
import requests
from QA.Utilities.PerformAction import PerformActions
import shutil
import os
import time
import inspect



global objCommonLib
objCommonLib=CommonFunctions()

@pytest.mark.hookwrapper
def pytest_runtest_makereport(item):
    """
    Extends the PyTest Plugin to take and embed screenshot in html report, whenever test executes.
    :param item:
    """
    global itr
    pytest_html = item.config.pluginmanager.getplugin('html')
    outcome = yield
    report = outcome.get_result()
    extra = getattr(report, 'extra', [])
    report.description = str(item.function.__doc__)
    report.function = item.function.__doc__
    report_directory = os.path.dirname(item.config.option.htmlpath)

    if report.when == 'call' or report.when == "setup":
示例#13
0
class Search_Page():
    global objCommon, objActions, objConfig, objFilter, objHome, objCreateJPCN
    objCommon = CommonFunctions()
    objActions = PerformActions()
    objConfig = MyConfigFiles()
    objFilter = Filter()
    objHome = Home()
    objCreateJPCN = createJPCN_Page()

    def Search_For_ClosedPCN_And_ClickEditIcon(self):
        strPages = objActions.getText(PCN.Search_TablePage_Count_xpath,
                                      "xpath")
        strPagesCount = strPages.split(" ")
        PageCount = int(strPagesCount[4])
        # GetPagesLinks=MyConfigFiles.driver.find_elements_by_xpath("//div[@class='content']//li//a")
        # PageCount=len(GetPagesLinks)
        print(PageCount)
        objTablerow = MyConfigFiles.driver.find_elements_by_xpath(
            "//table[@id='created-jpcn']/tbody/tr")
        intRowCount = len(objTablerow)
        print("Rows Count in page  is: " + str(intRowCount - 1))
        flag = False
        for t in range(1, PageCount + 1):
            # t=t+1
            # strt = str(t+1)
            # if t==PageCount-1:
            # break
            for i in range(2, intRowCount + 1):
                stri = str(i)
                strJCPNStage = objActions.getText(
                    "//table[@id='created-jpcn']/tbody/tr[" + stri + "]/td[7]",
                    "xpath")
                if strJCPNStage == "Core CE Assessment":
                    EditIconExists = objActions.ObjectExists(
                        "//table[@id='created-jpcn']/tbody//tr[" + stri +
                        "]//td[2]//img[@class='editIcon iconLink']", "xpath")
                    # CoreCEAssessment_JPCNNumber = objActions.getText("//table[@id='created-jpcn']/tbody//tr[" + stri + "]//td[3]")
                    CoreCEAssessment_JPCNNumber = MyConfigFiles.driver.find_element_by_xpath(
                        "//table[@id='created-jpcn']/tbody//tr[" + stri +
                        "]//td[3]").text
                    objActions.clickElement(
                        "//table[@id='created-jpcn']/tbody//tr[" + stri +
                        "]//td[2]//img[@class='editIcon iconLink']", "xpath")
                    if EditIconExists == True:
                        flag = True
                        print("Able to edit Closed JPCN")
                        break
            if flag == True:
                break
            elif t == PageCount:
                break
            else:
                time.sleep(2)
                objActions.clickElement("//a[text()='" + str(t + 1) + "']",
                                        "xpath")
                time.sleep(2)
        if flag == False:
            sys.exit("FAILED:: Could not find the JPCNNumber ")
        else:
            print("Core CE Assessment JPCN is " + CoreCEAssessment_JPCNNumber +
                  "and successfully clicked edit icon")
        return CoreCEAssessment_JPCNNumber