@Test(priority=1)
@Parameters({"userId","password","url"})
public void testUpload(String userId,String password,String url) throws Exception
{
// String exePath = System.getProperty("user.dir") + "\\TestData\\chromedriver.exe";
// System.setProperty("webdriver.chrome.driver", exePath);
DesiredCapabilities caps = new DesiredCapabilities();
caps.setCapability("browser", "Chrome");
caps.setCapability("browser_version", "55.0");
caps.setCapability("os", "Windows");
caps.setCapability("os_version", "8");
caps.setCapability("resolution", "1920x1080");
WebDriver driver = new RemoteWebDriver(new URL(URL), caps);
action_obj = new Repo_Test(driver);
Assertion_obj = new Assertion_Test(driver);
executor=(JavascriptExecutor) driver;
driver.get(url);
System.out.println("---------------------------------------------------------------------------------------------------------------");
//Open URL
System.out.println("@URL Opening......."+url);
//Maximize Window
driver.manage().window().maximize();
Thread.sleep(3000);
//Click on 'Sign in with email' link
action_obj.signin().click();
Thread.sleep(1500);
//Entering userID
action_obj.username().sendKeys(userId);
Thread.sleep(1000);
//Entering Password
action_obj.Password().sendKeys(password);
//Click on 'LOGIN' button
Thread.sleep(350);
action_obj.loginbutton().click();
Thread.sleep(500);
//Assertion for Login
Assertion_obj.logout_assertion();
Thread.sleep(3000);
//Entering data in status section
action_obj.usercontentstatus().sendKeys("Classic Shortbread(Picture For test purpose)");
Thread.sleep(1000);
//Uploading file
((RemoteWebDriver) driver).setFileDetector(new LocalFileDetector());
Thread.sleep(2000);
driver.findElement(By.xpath(".//*[@id='content']/div[2]/div/div[2]/div/div/form/div/div/div[3]/div[1]/input")).sendKeys("C:\\Users\\hello\\Documents\\images\\wallpaper2.jpg");
Thread.sleep(2000);
action_obj.postbutton().click();
Thread.sleep(2000);
}
@Test(priority=2)
public void Editing_Pictures_by_Business_User() throws Exception{
//Again click on 'Home'
action_obj.home().click();
Thread.sleep(1000);
//Scroll
JavascriptExecutor jse = (JavascriptExecutor)driver;
Thread.sleep(1000);
//Click on Edit button
action_obj.recipesedit().click();
Thread.sleep(2000);
//Edit Name
action_obj.editname().sendKeys("Edited");
Thread.sleep(2000);
//Click on 'OK' button
Thread.sleep(500);
action_obj.editdecok().click();
//Assertion
Assertion_obj.edit_assertion();
Thread.sleep(2000);
}
@Test(priority=3)
public void Deleting_Pictures_Contents_by_Business_User() throws Exception{
//Click on 'Delete' button
action_obj.editdelete().click();
Thread.sleep(500);
// Assertion_obj.edit_delete_pic();
// String act_deletetext = action_obj.recipesedit().getText();
// Thread.sleep(300);
// String Ex_deletetext = "Classic Shortbread(Picture For test purpose)Edited";
// Assert.assertNotEquals(act_deletetext,Ex_deletetext);
}
@Test(priority=4)
public void Posting_Video_By_Business_User() throws Exception{
Thread.sleep(2000);
//Entering data in status section
action_obj.usercontentstatus().sendKeys("Classic Shortbread(Video For test purpose)");
Thread.sleep(2000);
//Uploading file
((RemoteWebDriver) driver).setFileDetector(new LocalFileDetector());
Thread.sleep(2000);
driver.findElement(By.xpath(".//*[@id='content']/div[2]/div/div[2]/div/div[1]/form/div/div/div[3]/div[2]/input")).sendKeys("C:\\Users\\hello\\Documents\\video\\sample_mpeg4.mp4");
Thread.sleep(2000);
//Scroll
JavascriptExecutor jse = (JavascriptExecutor)driver;
jse.executeScript("window.scrollBy(0,500)", "");
Thread.sleep(1000);
//Click on Post button
action_obj.postbutton().click();
Thread.sleep(700);
//Assertion
Assertion_obj.addpost();
}