Skip to content
This repository has been archived by the owner on Apr 4, 2023. It is now read-only.

Commit

Permalink
Pool test suite with a few Priority tests
Browse files Browse the repository at this point in the history
Add pool using 0 disks and raid0 config to fail and display error message.
Add pool using 1 disk and raid0 config to fail and display error message.
Add pool using 2 disk and raid0 config to succeed.
Add pool using 5 disk and raid0 config to succeed.
Add pool using 0 disks and raid1 config to fail and display error message.
Add pool using 1 disk and raid1 config to fail and display error message.
Add pool using 2 disks and raid1 config to succeed.
Add pool using 5 disks and raid1 config to succeed.
Add pool using 0 disks and raid10 config to fail and display error message.
Add pool using 3 disks and raid10 config to fail and display error message.
Add pool using 4 disks and raid10 config to succeed.
Add pool using 10 disks and raid10 config to succeed.
Add additional disk to existing pool.
Delete Pool after every add pool.
  • Loading branch information
priyaganti committed Jun 6, 2013
1 parent 3ca03d6 commit 890eb94
Show file tree
Hide file tree
Showing 15 changed files with 1,471 additions and 0 deletions.
96 changes: 96 additions & 0 deletions webdriver/java/AddPoolRaid0with0Disks.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,96 @@
import java.io.File;
import java.io.FileInputStream;
import org.openqa.selenium.By;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.WebElement;
import org.openqa.selenium.support.ui.Select; // Dropdown menu
import org.openqa.selenium.firefox.FirefoxDriver;
import org.openqa.selenium.support.ui.ExpectedConditions;// Explicit Waits
import org.openqa.selenium.support.ui.WebDriverWait;
import org.apache.commons.io.FileUtils; // Screenshots
import org.openqa.selenium.OutputType;
import org.openqa.selenium.TakesScreenshot;
import java.io.IOException;
import java.util.Properties;


public class AddPoolRaid0with0Disks {

public static void main(String[] args) throws IOException {
// Create a new instance of the Firefox driver

WebDriver driver = new FirefoxDriver();

try{

Properties prop = new Properties();
prop.load(new FileInputStream("config.properties"));
driver.get(prop.getProperty("RockstorVm"));


//User Login Input Forms
WebElement username = driver.findElement(By.id("inputUsername"));
username.sendKeys("admin");

WebElement password = driver.findElement(By.id("inputPassword"));
password.sendKeys("admin");

WebElement submitButton = driver.findElement(By.id("sign_in"));
submitButton.click();

// Select Pools from Navigation bar
WebElement poolsNav = driver.findElement(By.id("pools_nav"));
poolsNav.click();

//Explicit Wait for Pools page to load
WebElement myWaitElement1 = (new WebDriverWait(driver, 10))
.until(ExpectedConditions.elementToBeClickable(By.id("add_pool")));

WebElement addPool = driver.findElement(By.id("add_pool"));
addPool.click();

//Explicit Wait for CreatePools page.
WebElement myWaitElement2 = (new WebDriverWait(driver, 10))
.until(ExpectedConditions.elementToBeClickable(By.id("create_pool")));


WebElement poolname = driver.findElement(By.id("pool_name"));
poolname.sendKeys("pool1");

//Raid Configuration Dropdown box
Select raidConfigDroplist = new Select(driver.findElement(By.id("raid_level")));
raidConfigDroplist.selectByIndex(0);

//Create Pool
WebElement createPool = driver.findElement(By.id("create_pool"));
createPool.click();

WebElement myWaitElement3 = (new WebDriverWait(driver, 10))
.until(ExpectedConditions.elementToBeClickable(By.id("delete_pool_pool1")));

}
//catch any exceptions by taking screenshots
catch(Exception e){

System.out.println(e.toString());

File screenshotFile = ((TakesScreenshot)driver).getScreenshotAs(OutputType.FILE);
FileUtils.copyFile(screenshotFile,new File("/home/priya/rockstor-tests/webdriver/java/ScreenShots/Raid0with0DiskPool.png"));

}

//click on logout
WebElement logoutSubmit = driver.findElement(By.id("logout_user"));

logoutSubmit.click();

}
}








104 changes: 104 additions & 0 deletions webdriver/java/AddPoolRaid0with1Disk.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,104 @@

import java.io.File;
import java.io.FileInputStream;
import org.openqa.selenium.By;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.WebElement;
import org.openqa.selenium.support.ui.Select; // Dropdown menu
import org.openqa.selenium.firefox.FirefoxDriver;
import org.openqa.selenium.support.ui.ExpectedConditions;// Explicit Waits
import org.openqa.selenium.support.ui.WebDriverWait;
import org.apache.commons.io.FileUtils; // Screenshots
import org.openqa.selenium.OutputType;
import org.openqa.selenium.TakesScreenshot;
import java.io.IOException;
import java.util.Properties;



public class AddPoolRaid0with1Disk {

public static void main(String[] args) throws IOException {
// Create a new instance of the Firefox driver


WebDriver driver = new FirefoxDriver();

try{

Properties prop = new Properties();
prop.load(new FileInputStream("config.properties"));
driver.get(prop.getProperty("RockstorVm"));


// User Login Input forms
WebElement username = driver.findElement(By.id("inputUsername"));
username.sendKeys("admin");

WebElement password = driver.findElement(By.id("inputPassword"));
password.sendKeys("admin");

WebElement submit = driver.findElement(By.id("sign_in"));
submit.click();

// Select Pools from Navigation bar
WebElement poolsNav = driver.findElement(By.id("pools_nav"));
poolsNav.click();

//Explicit Wait for Pools page to load
WebElement myWaitElement1 = (new WebDriverWait(driver, 30))
.until(ExpectedConditions.elementToBeClickable(By.id("add_pool")));

// Click create Pool Button
WebElement addPool = driver.findElement(By.id("add_pool"));
addPool.click();

//Explicit Wait for CreatePools page.
WebElement myWaitElement2 = (new WebDriverWait(driver, 30))
.until(ExpectedConditions.elementToBeClickable(By.id("create_pool")));

//User Input Form to Select Pool Name
WebElement poolname = driver.findElement(By.id("pool_name"));
poolname.sendKeys("pool1");

//Raid Configuration Dropdown box
Select raidConfigDroplist = new Select(driver.findElement(By.id("raid_level")));
raidConfigDroplist.selectByIndex(0);

//Select Disks CheckBox
WebElement diskCheckBox1 = driver.findElement(By.id("sdb"));
diskCheckBox1.click();

//Create Pool
WebElement createPool = driver.findElement(By.id("create_pool"));
createPool.click();

//Wait for Pools page to load
WebElement myWaitElement3 = (new WebDriverWait(driver, 10))
.until(ExpectedConditions.elementToBeClickable(By.id("delete_pool_pool1")));
}

//catch any exceptions by taking screenshots.
catch(Exception e){

System.out.println(e.toString());

File screenshotFile = ((TakesScreenshot)driver).getScreenshotAs(OutputType.FILE);
FileUtils.copyFile(screenshotFile,new File("/home/priya/rockstor-tests/webdriver/java/ScreenShots/Raid01DiskPool.png"));

}

//click on logout
WebElement logoutSubmit = driver.findElement(By.id("logout_user"));

logoutSubmit.click();

}
}







104 changes: 104 additions & 0 deletions webdriver/java/AddPoolRaid0with2Disks.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,104 @@
import java.io.File;
import java.io.FileInputStream;
import org.openqa.selenium.By;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.WebElement;
import org.openqa.selenium.support.ui.Select; // Dropdown menu
import org.openqa.selenium.firefox.FirefoxDriver;
import org.openqa.selenium.support.ui.ExpectedConditions;// Explicit Waits
import org.openqa.selenium.support.ui.WebDriverWait;
import org.apache.commons.io.FileUtils; // Screenshots
import org.openqa.selenium.OutputType;
import org.openqa.selenium.TakesScreenshot;
import java.io.IOException;
import java.util.Properties;


public class AddPoolRaid0with2Disks {

public static void main(String[] args) throws IOException {
// Create a new instance of the Firefox driver

WebDriver driver = new FirefoxDriver();

try{

Properties prop = new Properties();
prop.load(new FileInputStream("config.properties"));
driver.get(prop.getProperty("RockstorVm"));



//User Login Input Forms
WebElement username = driver.findElement(By.id("inputUsername"));
username.sendKeys("admin");

WebElement password = driver.findElement(By.id("inputPassword"));
password.sendKeys("admin");

WebElement submit = driver.findElement(By.id("sign_in"));
submit.click();

// Select Pools from Navigation bar
WebElement poolsNav = driver.findElement(By.id("pools_nav"));
poolsNav.click();

//Explicit Wait for Pools page to load
WebElement myWaitElement1 = (new WebDriverWait(driver, 10))
.until(ExpectedConditions.elementToBeClickable(By.id("add_pool")));


WebElement addPool = driver.findElement(By.id("add_pool"));
addPool.click();

//Explicit Wait for CreatePools page.
WebElement myWaitlement2 = (new WebDriverWait(driver, 10))
.until(ExpectedConditions.elementToBeClickable(By.id("create_pool")));


WebElement poolname = driver.findElement(By.id("pool_name"));
poolname.sendKeys("pool1");

//Raid Configuration Dropdown box
Select raidConfigDroplist = new Select(driver.findElement(By.id("raid_level")));
raidConfigDroplist.selectByIndex(0);

//Select Disks CheckBox
WebElement diskCheckBox1 = driver.findElement(By.id("sdb"));
diskCheckBox1.click();
WebElement diskCheckBox2 = driver.findElement(By.id("sdc"));
diskCheckBox2.click();

//Create Pool
WebElement createPool = driver.findElement(By.id("create_pool"));
createPool.click();

WebElement myWaitElement3 = (new WebDriverWait(driver, 10))
.until(ExpectedConditions.elementToBeClickable(By.id("delete_pool_pool1")));
}

//catch any exceptions by taking screenshots.
catch(Exception e){

System.out.println(e.toString());

File screenshotFile = ((TakesScreenshot)driver).getScreenshotAs(OutputType.FILE);
FileUtils.copyFile(screenshotFile,new File("/home/priya/rockstor-tests/webdriver/java/ScreenShots/AddPool_Raid02Disks.png"));

}

//click on logout
WebElement logoutSubmit = driver.findElement(By.id("logout_user"));

logoutSubmit.click();

}
}








Loading

0 comments on commit 890eb94

Please sign in to comment.