public void ValidateUploadAvatar(String fileName) { WebDriverUtility.ClickOn(UploadPic); WebDriverUtility.UploadPhoto(fileName); if (fileName.Contains("gif") || fileName.Contains("png") || fileName.Contains("jpg")) { if (!fileName.Contains("gif")) { Thread.Sleep(3000); WebDriverUtility.ClickOn(ApplyAvatar); WebDriverUtility.ScrollDownPage(); WebDriverUtility.ClickOn(SaveButton); } else { WebDriverUtility.ScrollDownPage(); WebDriverUtility.ClickOn(SaveButton); } } else { String errorMessage = WebDriverUtility.GetText(InvalidFormatAvatar); Assert.AreEqual(errorMessage, "docx format is not allowed"); } }