Example #1
0
 //   [Test, Description("Verify User is able to replace an Image")]
 public void TC_04_ValidateUserIsAbleToReplaceImage()
 {
     try
     {
         String TestName    = (TestContext.CurrentContext.Test.Name.ToString());
         String description = TestContext.CurrentContext.Test.Properties.Get("Description").ToString();
         CreateTest(TestName, description);
         //CreateDistributionPage distmodule = new CreateDistributionPage(driver);
         //System.Threading.Thread.Sleep(5000);
         //distmodule.SearchForProject("TestQA_CK");
         CreateDraftPage createDraft = new CreateDraftPage(driver);
         //System.Threading.Thread.Sleep(8000);
         //createDraft.CLICKOPENPROJECT();
         //System.Threading.Thread.Sleep(8000);
         //createDraft.ClikOnBackdrop();
         //System.Threading.Thread.Sleep(5000);
         AuthoringScreenEnhancements auth = new AuthoringScreenEnhancements(driver);
         auth.ClickInsertImage();
         System.Threading.Thread.Sleep(15000);
         Console.WriteLine("*******HERE iS RESULT" + result);
         String str = result.Split(new[] { ' ' }).Skip(2).FirstOrDefault();
         Console.WriteLine("*******HERE iS RESULT" + str);
         auth.EnterAssetName(str);
         String path1 = TakeScreenshot(driver);
         auth.SuccessScreenshot(path1, "Select an Image from Uploads");
         System.Threading.Thread.Sleep(25000);
         auth.SelectImageFromUpload(result);
         System.Threading.Thread.Sleep(5000);
         createDraft.ClickNewDraft();
         String draftName = createDraft.EnterValidDraftName();
         System.Threading.Thread.Sleep(5000);
         createDraft.ClickOnBlankDraft();
         System.Threading.Thread.Sleep(5000);
         String path2 = TakeScreenshot(driver);
         createDraft.SuccessScreenshot(path2, "Creating Blank Draft: " + draftName + "");
         createDraft.CreateDraft();
         System.Threading.Thread.Sleep(15000);
         System.Threading.Thread.Sleep(5000);
         AddProjectPage addProject = new AddProjectPage(driver);
         addProject.ClickNotifications();
         // createDraft.ClikOnBackdrop();
         String path3 = TakeScreenshot(driver);
         createDraft.SuccessScreenshot(path3, "Created a Draft");
         addProject.BackToProject();
         auth.LeftDraftDropDown(draftName);
         System.Threading.Thread.Sleep(5000);
         IWebElement framel = auth.EnterIntoLeftFrame();
         driver.SwitchTo().Frame(framel);
         System.Threading.Thread.Sleep(5000);
         driver.SwitchTo().ActiveElement();
         auth.ClickGdocLeft();
         driver.SwitchTo().ActiveElement().SendKeys(Keys.Control + "v");
         System.Threading.Thread.Sleep(15000);
         String path4 = TakeScreenshot(driver);
         auth.SuccessScreenshot(path4, "pasting the image Asset Id in Gdoc");
         driver.SwitchTo().DefaultContent();
         System.Threading.Thread.Sleep(5000);
         auth.PreviewLeftTab();
         String path5 = TakeScreenshot(driver);
         auth.SuccessScreenshot(path5, "Verifying the image got reflected in Preview Left");
         auth.GdocLeftTab();
         auth.ClickInsertImage();
         System.Threading.Thread.Sleep(25000);
         Console.WriteLine("*******HERE iS RESULT" + result);
         String str1 = result.Split(new[] { ' ' }).Skip(2).FirstOrDefault();
         Console.WriteLine("*******HERE iS RESULT" + str1);
         auth.EnterAssetName(str1);
         System.Threading.Thread.Sleep(25000);
         auth.ReplaceTheImage(result);
         String path8 = TakeScreenshot(driver);
         auth.SuccessScreenshot(path8, "Verifying the image got replaced with new Image");
         auth.SelectImageFromUpload(result);
         System.Threading.Thread.Sleep(25000);
         auth.LeftDraftDropDown(draftName);
         String path6 = TakeScreenshot(driver);
         auth.SuccessScreenshot(path6, "The same image Url in Gdoc Which was added earlier");
         driver.SwitchTo().DefaultContent();
         auth.PreviewLeftTab();
         String path7 = TakeScreenshot(driver);
         auth.SuccessScreenshot(path7, "Verifying the image got replaced Succesfully in Preview Left");
     }
     catch (AssertionException)
     {
         fail("Assertion failed");
         throw;
     }
 }