diff --git a/java/src/main/java/com/rockstor/test/webdriver/CheckShareUsedandFreeSpace.java b/java/src/main/java/com/rockstor/test/webdriver/CheckShareUsedandFreeSpace.java index f77fd21..cb32e36 100644 --- a/java/src/main/java/com/rockstor/test/webdriver/CheckShareUsedandFreeSpace.java +++ b/java/src/main/java/com/rockstor/test/webdriver/CheckShareUsedandFreeSpace.java @@ -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(); diff --git a/java/src/main/java/com/rockstor/test/webdriver/CreatePoolTestSuite.java b/java/src/main/java/com/rockstor/test/webdriver/CreatePoolTestSuite.java index 5ad1818..7de5323 100644 --- a/java/src/main/java/com/rockstor/test/webdriver/CreatePoolTestSuite.java +++ b/java/src/main/java/com/rockstor/test/webdriver/CreatePoolTestSuite.java @@ -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 { diff --git a/java/src/main/java/com/rockstor/test/webdriver/CreateShareTestSuite.java b/java/src/main/java/com/rockstor/test/webdriver/CreateShareTestSuite.java index 98bb886..06b3ec8 100644 --- a/java/src/main/java/com/rockstor/test/webdriver/CreateShareTestSuite.java +++ b/java/src/main/java/com/rockstor/test/webdriver/CreateShareTestSuite.java @@ -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 { diff --git a/java/src/main/java/com/rockstor/test/webdriver/DeleteMultiplePoolsandShares.java b/java/src/main/java/com/rockstor/test/webdriver/DeleteMultiplePoolsandShares.java new file mode 100644 index 0000000..f9adfe2 --- /dev/null +++ b/java/src/main/java/com/rockstor/test/webdriver/DeleteMultiplePoolsandShares.java @@ -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(); + } + +} + + + diff --git a/java/src/main/java/com/rockstor/test/webdriver/DeletePool.java b/java/src/main/java/com/rockstor/test/webdriver/DeletePool.java new file mode 100644 index 0000000..8bb8a2f --- /dev/null +++ b/java/src/main/java/com/rockstor/test/webdriver/DeletePool.java @@ -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(); + } + +} + diff --git a/java/src/main/java/com/rockstor/test/webdriver/DeleteShareandPool.java b/java/src/main/java/com/rockstor/test/webdriver/DeleteShareandPool.java index 2f528e5..0283bc5 100644 --- a/java/src/main/java/com/rockstor/test/webdriver/DeleteShareandPool.java +++ b/java/src/main/java/com/rockstor/test/webdriver/DeleteShareandPool.java @@ -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; @@ -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")); diff --git a/java/src/main/java/com/rockstor/test/webdriver/RockStorSuite.java b/java/src/main/java/com/rockstor/test/webdriver/RockStorSuite.java index 421989e..ef122d9 100644 --- a/java/src/main/java/com/rockstor/test/webdriver/RockStorSuite.java +++ b/java/src/main/java/com/rockstor/test/webdriver/RockStorSuite.java @@ -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 { } + diff --git a/java/src/main/java/com/rockstor/test/webdriver/SharewithSameNameinDiffPools.java b/java/src/main/java/com/rockstor/test/webdriver/SharewithSameNameinDiffPools.java index dc9883a..2467b73 100644 --- a/java/src/main/java/com/rockstor/test/webdriver/SharewithSameNameinDiffPools.java +++ b/java/src/main/java/com/rockstor/test/webdriver/SharewithSameNameinDiffPools.java @@ -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"));