This repository has been archived by the owner on Apr 4, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add Delete pool, shares tests inside the test suite.
- Loading branch information
1 parent
1e84c28
commit a335e59
Showing
8 changed files
with
211 additions
and
11 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
107 changes: 107 additions & 0 deletions
107
java/src/main/java/com/rockstor/test/webdriver/DeleteMultiplePoolsandShares.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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
91
java/src/main/java/com/rockstor/test/webdriver/DeletePool.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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(); | ||
} | ||
|
||
} | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters