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

Commit

Permalink
Add Delete pool, shares tests inside the test suite.
Browse files Browse the repository at this point in the history
  • Loading branch information
priyaganti committed Jun 19, 2013
1 parent 1e84c28 commit a335e59
Show file tree
Hide file tree
Showing 8 changed files with 211 additions and 11 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -114,19 +114,19 @@ public void testShareUsedandFreeSpace() throws Exception {

WebElement shareLink = driver.findElement(By.linkText("share1"));
shareLink.click();


// check for Free and Used Space in the share size graph
WebElement checkShareFreeSpace =driver.findElement(
By.xpath("//*[name()='svg']/*[name()='g']/*[name()='text' and contains(.,'% free')]"));

assertTrue(checkShareFreeSpace.getText(), true);

WebElement checkShareUsedSpace =driver.findElement(
By.xpath("//*[name()='svg']/*[name()='g']/*[name()='text' and contains(.,'% used')]"));

assertTrue(checkShareUsedSpace.getText(), true);

//Delete share
WebElement sharesNav = driver.findElement(By.id("shares_nav"));
sharesNav.click();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
CreatePoolRaid1with1Disk.class,CreatePoolRaid1with1Disk.class,CreatePoolRaid10with1Disk.class,
CreatePoolRaid10with0Disks.class,CreatePoolRaid10with3Disks.class,
CreatePoolRaid0with5Disks.class,CreatePoolRaid1with5Disks.class,CreatePoolRaid10with10Disks.class,
NoDisplayofDisksAlreadyinUse.class,TwoPoolsWithSameName.class})
NoDisplayofDisksAlreadyinUse.class,TwoPoolsWithSameName.class,DeletePool.class})

public class CreatePoolTestSuite {

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,8 @@
@RunWith(Suite.class)
@SuiteClasses({ShareSelectPool.class,CreateShareinKb.class,CreateShareinMb.class,
CreateShareinGb.class, CreateShareinTb.class, SharewithSameNameinSamePool.class,
SharewithSameNameinDiffPools.class})
DeleteShareandPool.class,SharewithSameNameinDiffPools.class,
DeleteMultiplePoolsandShares.class})

public class CreateShareTestSuite {

Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,107 @@
package com.rockstor.test.webdriver;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertTrue;
import org.junit.Test;
import org.junit.Ignore;
import org.junit.BeforeClass;
import org.junit.AfterClass;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.junit.runners.JUnit4;
import org.openqa.selenium.By;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.WebElement;
import org.openqa.selenium.firefox.FirefoxDriver;
import org.apache.commons.io.FileUtils; // Screenshots
import org.openqa.selenium.OutputType;
import org.openqa.selenium.TakesScreenshot;
import org.openqa.selenium.support.ui.ExpectedConditions;
import org.openqa.selenium.support.ui.Select; // Dropdown menu
import org.openqa.selenium.support.ui.WebDriverWait;
import java.io.File;
import java.io.IOException;
import java.util.Properties;
import java.util.concurrent.TimeUnit;
import java.util.List;
import junit.framework.Assert;

import com.rockstor.test.util.RSProps;

public class DeleteMultiplePoolsandShares {

private static WebDriver driver;

@BeforeClass
public static void setUpBeforeClass() throws Exception {
driver = new FirefoxDriver();
driver.manage().timeouts().implicitlyWait(
Integer.parseInt(RSProps.getProperty("waitTimeout")),
TimeUnit.SECONDS);
}

@Test
public void testdelete2Pools() throws Exception {
try{

driver.get(RSProps.getProperty("RockstorVm"));

// Login
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();

//Delete share
WebElement sharesNav = driver.findElement(By.id("shares_nav"));
sharesNav.click();

WebElement shareRow = driver.findElement(By.xpath("//*[@id='shares-table']/tbody/tr[td[contains(.,'share1')]]"));
WebElement deleteShare = shareRow.findElement(By.xpath("td/button[contains(@data-name,'share1') and contains(@data-action,'delete')]"));
deleteShare.click();

// Delete Pool
WebElement poolsNav = driver.findElement(By.id("pools_nav"));
poolsNav.click();

WebElement poolRow = driver.findElement(By.xpath("//*[@id='pools-table']/tbody/tr[td[contains(.,'pool1')]]"));
WebElement deletePool = poolRow.findElement(By.xpath("td/button[contains(@data-name,'pool1') and contains(@data-action,'delete')]"));
deletePool.click();

//delete 2nd pool
WebElement poolRow2 = driver.findElement(By.xpath("//*[@id='pools-table']/tbody/tr[td[contains(.,'pool2')]]"));
WebElement deletePool2 = poolRow2.findElement(By.xpath("td/button[contains(@data-name,'pool2') and contains(@data-action,'delete')]"));
deletePool2.click();


// Logout
WebElement logoutSubmit = driver.findElement(
By.id("logout_user"));

logoutSubmit.click();

}
catch(Exception e){
File screenshotFile = ((TakesScreenshot)driver)
.getScreenshotAs(OutputType.FILE);
FileUtils.copyFile(screenshotFile,
new File(RSProps.getProperty("screenshotDir")
+ "/" + this.getClass().getName()+".png"));
throw e;

}

}

@AfterClass
public static void tearDownAfterClass() throws Exception {
driver.quit();
}

}



91 changes: 91 additions & 0 deletions java/src/main/java/com/rockstor/test/webdriver/DeletePool.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,91 @@
package com.rockstor.test.webdriver;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertTrue;
import org.junit.Test;
import org.junit.Ignore;
import org.junit.BeforeClass;
import org.junit.AfterClass;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.junit.runners.JUnit4;
import org.openqa.selenium.By;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.WebElement;
import org.openqa.selenium.firefox.FirefoxDriver;
import org.apache.commons.io.FileUtils; // Screenshots
import org.openqa.selenium.OutputType;
import org.openqa.selenium.TakesScreenshot;
import org.openqa.selenium.support.ui.ExpectedConditions;
import org.openqa.selenium.support.ui.Select; // Dropdown menu
import org.openqa.selenium.support.ui.WebDriverWait;
import java.io.File;
import java.io.IOException;
import java.util.Properties;
import java.util.concurrent.TimeUnit;
import java.util.List;
import junit.framework.Assert;

import com.rockstor.test.util.RSProps;

public class DeletePool {

private static WebDriver driver;

@BeforeClass
public static void setUpBeforeClass() throws Exception {
driver = new FirefoxDriver();
driver.manage().timeouts().implicitlyWait(
Integer.parseInt(RSProps.getProperty("waitTimeout")),
TimeUnit.SECONDS);
}

@Test
public void testdeletePool() throws Exception {
try{

driver.get(RSProps.getProperty("RockstorVm"));

// Login
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();

// Delete Pool
WebElement poolsNav = driver.findElement(By.id("pools_nav"));
poolsNav.click();

WebElement poolRow = driver.findElement(By.xpath("//*[@id='pools-table']/tbody/tr[td[contains(.,'pool1')]]"));
WebElement deletePool = poolRow.findElement(By.xpath("td/button[contains(@data-name,'pool1') and contains(@data-action,'delete')]"));
deletePool.click();

// Logout
WebElement logoutSubmit = driver.findElement(
By.id("logout_user"));

logoutSubmit.click();

}
catch(Exception e){
File screenshotFile = ((TakesScreenshot)driver)
.getScreenshotAs(OutputType.FILE);
FileUtils.copyFile(screenshotFile,
new File(RSProps.getProperty("screenshotDir")
+ "/" + this.getClass().getName()+".png"));
throw e;

}

}

@AfterClass
public static void tearDownAfterClass() throws Exception {
driver.quit();
}

}

Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@
import java.util.Properties;
import java.util.concurrent.TimeUnit;
import java.util.List;

import junit.framework.Assert;

import com.rockstor.test.util.RSProps;
Expand All @@ -41,7 +40,7 @@ public static void setUpBeforeClass() throws Exception {
}

@Test
public void testSharePoolnameValidate() throws Exception {
public void testDeleteShareandPool() throws Exception {
try{

driver.get(RSProps.getProperty("RockstorVm"));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,9 @@
import org.junit.runners.Suite.SuiteClasses;

@RunWith(Suite.class)
@SuiteClasses({ShareDetailsSuite.class})
@SuiteClasses({ShareDetailsSuite.class,CreatePoolTestSuite.class,CreateShareTestSuite.class
,SharesTestSuite.class})
public class RockStorSuite {

}

Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ public static void setUpBeforeClass() throws Exception {
}

@Test
public void testShareSizeTb() throws Exception {
public void testShareNameinDiffPools() throws Exception {
try{

driver.get(RSProps.getProperty("RockstorVm"));
Expand Down

0 comments on commit a335e59

Please sign in to comment.