コード例 #1
0
            public void TC_WorkSamplesUpload()
            {
                GlobalDefinitions.ExcelLib.PopulateInCollection(Base.ExcelPath, "ShareSkill");
                test = extent.StartTest("Uploading File Test");
                // create an object for serviceLIsting page

                ServiceListing skillObj = new ServiceListing();

                //click on the share skill button
                skillObj.ShareSkillBtnClick();

                //enter all the details from the excel
                Thread.Sleep(2000);
                string title = GlobalDefinitions.ExcelLib.ReadData(3, "Title");
                string desc  = GlobalDefinitions.ExcelLib.ReadData(3, "Description");

                skillObj.inputTitleDescription(title, desc);

                //work samples file upload
                skillObj.WorkSamplesUploadClick();

                //AutoIt - Handles windows that do not belong to browser

                AutoItX3 autoIt = new AutoItX3();

                autoIt.WinActivate("Open"); //Activate - so that the next set of actions happen on this window
                Thread.Sleep(2000);
                autoIt.Send(@"C:\Users\sudha\Desktop\FileUploadTest.docx");
                Thread.Sleep(2000);
                //  autoIt.Send("{ENTER}");
                // autoIt.MouseClick("Button1",0,0, 1, 0);
                autoIt.ControlClick("Open", "", "Button1");

                //Check whether document uploaded property or not
                if (skillObj.IsWorkSamplesDocUpload())
                {
                    Base.test.Log(LogStatus.Pass, "Document uploaded successfully using AutoIt");
                    Assert.True(true);
                }
                else
                {
                    test.Log(LogStatus.Fail, "Document not uploaded");
                    Assert.Fail();
                }
            }