From f833d217afc534a0d9a12413828c2d54da0cb251 Mon Sep 17 00:00:00 2001 From: Priyanka Ganti Date: Sat, 1 Jun 2013 12:56:04 -0700 Subject: [PATCH 1/3] add dependencies for webdriver java tests --- webdriver/java/Selenium2Example.java | 46 ++++++++++++++++++ webdriver/java/pom.xml | 36 ++++++++++++++ webdriver/java/target/MySel20Proj-1.0.jar | Bin 0 -> 1550 bytes webdriver/java/target/classes/.classpath | 7 +++ webdriver/java/target/classes/.project | 23 +++++++++ .../.settings/org.eclipse.jdt.core.prefs | 6 +++ .../.settings/org.eclipse.m2e.core.prefs | 5 ++ .../target/classes/Selenium2Example.class | Bin 0 -> 1591 bytes webdriver/java/target/classes/pom.xml | 36 ++++++++++++++ .../target/classes/target/MySel20Proj-1.0.jar | Bin 0 -> 1550 bytes .../target/maven-archiver/pom.properties | 5 ++ .../java/target/maven-archiver/pom.properties | 5 ++ 12 files changed, 169 insertions(+) create mode 100644 webdriver/java/Selenium2Example.java create mode 100644 webdriver/java/pom.xml create mode 100644 webdriver/java/target/MySel20Proj-1.0.jar create mode 100644 webdriver/java/target/classes/.classpath create mode 100644 webdriver/java/target/classes/.project create mode 100644 webdriver/java/target/classes/.settings/org.eclipse.jdt.core.prefs create mode 100644 webdriver/java/target/classes/.settings/org.eclipse.m2e.core.prefs create mode 100644 webdriver/java/target/classes/Selenium2Example.class create mode 100644 webdriver/java/target/classes/pom.xml create mode 100644 webdriver/java/target/classes/target/MySel20Proj-1.0.jar create mode 100644 webdriver/java/target/classes/target/maven-archiver/pom.properties create mode 100644 webdriver/java/target/maven-archiver/pom.properties diff --git a/webdriver/java/Selenium2Example.java b/webdriver/java/Selenium2Example.java new file mode 100644 index 0000000..db14b43 --- /dev/null +++ b/webdriver/java/Selenium2Example.java @@ -0,0 +1,46 @@ + +import org.openqa.selenium.By; +import org.openqa.selenium.WebDriver; +import org.openqa.selenium.WebElement; +import org.openqa.selenium.firefox.FirefoxDriver; +import org.openqa.selenium.support.ui.ExpectedCondition; +import org.openqa.selenium.support.ui.WebDriverWait; + +public class Selenium2Example { + public static void main(String[] args) { + // Create a new instance of the Firefox driver + // Notice that the remainder of the code relies on the interface, + // not the implementation. + WebDriver driver = new FirefoxDriver(); + + // And now use this to visit Google + driver.get("https://rockstor-iso:8443"); + // Alternatively the same thing can be done like this + // driver.navigate().to("http://www.google.com"); + + // Find the text input element by its name + WebElement username = driver.findElement(By.id("inputUsername")); + + // Enter something to search for + username.sendKeys("admin"); + + WebElement password = driver.findElement(By.id("inputPassword")); + password.sendKeys("admin"); + + WebElement submit = driver.findElement(By.id("sign_in")); + + // Now submit the form. WebDriver will find the form for us from the element + submit.click(); + + WebElement logoutSubmit = driver.findElement(By.id("logout_user")); + + logoutSubmit.click(); + + // Check the title of the page + System.out.println("Page title is: " + driver.getTitle()); + + //Close the browser + //driver.quit(); + } +} + diff --git a/webdriver/java/pom.xml b/webdriver/java/pom.xml new file mode 100644 index 0000000..a0b4768 --- /dev/null +++ b/webdriver/java/pom.xml @@ -0,0 +1,36 @@ + + + 4.0.0 + MySel20Proj + MySel20Proj + 1.0 + + + org.seleniumhq.selenium + selenium-java + 2.33.0 + + + com.opera + operadriver + + + + + + com.opera + operadriver + 1.3 + + + org.seleniumhq.selenium + selenium-remote-driver + + + + + + + diff --git a/webdriver/java/target/MySel20Proj-1.0.jar b/webdriver/java/target/MySel20Proj-1.0.jar new file mode 100644 index 0000000000000000000000000000000000000000..e34fa935d7b5f6dd01526a818f784ce88aaed388 GIT binary patch literal 1550 zcmWIWW@h1H0D(6R+nvA+D8UJ&eO*Hwbv^yu^aG&EI2c|7mF;=4$07|VT?51-$jW>j z{XE@VgG2Ou-9G!CIql=Et9OytTUYDcne&^246YbIcv__6b?$_Yx2_Wh`;#SMQ^d3n zs8sBn(;X!29TZ$LS8J_^47bo^;~>!*;nP8%fihmk#a;&)_Ps^TdU8(IQ=>uW~TC+Cl|S}qoH-@J2s3orKv(;LZ4rhJ)wyi6(*Z=#fiEAgs%wu_S1+lQ*|ba89jub8vAF4^!8t%{zp;y^JmkP4>Rf!WiJq$RxsyJDUUD3 + + + + + + diff --git a/webdriver/java/target/classes/.project b/webdriver/java/target/classes/.project new file mode 100644 index 0000000..caf4c59 --- /dev/null +++ b/webdriver/java/target/classes/.project @@ -0,0 +1,23 @@ + + + MySel20Proj + NO_M2ECLIPSE_SUPPORT: Project files created with the maven-eclipse-plugin are not supported in M2Eclipse. + + + + + org.eclipse.jdt.core.javabuilder + + + + + org.eclipse.m2e.core.maven2Builder + + + + + + org.eclipse.m2e.core.maven2Nature + org.eclipse.jdt.core.javanature + + diff --git a/webdriver/java/target/classes/.settings/org.eclipse.jdt.core.prefs b/webdriver/java/target/classes/.settings/org.eclipse.jdt.core.prefs new file mode 100644 index 0000000..e18b690 --- /dev/null +++ b/webdriver/java/target/classes/.settings/org.eclipse.jdt.core.prefs @@ -0,0 +1,6 @@ +#Thu May 23 16:10:27 PDT 2013 +eclipse.preferences.version=1 +org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.5 +org.eclipse.jdt.core.compiler.compliance=1.5 +org.eclipse.jdt.core.compiler.problem.forbiddenReference=warning +org.eclipse.jdt.core.compiler.source=1.5 diff --git a/webdriver/java/target/classes/.settings/org.eclipse.m2e.core.prefs b/webdriver/java/target/classes/.settings/org.eclipse.m2e.core.prefs new file mode 100644 index 0000000..eeafa3f --- /dev/null +++ b/webdriver/java/target/classes/.settings/org.eclipse.m2e.core.prefs @@ -0,0 +1,5 @@ +#Thu May 23 16:10:20 PDT 2013 +activeProfiles= +eclipse.preferences.version=1 +resolveWorkspaceProjects=true +version=1 diff --git a/webdriver/java/target/classes/Selenium2Example.class b/webdriver/java/target/classes/Selenium2Example.class new file mode 100644 index 0000000000000000000000000000000000000000..85c6c395724be07167d8bf09d4c48c314da19642 GIT binary patch literal 1591 zcmZ`(TU!%X6kR7I&Jae$AXqeNTC`0JI2CEJiA4pW7bDURV$rtrBsmO6=Mv{)<+X3^ zziA(!sh|A;{Zak8PbM^l4ln1nFK4g4*WQ2q{l}jGZh&jZFpOHl5uS|Q+2z;V?Knb1 zmR_IpSKM^CXPb|j&qXU@IB{EgGFo65DpxibvP*tjvINgw*SdHDL2-bPi z5e$Wf-{Q^&52U*HAG6Vp43+HYzjgBIa_KQll%F*Q|65TYJ-c4n&~S#K;s>_rcZBzn zn_)k4b6W;t+kb7YB>Vk9z7jzmqZrn4mSJ)yiaKGcCMuvXv*4*695lrA6 z4d)mxruls$nu#w1lQ>VvZ9$0`FQ-MPqsVYldYw3W9E!l>E@kHuN*XQ`qBQS|y9VCH zdkh)bW|&U%+DNyntGKTixQh1~Mz*EbUUq~lJPNK>KF+3+Dj z!|+ExXzQ3`&_Zc@Tgks48<Km#hO)(%tCz?OB zYIHMcXSC<8?L+^yC(hHV#K15{Xf+ZA+E4c0PT@4YkTEOt909+)!RY2bji_p2tc&ps zs)Y-`<6;+689bcMzQqTdLxqafMOBGz9EetDj*4y`h-%r%Y!@FfQor@@TW&Jfd;1Nw zH@Lf5Slq|`Y8NXEd-!q>t9$rrfMAy51x`W78JcSoDAGi#;sUip5i2xjEK12!Ou?q1 z;GvA4sY?~w1;S2-Y)ZV3Y6`N$V+|QTpb|_FFm)(LRsw=#(WdQ}~`vInvxB Iy9|E#2N@5JegFUf literal 0 HcmV?d00001 diff --git a/webdriver/java/target/classes/pom.xml b/webdriver/java/target/classes/pom.xml new file mode 100644 index 0000000..a0b4768 --- /dev/null +++ b/webdriver/java/target/classes/pom.xml @@ -0,0 +1,36 @@ + + + 4.0.0 + MySel20Proj + MySel20Proj + 1.0 + + + org.seleniumhq.selenium + selenium-java + 2.33.0 + + + com.opera + operadriver + + + + + + com.opera + operadriver + 1.3 + + + org.seleniumhq.selenium + selenium-remote-driver + + + + + + + diff --git a/webdriver/java/target/classes/target/MySel20Proj-1.0.jar b/webdriver/java/target/classes/target/MySel20Proj-1.0.jar new file mode 100644 index 0000000000000000000000000000000000000000..e34fa935d7b5f6dd01526a818f784ce88aaed388 GIT binary patch literal 1550 zcmWIWW@h1H0D(6R+nvA+D8UJ&eO*Hwbv^yu^aG&EI2c|7mF;=4$07|VT?51-$jW>j z{XE@VgG2Ou-9G!CIql=Et9OytTUYDcne&^246YbIcv__6b?$_Yx2_Wh`;#SMQ^d3n zs8sBn(;X!29TZ$LS8J_^47bo^;~>!*;nP8%fihmk#a;&)_Ps^TdU8(IQ=>uW~TC+Cl|S}qoH-@J2s3orKv(;LZ4rhJ)wyi6(*Z=#fiEAgs%wu_S1+lQ*|ba89jub8vAF4^!8t%{zp;y^JmkP4>Rf!WiJq$RxsyJDUUD3 Date: Sat, 1 Jun 2013 13:33:46 -0700 Subject: [PATCH 2/3] rename Selenium2Example.java to LoginHappyPath --- ...Selenium2Example.java => LoginHappyPath.java} | 5 ++++- .../java/target/classes/Selenium2Example.class | Bin 1591 -> 0 bytes 2 files changed, 4 insertions(+), 1 deletion(-) rename webdriver/java/{Selenium2Example.java => LoginHappyPath.java} (97%) delete mode 100644 webdriver/java/target/classes/Selenium2Example.class diff --git a/webdriver/java/Selenium2Example.java b/webdriver/java/LoginHappyPath.java similarity index 97% rename from webdriver/java/Selenium2Example.java rename to webdriver/java/LoginHappyPath.java index db14b43..ef60c59 100644 --- a/webdriver/java/Selenium2Example.java +++ b/webdriver/java/LoginHappyPath.java @@ -6,7 +6,8 @@ import org.openqa.selenium.support.ui.ExpectedCondition; import org.openqa.selenium.support.ui.WebDriverWait; -public class Selenium2Example { +public class LoginHappyPath { + public static void main(String[] args) { // Create a new instance of the Firefox driver // Notice that the remainder of the code relies on the interface, @@ -44,3 +45,5 @@ public static void main(String[] args) { } } + + diff --git a/webdriver/java/target/classes/Selenium2Example.class b/webdriver/java/target/classes/Selenium2Example.class deleted file mode 100644 index 85c6c395724be07167d8bf09d4c48c314da19642..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 1591 zcmZ`(TU!%X6kR7I&Jae$AXqeNTC`0JI2CEJiA4pW7bDURV$rtrBsmO6=Mv{)<+X3^ zziA(!sh|A;{Zak8PbM^l4ln1nFK4g4*WQ2q{l}jGZh&jZFpOHl5uS|Q+2z;V?Knb1 zmR_IpSKM^CXPb|j&qXU@IB{EgGFo65DpxibvP*tjvINgw*SdHDL2-bPi z5e$Wf-{Q^&52U*HAG6Vp43+HYzjgBIa_KQll%F*Q|65TYJ-c4n&~S#K;s>_rcZBzn zn_)k4b6W;t+kb7YB>Vk9z7jzmqZrn4mSJ)yiaKGcCMuvXv*4*695lrA6 z4d)mxruls$nu#w1lQ>VvZ9$0`FQ-MPqsVYldYw3W9E!l>E@kHuN*XQ`qBQS|y9VCH zdkh)bW|&U%+DNyntGKTixQh1~Mz*EbUUq~lJPNK>KF+3+Dj z!|+ExXzQ3`&_Zc@Tgks48<Km#hO)(%tCz?OB zYIHMcXSC<8?L+^yC(hHV#K15{Xf+ZA+E4c0PT@4YkTEOt909+)!RY2bji_p2tc&ps zs)Y-`<6;+689bcMzQqTdLxqafMOBGz9EetDj*4y`h-%r%Y!@FfQor@@TW&Jfd;1Nw zH@Lf5Slq|`Y8NXEd-!q>t9$rrfMAy51x`W78JcSoDAGi#;sUip5i2xjEK12!Ou?q1 z;GvA4sY?~w1;S2-Y)ZV3Y6`N$V+|QTpb|_FFm)(LRsw=#(WdQ}~`vInvxB Iy9|E#2N@5JegFUf From 890eb94f322fb4d1642d4d67ec8f9a47a2d155fb Mon Sep 17 00:00:00 2001 From: Priyanka Ganti Date: Thu, 6 Jun 2013 11:55:50 -0700 Subject: [PATCH 3/3] Pool test suite with a few Priority tests 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. --- webdriver/java/AddPoolRaid0with0Disks.java | 96 +++++++++++++ webdriver/java/AddPoolRaid0with1Disk.java | 104 ++++++++++++++ webdriver/java/AddPoolRaid0with2Disks.java | 104 ++++++++++++++ webdriver/java/AddPoolRaid0with5Disks.java | 111 +++++++++++++++ webdriver/java/AddPoolRaid10with0Disks.java | 99 ++++++++++++++ webdriver/java/AddPoolRaid10with10Disks.java | 124 +++++++++++++++++ webdriver/java/AddPoolRaid10with3Disks.java | 108 +++++++++++++++ webdriver/java/AddPoolRaid10with4Disks.java | 106 +++++++++++++++ webdriver/java/AddPoolRaid1with0Disks.java | 93 +++++++++++++ webdriver/java/AddPoolRaid1with1Disk.java | 100 ++++++++++++++ webdriver/java/AddPoolRaid1with2Disks.java | 103 ++++++++++++++ webdriver/java/AddPoolRaid1with5Disks.java | 111 +++++++++++++++ webdriver/java/GenericDeletePool.java | 76 +++++++++++ webdriver/java/PoolResizeWith1Disk.java | 135 +++++++++++++++++++ webdriver/java/config.properties | 1 + 15 files changed, 1471 insertions(+) create mode 100644 webdriver/java/AddPoolRaid0with0Disks.java create mode 100644 webdriver/java/AddPoolRaid0with1Disk.java create mode 100644 webdriver/java/AddPoolRaid0with2Disks.java create mode 100644 webdriver/java/AddPoolRaid0with5Disks.java create mode 100644 webdriver/java/AddPoolRaid10with0Disks.java create mode 100644 webdriver/java/AddPoolRaid10with10Disks.java create mode 100644 webdriver/java/AddPoolRaid10with3Disks.java create mode 100644 webdriver/java/AddPoolRaid10with4Disks.java create mode 100644 webdriver/java/AddPoolRaid1with0Disks.java create mode 100644 webdriver/java/AddPoolRaid1with1Disk.java create mode 100644 webdriver/java/AddPoolRaid1with2Disks.java create mode 100644 webdriver/java/AddPoolRaid1with5Disks.java create mode 100644 webdriver/java/GenericDeletePool.java create mode 100644 webdriver/java/PoolResizeWith1Disk.java create mode 100644 webdriver/java/config.properties diff --git a/webdriver/java/AddPoolRaid0with0Disks.java b/webdriver/java/AddPoolRaid0with0Disks.java new file mode 100644 index 0000000..9861cfd --- /dev/null +++ b/webdriver/java/AddPoolRaid0with0Disks.java @@ -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(); + + } +} + + + + + + + + diff --git a/webdriver/java/AddPoolRaid0with1Disk.java b/webdriver/java/AddPoolRaid0with1Disk.java new file mode 100644 index 0000000..4dd7bd7 --- /dev/null +++ b/webdriver/java/AddPoolRaid0with1Disk.java @@ -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(); + + } +} + + + + + + + diff --git a/webdriver/java/AddPoolRaid0with2Disks.java b/webdriver/java/AddPoolRaid0with2Disks.java new file mode 100644 index 0000000..b76d1e2 --- /dev/null +++ b/webdriver/java/AddPoolRaid0with2Disks.java @@ -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(); + + } +} + + + + + + + + diff --git a/webdriver/java/AddPoolRaid0with5Disks.java b/webdriver/java/AddPoolRaid0with5Disks.java new file mode 100644 index 0000000..1514a15 --- /dev/null +++ b/webdriver/java/AddPoolRaid0with5Disks.java @@ -0,0 +1,111 @@ +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 AddPoolRaid0with5Disks { + + 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 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); + + //Select Disks CheckBox + WebElement diskCheckBox1 = driver.findElement(By.id("sdb")); + diskCheckBox1.click(); + WebElement diskCheckBox2 = driver.findElement(By.id("sdc")); + diskCheckBox2.click(); + WebElement diskCheckBox3 = driver.findElement(By.id("sdd")); + diskCheckBox3.click(); + WebElement diskCheckBox4 = driver.findElement(By.id("sde")); + diskCheckBox4.click(); + WebElement diskCheckBox5 = driver.findElement(By.id("sdf")); + diskCheckBox5.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_Raid05Disks.png")); + + } + + //click on logout + WebElement logoutSubmit = driver.findElement(By.id("logout_user")); + + logoutSubmit.click(); + + } +} + + + + + + + + + diff --git a/webdriver/java/AddPoolRaid10with0Disks.java b/webdriver/java/AddPoolRaid10with0Disks.java new file mode 100644 index 0000000..204056a --- /dev/null +++ b/webdriver/java/AddPoolRaid10with0Disks.java @@ -0,0 +1,99 @@ +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 AddPoolRaid10with0Disks { + + 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 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(2); + + //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/Raid10with0DiskPool.png")); + + } + + //click on logout + WebElement logoutSubmit = driver.findElement(By.id("logout_user")); + + logoutSubmit.click(); + + } +} + + + + + + + + diff --git a/webdriver/java/AddPoolRaid10with10Disks.java b/webdriver/java/AddPoolRaid10with10Disks.java new file mode 100644 index 0000000..96c2acc --- /dev/null +++ b/webdriver/java/AddPoolRaid10with10Disks.java @@ -0,0 +1,124 @@ +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 AddPoolRaid10with10Disks { + + 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 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(2); + + //Select Disks CheckBox + WebElement diskCheckBox1 = driver.findElement(By.id("sdb")); + diskCheckBox1.click(); + WebElement diskCheckBox2 = driver.findElement(By.id("sdc")); + diskCheckBox2.click(); + WebElement diskCheckBox3 = driver.findElement(By.id("sdd")); + diskCheckBox3.click(); + WebElement diskCheckBox4 = driver.findElement(By.id("sde")); + diskCheckBox4.click(); + WebElement diskCheckBox5 = driver.findElement(By.id("sdf")); + diskCheckBox5.click(); + WebElement diskCheckBox6 = driver.findElement(By.id("sdg")); + diskCheckBox6.click(); + WebElement diskCheckBox7 = driver.findElement(By.id("sdh")); + diskCheckBox7.click(); + WebElement diskCheckBox8 = driver.findElement(By.id("sdi")); + diskCheckBox8.click(); + WebElement diskCheckBox9 = driver.findElement(By.id("sdj")); + diskCheckBox9.click(); + WebElement diskCheckBox10 = driver.findElement(By.id("sdk")); + diskCheckBox10.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_Raid104Disks.png")); + + } + + //click on logout + WebElement logoutSubmit = driver.findElement(By.id("logout_user")); + + logoutSubmit.click(); + + } +} + + + + + + + + + + + diff --git a/webdriver/java/AddPoolRaid10with3Disks.java b/webdriver/java/AddPoolRaid10with3Disks.java new file mode 100644 index 0000000..918068f --- /dev/null +++ b/webdriver/java/AddPoolRaid10with3Disks.java @@ -0,0 +1,108 @@ +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 AddPoolRaid10with3Disks { + + 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 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(2); + + //Select Disks CheckBox + WebElement diskCheckBox1 = driver.findElement(By.id("sdb")); + diskCheckBox1.click(); + WebElement diskCheckBox2 = driver.findElement(By.id("sdc")); + diskCheckBox2.click(); + WebElement diskCheckBox3 = driver.findElement(By.id("sde")); + diskCheckBox3.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_Raid10With3Disks.png")); + + } + + //click on logout + WebElement logoutSubmit = driver.findElement(By.id("logout_user")); + + logoutSubmit.click(); + + } +} + + + + + + + + + diff --git a/webdriver/java/AddPoolRaid10with4Disks.java b/webdriver/java/AddPoolRaid10with4Disks.java new file mode 100644 index 0000000..957cf95 --- /dev/null +++ b/webdriver/java/AddPoolRaid10with4Disks.java @@ -0,0 +1,106 @@ +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 AddPoolRaid10with4Disks { + + 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 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(2); + + //Select Disks CheckBox + WebElement diskCheckBox1 = driver.findElement(By.id("sdb")); + diskCheckBox1.click(); + WebElement diskCheckBox2 = driver.findElement(By.id("sdc")); + diskCheckBox2.click(); + WebElement diskCheckBox3 = driver.findElement(By.id("sdd")); + diskCheckBox3.click(); + WebElement diskCheckBox4 = driver.findElement(By.id("sde")); + diskCheckBox4.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_Raid104Disks.png")); + + } + + //click on logout + WebElement logoutSubmit = driver.findElement(By.id("logout_user")); + + logoutSubmit.click(); + + } +} + + + + + + + + + diff --git a/webdriver/java/AddPoolRaid1with0Disks.java b/webdriver/java/AddPoolRaid1with0Disks.java new file mode 100644 index 0000000..0185055 --- /dev/null +++ b/webdriver/java/AddPoolRaid1with0Disks.java @@ -0,0 +1,93 @@ +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 AddPoolRaid1with0Disks { + + 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")); + + + // Uer 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 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(1); + + //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/Raid1with0DiskPool.png")); + + } + + //click on logout + WebElement logoutSubmit = driver.findElement(By.id("logout_user")); + + logoutSubmit.click(); + + } +} + + diff --git a/webdriver/java/AddPoolRaid1with1Disk.java b/webdriver/java/AddPoolRaid1with1Disk.java new file mode 100644 index 0000000..52e898e --- /dev/null +++ b/webdriver/java/AddPoolRaid1with1Disk.java @@ -0,0 +1,100 @@ +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 AddPoolRaid1with1Disk { + + 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 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(1); + + //Select Disks CheckBox + WebElement diskCheckBox1 = driver.findElement(By.id("sdb")); + diskCheckBox1.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/1DiskRaid1Pool.png")); + + } + + //click on logout + WebElement logoutSubmit = driver.findElement(By.id("logout_user")); + + logoutSubmit.click(); + + } +} + + + + + + + + diff --git a/webdriver/java/AddPoolRaid1with2Disks.java b/webdriver/java/AddPoolRaid1with2Disks.java new file mode 100644 index 0000000..f96f4e7 --- /dev/null +++ b/webdriver/java/AddPoolRaid1with2Disks.java @@ -0,0 +1,103 @@ +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 AddPoolRaid1with2Disks { + + 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 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(1); + + //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, 30)) + .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_Raid12Disks.png")); + + } + + //click on logout + WebElement logoutSubmit = driver.findElement(By.id("logout_user")); + + logoutSubmit.click(); + + } +} + + + + + + + + diff --git a/webdriver/java/AddPoolRaid1with5Disks.java b/webdriver/java/AddPoolRaid1with5Disks.java new file mode 100644 index 0000000..e7eb3b9 --- /dev/null +++ b/webdriver/java/AddPoolRaid1with5Disks.java @@ -0,0 +1,111 @@ +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 AddPoolRaid1with5Disks { + + 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 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(1); + + //Select Disks CheckBox + WebElement diskCheckBox1 = driver.findElement(By.id("sdb")); + diskCheckBox1.click(); + WebElement diskCheckBox2 = driver.findElement(By.id("sdc")); + diskCheckBox2.click(); + WebElement diskCheckBox3 = driver.findElement(By.id("sdd")); + diskCheckBox3.click(); + WebElement diskCheckBox4 = driver.findElement(By.id("sde")); + diskCheckBox4.click(); + WebElement diskCheckBox5 = driver.findElement(By.id("sdf")); + diskCheckBox5.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_Raid15Disks.png")); + + } + + //click on logout + WebElement logoutSubmit = driver.findElement(By.id("logout_user")); + + logoutSubmit.click(); + + } +} + + + + + + + + + diff --git a/webdriver/java/GenericDeletePool.java b/webdriver/java/GenericDeletePool.java new file mode 100644 index 0000000..ea28032 --- /dev/null +++ b/webdriver/java/GenericDeletePool.java @@ -0,0 +1,76 @@ +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 GenericDeletePool{ + + 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("delete_pool_pool1"))); + + //Delete Pool + WebElement deletePool = driver.findElement(By.id("delete_pool_pool1")); + deletePool.click(); + + //Wait until the normal pool page loads + WebElement myWaitElement2 = (new WebDriverWait(driver, 10)) + .until(ExpectedConditions.elementToBeClickable(By.id("create_pool"))); + } + + + //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/DelPool_Raid02Disks.png")); + + } + + //click on logout + WebElement logoutSubmit = driver.findElement(By.id("logout_user")); + + logoutSubmit.click(); + + } +} + + diff --git a/webdriver/java/PoolResizeWith1Disk.java b/webdriver/java/PoolResizeWith1Disk.java new file mode 100644 index 0000000..7d18f7c --- /dev/null +++ b/webdriver/java/PoolResizeWith1Disk.java @@ -0,0 +1,135 @@ +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 PoolResizeWith1Disk { + + 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 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); + + //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"))); + + WebElement poolLink = driver.findElement(By.linkText("pool1")); + poolLink.click(); + + + WebElement myWaitElement4 = (new WebDriverWait(driver, 10)) + .until(ExpectedConditions.elementToBeClickable(By.id("resize-pool-popup"))); + + WebElement resizeButton = driver.findElement(By.id("resize-pool-popup")); + resizeButton.click(); + + + WebElement myWaitElement5 = (new WebDriverWait(driver, 10)) + .until(ExpectedConditions.elementToBeClickable(By.id("disks-table"))); + + + WebElement resizeSubmitButton = driver.findElement(By.id("resize-pool")); + resizeSubmitButton.click(); + + WebElement myWaitElement6 = (new WebDriverWait(driver, 10)) + .until(ExpectedConditions.elementToBeClickable(By.id("resize-pool-popup"))); + + WebElement disksNav = driver.findElement(By.id("disks_nav")); + disksNav.click(); + + WebElement myWaitElement7 = (new WebDriverWait(driver, 10)) + .until(ExpectedConditions.elementToBeClickable(By.id("disks-table"))); + + File screenshotFile = ((TakesScreenshot)driver).getScreenshotAs(OutputType.FILE); + FileUtils.copyFile(screenshotFile,new File("/home/priya/rockstor-tests/webdriver/java/ScreenShots/PoolsResize_DisksPage.png")); + + } + //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/PoolResize_0Disks.png")); + + } + + //click on logout + WebElement logoutSubmit = driver.findElement(By.id("logout_user")); + + logoutSubmit.click(); + + } +} + + + + + + + + + diff --git a/webdriver/java/config.properties b/webdriver/java/config.properties new file mode 100644 index 0000000..2dfb2ad --- /dev/null +++ b/webdriver/java/config.properties @@ -0,0 +1 @@ +RockstorVm=https\://sujeetsr.com