diff --git a/tests/selenium/Amber-BR2 b/tests/selenium/Amber-BR2 new file mode 100644 index 0000000..05cd9db --- /dev/null +++ b/tests/selenium/Amber-BR2 @@ -0,0 +1,86 @@ + + + + + + +Amber-BR2 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Amber-BR2
open/PHP-Reference-Gateway/create_experiment.php
clicklink=Experiment
clickAndWaitid=create-experiment
typeid=experiment-nameTest Amber Experiment BR2
typeid=experiment-descriptionTest Experiment
selectid=projectlabel=September/12/2014
selectid=applicationlabel=Amber
clickAndWaitname=continue
typeid=Heat_Restart_File/Users/airavata/Downloads/XSEDE-Job-Scripts-master/Stampede/Amber/02_Heat.rst
typeid=Parameter_Topology_File/Users/airavata/Downloads/XSEDE-Job-Scripts-master/Stampede/Amber/prmtop
typeid=Production_Control_File/Users/airavata/Downloads/XSEDE-Job-Scripts-master/Stampede/Amber/03_Prod.in
selectid=compute-resourcelabel=bigred2.uits.iu.edu
clickAndWaitname=save
clickAndWaitname=launch
+ + diff --git a/tests/selenium/Amber-Stam b/tests/selenium/Amber-Stam new file mode 100644 index 0000000..9a215d7 --- /dev/null +++ b/tests/selenium/Amber-Stam @@ -0,0 +1,81 @@ + + + + + + +Amber-Stam + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Amber-Stam
open/PHP-Reference-Gateway/project_summary.php?projId=September/10th/2014_8c3fc77b-9df1-4b8e-9f4c-94748247801d
clicklink=Project
clicklink=Experiment
clickAndWaitid=create-experiment
typeid=experiment-nameTest Amber Experiment Stampede
typeid=experiment-descriptionTest Experiment
selectid=projectlabel=September/12/2014
selectid=applicationlabel=Amber
clickAndWaitname=continue
typeid=Heat_Restart_File/Users/airavata/Downloads/XSEDE-Job-Scripts-master/Stampede/Amber/02_Heat.rst
typeid=Parameter_Topology_File/Users/airavata/Downloads/XSEDE-Job-Scripts-master/Stampede/Amber/prmtop
typeid=Production_Control_File/Users/airavata/Downloads/XSEDE-Job-Scripts-master/Stampede/Amber/03_Prod.in
clickAndWaitname=launch
+ + diff --git a/tests/selenium/Amber-Trest b/tests/selenium/Amber-Trest new file mode 100644 index 0000000..3f02fb8 --- /dev/null +++ b/tests/selenium/Amber-Trest @@ -0,0 +1,86 @@ + + + + + + +Amber-Trest + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Amber-Trest
open/PHP-Reference-Gateway/experiment_summary.php?expId=TestAmberExperimentStampede_823fd187-f7c4-4a8d-a1bf-2e0d4c41fb38
clicklink=Experiment
clickAndWaitid=create-experiment
typeid=experiment-nameTest Amber Experiment Trestles
typeid=experiment-descriptionTest Experiment
selectid=projectlabel=September/12/2014
selectid=applicationlabel=Amber
clickAndWaitname=continue
typeid=Heat_Restart_File/Users/airavata/Downloads/XSEDE-Job-Scripts-master/Stampede/Amber/02_Heat.rst
typeid=Parameter_Topology_File/Users/airavata/Downloads/XSEDE-Job-Scripts-master/Stampede/Amber/prmtop
typeid=Production_Control_File/Users/airavata/Downloads/XSEDE-Job-Scripts-master/Stampede/Amber/03_Prod.in
selectid=compute-resourcelabel=trestles.sdsc.xsede.org
clickAndWaitname=save
clickAndWaitname=launch
+ + diff --git a/tests/selenium/CreateLogin&Logon b/tests/selenium/CreateLogin&Logon new file mode 100644 index 0000000..63909f7 --- /dev/null +++ b/tests/selenium/CreateLogin&Logon @@ -0,0 +1,121 @@ + + + + + + +Create Login & Logon + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Create Login & Logon
open/PHP-Reference-Gateway/index.php
clickAndWaitlink=Create account
typeid=usernameBunny
typeid=passwordbun123
typeid=confirm_passwordbun123
typeid=emailbunny123
typeid=first_nameBunny
typeid=last_nameMcDonalds
typeid=organizationIU
typeid=addressIU CIB Building
typeid=countryUSA
typeid=telephone-
typeid=mobile-
typeid=im-
typeid=url-
clickname=Submit
typeid=emailbunny123@gmail.com
clickAndWaitname=Submit
typename=usernameFanny
typename=passwordfan123
clickAndWaitname=Submit
+ + diff --git a/tests/selenium/CreateModifySearchProject b/tests/selenium/CreateModifySearchProject new file mode 100644 index 0000000..c96b541 --- /dev/null +++ b/tests/selenium/CreateModifySearchProject @@ -0,0 +1,86 @@ + + + + + + +Create, Modify, Search Project + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Create, Modify, Search Project
open/PHP-Reference-Gateway/project_summary.php?projId=September/09/2014_6da747b3-6164-4c5a-a12e-5eeb4de1df36
clicklink=Project
clickAndWaitid=create-project
typeid=project-nameSeptember/12/2014
typeid=project-descriptionTest Project
clickAndWaitname=save
clickAndWaitcss=span.glyphicon.glyphicon-pencil
typeid=project-descriptionTest Project 2014
clickAndWaitname=save
clicklink=Project
clickAndWaitid=search-projects
typeid=search-valueSeptember/12
clickAndWaitname=search
clickAndWaitlink=View
+ + diff --git a/tests/selenium/Echo Tests b/tests/selenium/Echo Tests new file mode 100644 index 0000000..d9f5873 --- /dev/null +++ b/tests/selenium/Echo Tests @@ -0,0 +1,28 @@ + + + + + + Test Suite + + + + + + + + + + + + + + + + + + + +
Test Suite
Create Login & Logon
Create, Modify, Search Project
Amber-BR2
Amber-Stam
Amber-Trest
Echo-BR2
Echo-Stam
Echo-Trest
Espresso-Stam
Gromacs-Stam:Trest
LAMMPS-Stam:Trest
NwChem-Stam
Trinity-Stam
WRF-Stam
Search Project & Exp
+ + diff --git a/tests/selenium/Echo-BR2 b/tests/selenium/Echo-BR2 new file mode 100644 index 0000000..32d3ad8 --- /dev/null +++ b/tests/selenium/Echo-BR2 @@ -0,0 +1,81 @@ + + + + + + +Echo Exp BR2 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Echo Exp BR2
open/PHP-Reference-Gateway/index.php
clicklink=Experiment
clickAndWaitid=create-experiment
typeid=experiment-nameTest Echo Experiment BR2
typeid=experiment-descriptionTest Experiment
selectid=projectlabel=September/12/2014
selectid=applicationlabel=Echo
clickAndWaitname=continue
typeid=Input_to_EchoEcho Test
selectid=compute-resourcelabel=bigred2.uits.iu.edu
typeid=node-count2
clickAndWaitname=save
clickAndWaitname=launch
+ + diff --git a/tests/selenium/Echo-Stam b/tests/selenium/Echo-Stam new file mode 100644 index 0000000..444dff2 --- /dev/null +++ b/tests/selenium/Echo-Stam @@ -0,0 +1,76 @@ + + + + + + +Echo-Stampede + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Echo-Stampede
open/PHP-Reference-Gateway/search_experiments.php
clicklink=Experiment
clickAndWaitid=create-experiment
typeid=experiment-nameTest Echo Experiment Stampede
typeid=experiment-descriptionTest Experiment
selectid=projectlabel=September/12/2014
selectid=applicationlabel=Echo
clickAndWaitname=continue
typeid=Input_to_EchoEcho Test
typeid=node-count2
clickAndWaitname=save
clickAndWaitname=launch
+ + diff --git a/tests/selenium/Echo-Trest b/tests/selenium/Echo-Trest new file mode 100644 index 0000000..db61d62 --- /dev/null +++ b/tests/selenium/Echo-Trest @@ -0,0 +1,71 @@ + + + + + + +Echo-Trest + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Echo-Trest
open/PHP-Reference-Gateway/project_summary.php?projId=September/10th/2014_8c3fc77b-9df1-4b8e-9f4c-94748247801d
clicklink=Experiment
clickAndWaitid=create-experiment
typeid=experiment-nameTest Echo Experiment Trestles
typeid=experiment-descriptionTest Experiment
selectid=projectlabel=September/12/2014
selectid=applicationlabel=Echo
clickAndWaitname=continue
typeid=Input_to_EchoTest Echo
selectid=compute-resourcelabel=trestles.sdsc.xsede.org
clickAndWaitname=launch
+ + diff --git a/tests/selenium/Espresso-Stam b/tests/selenium/Espresso-Stam new file mode 100644 index 0000000..d939586 --- /dev/null +++ b/tests/selenium/Espresso-Stam @@ -0,0 +1,91 @@ + + + + + + +Espresso-Stam + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Espresso-Stam
open/PHP-Reference-Gateway/project_summary.php?projId=September/10th/2014_8c3fc77b-9df1-4b8e-9f4c-94748247801d
clicklink=Experiment
clickAndWaitid=create-experiment
typeid=experiment-nameTest Espresso Experiment Stampede
typeid=experiment-descriptionTest Experiment
selectid=projectlabel=September/12/2014
selectid=applicationlabel=ESPRESSO
clickAndWaitname=continue
typeid=AI_Primitive_Cell/Users/airavata/Downloads/XSEDE-Job-Scripts-master/Stampede/ESPRESSO/Al.sample.in
typeid=AI_Pseudopotential_File/Users/airavata/Downloads/XSEDE-Job-Scripts-master/Stampede/ESPRESSO/Al.pz-vbc.UPF
typeid=node-count2
typeid=cpu-count5
typeid=wall-time31
clickAndWaitname=save
clickAndWaitname=launch
+ + diff --git a/tests/selenium/Gromacs-Stam:Trest b/tests/selenium/Gromacs-Stam:Trest new file mode 100644 index 0000000..d3be5e7 --- /dev/null +++ b/tests/selenium/Gromacs-Stam:Trest @@ -0,0 +1,126 @@ + + + + + + +GROMACS-Stam/Trest + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
GROMACS-Stam/Trest
open/PHP-Reference-Gateway/create_experiment.php
clicklink=Experiment
clickAndWaitid=create-experiment
typeid=experiment-nameTest GROMMACS Experiment Stampede
typeid=experiment-descriptionTest Experiment
selectid=projectlabel=September/12/2014
selectid=applicationlabel=GROMACS
clickAndWaitname=continue
typeid=GROMOS_Coordinate_File/Users/airavata/Downloads/XSEDE-Job-Scripts-master/Stampede/GROMACS/pdb1y6l.gro
typeid=Portable_Input_Binary_File/Users/airavata/Downloads/XSEDE-Job-Scripts-master/Stampede/GROMACS/pdb1y6l-EM-vacuum.tpr
typeid=node-count2
typeid=cpu-count5
typeid=wall-time31
clickAndWaitname=save
clickAndWaitname=launch
clickAndWaitname=clone
typeid=experiment-nameTest GROMMACS Experiment Trestles
typeid=experiment-descriptionTest Experiment Cloned
selectid=compute-resourcelabel=trestles.sdsc.xsede.org
clickAndWaitname=save
clickAndWaitlink=here
clickAndWaitname=launch
+ + diff --git a/tests/selenium/LAMMPS-Stam:Trest b/tests/selenium/LAMMPS-Stam:Trest new file mode 100644 index 0000000..12a0a89 --- /dev/null +++ b/tests/selenium/LAMMPS-Stam:Trest @@ -0,0 +1,116 @@ + + + + + + +LAMMPS -Stam/Trest + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
LAMMPS -Stam/Trest
open/PHP-Reference-Gateway/create_experiment.php
clicklink=Experiment
clickAndWaitid=create-experiment
typeid=experiment-nameTest LAMMPS Experiment Stampede
typeid=experiment-descriptionTest Experiment
selectid=projectlabel=September/12/2014
selectid=applicationlabel=LAMMPS
clickAndWaitname=continue
typeid=Friction_Simulation_Input/Users/airavata/Downloads/XSEDE-Job-Scripts-master/Stampede/LAMMPS/in.friction
typeid=node-count2
typeid=cpu-count5
typeid=wall-time31
clickAndWaitname=save
clickAndWaitname=launch
clickAndWaitname=clone
typeid=experiment-nameTest LAMMPS Experiment Trestles
typeid=experiment-descriptionTest Experiment Cloned
typeid=Friction_Simulation_Input/Users/airavata/Downloads/XSEDE-Job-Scripts-master/Stampede/LAMMPS/in.friction
selectid=compute-resourcelabel=trestles.sdsc.xsede.org
clickAndWaitname=launch
+ + diff --git a/tests/selenium/NewProjectSearch b/tests/selenium/NewProjectSearch new file mode 100644 index 0000000..3b4975c --- /dev/null +++ b/tests/selenium/NewProjectSearch @@ -0,0 +1,142 @@ + + + + + + +CreateModifySearchProject + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
CreateModifySearchProject
open/PHP-Reference-Gateway/index.php
clicklink=Project
clickAndWaitid=create-project
verifyTitlePHP Reference Gateway
verifyTextcss=labelProject Name
verifyText//div[2]/labelProject Description
clickname=save
clickname=save
verifyValuename=saveSave
verifyValuename=clearClear
typeid=project-nameSeptember/04/2014
typeid=project-descriptionTest Recording for Selenium.
clickAndWaitname=save
verifyTextcss=h1Project Summary
verifyTextcss=h3September/04/2014
clickAndWaitcss=span.glyphicon.glyphicon-pencil
typeid=project-descriptionTest Recording for Selenium 2014
typeid=project-nameSep/04/2014
clickAndWaitname=save
clickAndWaitlink=here
clicklink=Project
clickAndWaitid=search-projects
typeid=search-valuesep/
clickAndWaitname=search
clickAndWaitlink=View
+ + diff --git a/tests/selenium/NwChem-Stam b/tests/selenium/NwChem-Stam new file mode 100644 index 0000000..ee22f05 --- /dev/null +++ b/tests/selenium/NwChem-Stam @@ -0,0 +1,81 @@ + + + + + + +NeChem-Stam + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NeChem-Stam
open/PHP-Reference-Gateway/create_experiment.php
clicklink=Experiment
clickAndWaitid=create-experiment
typeid=experiment-nameTest NwChem Experiment Stampede
typeid=experiment-descriptionTest Experiment
selectid=projectlabel=September/12/2014
selectid=applicationlabel=NWChem
clickAndWaitname=continue
typeid=Water_Molecule_Input/Users/airavata/Downloads/XSEDE-Job-Scripts-master/Stampede/NWCHEM/water.nw
typeid=node-count2
typeid=cpu-count5
typeid=wall-time31
clickAndWaitname=launch
+ + diff --git a/tests/selenium/README.txt b/tests/selenium/README.txt new file mode 100644 index 0000000..bd3fb62 --- /dev/null +++ b/tests/selenium/README.txt @@ -0,0 +1,25 @@ +README: Useful Info on Selenium +NOTE: The scripts are work-in-progress but can be used. +I will upload as and when i improve them. Please feel free to improve the existing and also to add any new scripts. + +Selenium is a Firefox plugin which is to record and playback. +This is useful to run the daily application tests on compute resources. + +1. Download the plugin from http://www.seleniumhq.org/download/ +2. Then its just a matter of recording the tests on PHP gateway. + Tip: same set of scripts can be executed in different environments; just need to change the base URL in selenium. + Currently there is a user support section in the selenium site at; + http://www.seleniumhq.org/support/ +3. To run existing scripts; + i.Take a copy to your local machine and load all the scripts in to Selenium UI. + ii. Open script ‘Create Login & Logon’ give your own user information in the script before executing the script. + iii. Open script ‘Create, Modify, Search Project’ and change the Project name to your own + iv. In all other scripts give your created project name as the project label. + v. In scripts where file uploading is required please give your own file location (where you have input files in your machine) + vi. You can execute all scripts together as a test suite OR can select and run individuals. +4. My wishlist + i. The existing scripts needs to be updated every time we need to create a new project and experiments under the newly created project. if we could change the script to create the projects giving the sysdate and the experiment to use sysdate as the project name we don't need to change the scripts every time we run them + ii. Have set of scripts to do load testing through the gateway. If we could link the scripts with a excel sheet which has input data and the script to pick and create experiments; we can have the load testing automated + iii. Test script to send out notification emails when they fail, so we don't need to keep looking at th scripts. + iv. Scripts to read input parameters from a excel file/external file + v. Scripts to monitor experiment status and fail if status is other than COMPLETE diff --git a/tests/selenium/SearchProject&Exp b/tests/selenium/SearchProject&Exp new file mode 100644 index 0000000..1c84e77 --- /dev/null +++ b/tests/selenium/SearchProject&Exp @@ -0,0 +1,46 @@ + + + + + + +Search Project + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Search Project
open/PHP-Reference-Gateway/experiment_summary.php?expId=TestEchoExperimentStampede_01dac1ab-7aa4-4933-959b-2ca4838be480
clicklink=Project
clickAndWaitid=search-projects
typeid=search-valueSeptember/12/2014
clickAndWaitname=search
clickAndWaitlink=View
+ + diff --git a/tests/selenium/Trinity-Stam b/tests/selenium/Trinity-Stam new file mode 100644 index 0000000..98370a9 --- /dev/null +++ b/tests/selenium/Trinity-Stam @@ -0,0 +1,91 @@ + + + + + + +Trinity-Stam + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Trinity-Stam
open/PHP-Reference-Gateway/create_experiment.php
clicklink=Experiment
clickAndWaitid=create-experiment
typeid=experiment-nameTest Trinity Experiment Stampede
typeid=experiment-descriptionTest Experiment
selectid=projectlabel=September/12/2014
selectid=applicationlabel=Trinity
clickAndWaitname=continue
typeid=RNA_Seq_Left_Input/Users/airavata/Downloads/XSEDE-Job-Scripts-master/Stampede/Trinity/reads.left.fq
typeid=RNA_Seq_Right_Input/Users/airavata/Downloads/XSEDE-Job-Scripts-master/Stampede/Trinity/reads.right.fq
typeid=node-count2
typeid=cpu-count5
typeid=wall-time31
clickAndWaitname=save
clickAndWaitname=launch
+ + diff --git a/tests/selenium/WRF-Stam b/tests/selenium/WRF-Stam new file mode 100644 index 0000000..5dfe6f1 --- /dev/null +++ b/tests/selenium/WRF-Stam @@ -0,0 +1,76 @@ + + + + + + +WRF-Stam + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
WRF-Stam
open/PHP-Reference-Gateway/project_summary.php?projId=September/10/2014_84abfa67-7709-41d0-b4fa-767a8f93fa36
clicklink=Experiment
clickAndWaitid=create-experiment
typeid=experiment-nameTest WRF Experiment Stampede
typeid=experiment-descriptionTest Experiment
selectid=projectlabel=September/12/2014
clickAndWaitname=continue
typeid=Config_Namelist_File/Users/airavata/Downloads/XSEDE-Job-Scripts-master/Stampede/WRF/namelist.input
typeid=WRF_Boundary_File/Users/airavata/Downloads/XSEDE-Job-Scripts-master/Stampede/WRF/wrfbdy_d01
typeid=WRF_Initial_Conditions/Users/airavata/Downloads/XSEDE-Job-Scripts-master/Stampede/WRF/wrfinput_d01
clickAndWaitname=save
clickAndWaitname=launch
+ + diff --git a/tests/seleniumjava/PHPAiravataTest/pom.xml b/tests/seleniumjava/PHPAiravataTest/pom.xml new file mode 100644 index 0000000..0de5d3a --- /dev/null +++ b/tests/seleniumjava/PHPAiravataTest/pom.xml @@ -0,0 +1,134 @@ + + 4.0.0 + com.example.tests + PGATest + jar + 1.0-SNAPSHOT + PGATest + + + + org.apache.maven.plugins + maven-compiler-plugin + + 1.5 + 1.5 + + + + org.apache.maven.plugins + maven-surefire-plugin + + true + + + user + tobrien + + + name + Tim O'Brien + + + + + + + + + org.codehaus.mojo + selenium-maven-plugin + + + pre-integration-test + + start-server + + + true + + + + + + + + + org.testng + testng + 5.10 + jdk15 + test + + + org.seleniumhq.selenium.client-drivers + selenium-java-client-driver + 1.0.1 + test + + + org.seleniumhq.selenium + selenium-firefox-driver + 2.44.0 + + + + org.apache.httpcomponents + httpclient + 4.3.5 + + + org.apache.httpcomponents + httpcore + 4.3.2 + + + commons-io + commons-io + 2.4 + + + org.apache.commons + commons-exec + 1.1 + + + commons-logging + commons-logging + 1.1.3 + + + com.google.guava + guava + 18.0 + + + org.seleniumhq.selenium + selenium-remote-driver + 2.44.0 + + + + org.seleniumhq.selenium + selenium-java + 2.44.0 + + + junit + junit + 4.8.2 + test + + + diff --git a/tests/seleniumjava/PHPAiravataTest/src/test/java/com/example/tests/UserLogin.java b/tests/seleniumjava/PHPAiravataTest/src/test/java/com/example/tests/UserLogin.java new file mode 100644 index 0000000..3c5654e --- /dev/null +++ b/tests/seleniumjava/PHPAiravataTest/src/test/java/com/example/tests/UserLogin.java @@ -0,0 +1,36 @@ +package com.example.tests; + +import org.openqa.selenium.By; +import org.openqa.selenium.WebDriver; + +/* + **********User Login to PHP-Reference-Gateway********** + * Created by Eroma on 9/12/14. + * User Login in to PHP-Reference-Gateway. This class is called by all other test classes to login into the gateway. + * Enter your Username & Pwd in this script +*/ + +public abstract class UserLogin { + + public void authenticate(WebDriver driver){ + driver.findElement(By.linkText("Log in")).click(); + waitTime (500); + driver.findElement(By.name("username")).clear(); + waitTime (500); + driver.findElement(By.name("username")).sendKeys("admin101");//admin101 + waitTime (500); + driver.findElement(By.name("password")).sendKeys("uitsadmin");//uitsadmin + waitTime (500); + driver.findElement(By.name("Submit")).click(); + + } + + private void waitTime(int i) { + try { + Thread.sleep(i); + } catch (InterruptedException e) { + e.printStackTrace(); + } + + } +} diff --git a/tests/seleniumjava/PHPAiravataTest/src/test/java/com/example/tests/appcatalog/example/tests/AddAppDeployment.java b/tests/seleniumjava/PHPAiravataTest/src/test/java/com/example/tests/appcatalog/example/tests/AddAppDeployment.java new file mode 100644 index 0000000..8808096 --- /dev/null +++ b/tests/seleniumjava/PHPAiravataTest/src/test/java/com/example/tests/appcatalog/example/tests/AddAppDeployment.java @@ -0,0 +1,106 @@ +package com.example.tests; + +import java.util.regex.Pattern; +import java.util.concurrent.TimeUnit; + +import com.example.tests.utils.ExpFileReadUtils; +import org.junit.*; +import static org.junit.Assert.*; +import static org.hamcrest.CoreMatchers.*; +import org.openqa.selenium.*; +import org.openqa.selenium.firefox.FirefoxDriver; +import org.openqa.selenium.support.ui.Select; + +public class AddAppDeployment extends UserLogin { + private WebDriver driver; + private String subUrl; + private String baseUrl; + private boolean acceptNextAlert = true; + private StringBuffer verificationErrors = new StringBuffer(); + + @Before + public void setUp() throws Exception { + driver = new FirefoxDriver(); + baseUrl = ExpFileReadUtils.readProperty("base.url"); + subUrl = ExpFileReadUtils.readProperty("sub.url"); + driver.manage().timeouts().implicitlyWait(30, TimeUnit.SECONDS); + + } + + @Test + public void testAddAppDeployment() throws Exception { + driver.get(baseUrl + subUrl); + authenticate(driver); + driver.findElement(By.linkText("App Catalog")).click(); + driver.findElement(By.id("deployment")).click(); + driver.findElement(By.xpath("//div/div/div/button")).click(); + new Select(driver.findElement(By.cssSelector("div.create-app-deployment-block > div.form-group.required > select[name=\"appModuleId\"]"))).selectByVisibleText("TEST_APP2014-12-11T03:08:10"); + new Select(driver.findElement(By.cssSelector("div.create-app-deployment-block > div.form-group.required > select[name=\"computeHostId\"]"))).selectByVisibleText("TEST_COMP_RES_2014-12-09T15:17:38"); + driver.findElement(By.cssSelector("div.create-app-deployment-block > div.form-group.required > input[name=\"executablePath\"]")).clear(); + driver.findElement(By.cssSelector("div.create-app-deployment-block > div.form-group.required > input[name=\"executablePath\"]")).sendKeys("TEST/LOCAL/BIN/"); + new Select(driver.findElement(By.cssSelector("div.create-app-deployment-block > div.form-group.required > select[name=\"parallelism\"]"))).selectByVisibleText("MPI"); + driver.findElement(By.cssSelector("div.create-app-deployment-block > div.form-group > textarea[name=\"appDeploymentDescription\"]")).clear(); + driver.findElement(By.cssSelector("div.create-app-deployment-block > div.form-group > textarea[name=\"appDeploymentDescription\"]")).sendKeys("TEST_APPLICATION_DEPLOYMENT"); + driver.findElement(By.xpath("(//button[@type='add-load-cmd'])[338]")).click(); + driver.findElement(By.cssSelector("div.create-app-deployment-block > div.form-group > div.show-load-cmds > input[name=\"moduleLoadCmds[]\"]")).clear(); + driver.findElement(By.cssSelector("div.create-app-deployment-block > div.form-group > div.show-load-cmds > input[name=\"moduleLoadCmds[]\"]")).sendKeys("LOAD_CMD"); + driver.findElement(By.xpath("(//button[@type='button'])[339]")).click(); + driver.findElement(By.cssSelector("div.create-app-deployment-block > div.form-group > div.show-lib-prepend-paths > div.col-md-12.well > input[name=\"libraryPrependPathName[]\"]")).clear(); + driver.findElement(By.cssSelector("div.create-app-deployment-block > div.form-group > div.show-lib-prepend-paths > div.col-md-12.well > input[name=\"libraryPrependPathName[]\"]")).sendKeys("APP"); + driver.findElement(By.cssSelector("div.create-app-deployment-block > div.form-group > div.show-lib-prepend-paths > div.col-md-12.well > input[name=\"libraryPrependPathValue[]\"]")).clear(); + driver.findElement(By.cssSelector("div.create-app-deployment-block > div.form-group > div.show-lib-prepend-paths > div.col-md-12.well > input[name=\"libraryPrependPathValue[]\"]")).sendKeys("MAIN"); + driver.findElement(By.xpath("(//button[@type='button'])[340]")).click(); + driver.findElement(By.cssSelector("div.create-app-deployment-block > div.form-group > div.show-lib-append-paths > div.col-md-12.well > input[name=\"libraryAppendPathName[]\"]")).clear(); + driver.findElement(By.cssSelector("div.create-app-deployment-block > div.form-group > div.show-lib-append-paths > div.col-md-12.well > input[name=\"libraryAppendPathName[]\"]")).sendKeys("PREP"); + driver.findElement(By.cssSelector("div.create-app-deployment-block > div.form-group > div.show-lib-append-paths > div.col-md-12.well > input[name=\"libraryAppendPathValue[]\"]")).clear(); + driver.findElement(By.cssSelector("div.create-app-deployment-block > div.form-group > div.show-lib-append-paths > div.col-md-12.well > input[name=\"libraryAppendPathValue[]\"]")).sendKeys("SECOND"); + driver.findElement(By.xpath("(//button[@type='button'])[341]")).click(); + driver.findElement(By.cssSelector("div.create-app-deployment-block > div.form-group > div.show-environments > div.col-md-12.well > input[name=\"environmentName[]\"]")).clear(); + driver.findElement(By.cssSelector("div.create-app-deployment-block > div.form-group > div.show-environments > div.col-md-12.well > input[name=\"environmentName[]\"]")).sendKeys("TEST_ENV"); + driver.findElement(By.cssSelector("div.create-app-deployment-block > div.form-group > div.show-environments > div.col-md-12.well > input[name=\"environmentValue[]\"]")).clear(); + driver.findElement(By.cssSelector("div.create-app-deployment-block > div.form-group > div.show-environments > div.col-md-12.well > input[name=\"environmentValue[]\"]")).sendKeys("TEST_ENV"); + driver.findElement(By.cssSelector("#create-app-deployment-block > div.modal-dialog > form > div.modal-content > div.modal-footer > div.form-group > input.btn.btn-primary")).click(); + } + + @After + public void tearDown() throws Exception { + driver.quit(); + String verificationErrorString = verificationErrors.toString(); + if (!"".equals(verificationErrorString)) { + fail(verificationErrorString); + } + } + + private boolean isElementPresent(By by) { + try { + driver.findElement(by); + return true; + } catch (NoSuchElementException e) { + return false; + } + } + + private boolean isAlertPresent() { + try { + driver.switchTo().alert(); + return true; + } catch (NoAlertPresentException e) { + return false; + } + } + + private String closeAlertAndGetItsText() { + try { + Alert alert = driver.switchTo().alert(); + String alertText = alert.getText(); + if (acceptNextAlert) { + alert.accept(); + } else { + alert.dismiss(); + } + return alertText; + } finally { + acceptNextAlert = true; + } + } +} diff --git a/tests/seleniumjava/PHPAiravataTest/src/test/java/com/example/tests/appcatalog/example/tests/AddAppModule.java b/tests/seleniumjava/PHPAiravataTest/src/test/java/com/example/tests/appcatalog/example/tests/AddAppModule.java new file mode 100644 index 0000000..6719360 --- /dev/null +++ b/tests/seleniumjava/PHPAiravataTest/src/test/java/com/example/tests/appcatalog/example/tests/AddAppModule.java @@ -0,0 +1,104 @@ +package com.example.tests.appcatalog.example.tests; + +import java.util.concurrent.TimeUnit; + +import com.example.tests.UserLogin; +import com.example.tests.utils.CurrentDateTime; +import com.example.tests.utils.ExpFileReadUtils; +import org.junit.*; +import static org.junit.Assert.*; + +import org.openqa.selenium.*; +import org.openqa.selenium.firefox.FirefoxDriver; +/* + **********Add an Application Module********** + * Created by Eroma on 12/09/14. + * The script creates an Application Module in Airavata Application Catalog + * base URL, sub URL and Application Name are read from the exp.properties file +*/ + + public class AddAppModule extends UserLogin { + private WebDriver driver; + private String subUrl; + private String baseUrl; + private boolean acceptNextAlert = true; + private StringBuffer verificationErrors = new StringBuffer(); + + @Before + public void setUp() throws Exception { + driver = new FirefoxDriver(); + baseUrl = ExpFileReadUtils.readProperty("base.url"); + subUrl = ExpFileReadUtils.readProperty("sub.url"); + driver.manage().timeouts().implicitlyWait(30, TimeUnit.SECONDS); + + } + + @Test + public void testAddAppModule() throws Exception { + driver.get(baseUrl + subUrl); + authenticate(driver); + driver.findElement(By.linkText("App Catalog")).click(); + waitTime (500); + driver.findElement(By.id("module")).click(); + waitTime (500); + driver.findElement(By.xpath("//body/div/div/button")).click(); + waitTime (500); + driver.findElement(By.name("appModuleName")).sendKeys("TEST_APP" + CurrentDateTime.getTodayDate()); + waitTime (500); + driver.findElement(By.name("appModuleDescription")).sendKeys("TEST APPLICATION MODULE"); + waitTime (500); + driver.findElement(By.cssSelector("input.btn.btn-primary")).click(); + waitTime (500); + } + + private void waitTime(int i) { + try { + Thread.sleep(i); + } catch (InterruptedException e) { + e.printStackTrace(); + } + + } + + @After + public void tearDown() throws Exception { + driver.quit(); + String verificationErrorString = verificationErrors.toString(); + if (!"".equals(verificationErrorString)) { + fail(verificationErrorString); + } + } + + private boolean isElementPresent(By by) { + try { + driver.findElement(by); + return true; + } catch (NoSuchElementException e) { + return false; + } + } + + private boolean isAlertPresent() { + try { + driver.switchTo().alert(); + return true; + } catch (NoAlertPresentException e) { + return false; + } + } + + private String closeAlertAndGetItsText() { + try { + Alert alert = driver.switchTo().alert(); + String alertText = alert.getText(); + if (acceptNextAlert) { + alert.accept(); + } else { + alert.dismiss(); + } + return alertText; + } finally { + acceptNextAlert = true; + } + } +} diff --git a/tests/seleniumjava/PHPAiravataTest/src/test/java/com/example/tests/appcatalog/example/tests/AddApplicationInterface.java b/tests/seleniumjava/PHPAiravataTest/src/test/java/com/example/tests/appcatalog/example/tests/AddApplicationInterface.java new file mode 100644 index 0000000..e392fdd --- /dev/null +++ b/tests/seleniumjava/PHPAiravataTest/src/test/java/com/example/tests/appcatalog/example/tests/AddApplicationInterface.java @@ -0,0 +1,119 @@ +package com.example.tests; + +import java.util.regex.Pattern; +import java.util.concurrent.TimeUnit; + +import com.example.tests.utils.ExpFileReadUtils; +import org.junit.*; +import static org.junit.Assert.*; +import static org.hamcrest.CoreMatchers.*; +import org.openqa.selenium.*; +import org.openqa.selenium.firefox.FirefoxDriver; +import org.openqa.selenium.support.ui.Select; +import org.openqa.selenium.JavascriptExecutor; +/* + **********Add an Application Interface********** + * Created by Eroma on 12/09/14. + * The script creates an Application Interface in Airavata Application Catalog + * base URL and sub URL are read from the exp.properties file +*/ + +public class AddApplicationInterface extends UserLogin { + private WebDriver driver; + private String subUrl; + private String baseUrl; + private boolean acceptNextAlert = true; + private StringBuffer verificationErrors = new StringBuffer(); + + @Before + public void setUp() throws Exception { + driver = new FirefoxDriver(); + baseUrl = ExpFileReadUtils.readProperty("base.url"); + subUrl = ExpFileReadUtils.readProperty("sub.url"); + driver.manage().timeouts().implicitlyWait(30, TimeUnit.SECONDS); + + } + + @Test + public void testAddApplicationInterface() throws Exception { + driver.get(baseUrl + subUrl); + authenticate(driver); + driver.findElement(By.linkText("App Catalog")).click(); + driver.findElement(By.id("interface")).click(); + driver.findElement(By.xpath("//div/div/div/button")).click(); + driver.findElement(By.cssSelector("div.create-app-interface-block > div.appInterfaceInputs > div.form-group.required > input[name=\"applicationName\"]")).clear(); + driver.findElement(By.cssSelector("div.create-app-interface-block > div.appInterfaceInputs > div.form-group.required > input[name=\"applicationName\"]")).sendKeys("APP_INT200"); + driver.findElement(By.cssSelector("div.create-app-interface-block > div.appInterfaceInputs > div.form-group > input[name=\"applicationDescription\"]")).clear(); + driver.findElement(By.cssSelector("div.create-app-interface-block > div.appInterfaceInputs > div.form-group > input[name=\"applicationDescription\"]")).sendKeys("TEST_APPLICATION_INTERFACE"); + WebElement element = driver.findElement(By.xpath("(//input[@value='Add Application Module'])[27]")); + System.out.println(element.getTagName()); + System.out.println("last here ...."); + JavascriptExecutor js=(JavascriptExecutor) driver; + //js.executeScript("document.getElementsByClassName('hide btn btn-default add-app-module')[0].click();"); + js.executeScript("arguments[0].click();", element); + + new Select(driver.findElement(By.cssSelector("div.create-app-interface-block > div.appInterfaceInputs > div.form-group > div.app-modules > div.input-group > select[name=\"applicationModules[]\"]"))).selectByVisibleText("TEST_APP2014-12-11T03:08:10"); + driver.findElement(By.xpath("(//input[@value='Add Application Input'])[27]")).click(); + driver.findElement(By.cssSelector("div.create-app-interface-block > div.appInterfaceInputs > div.form-group > div.app-inputs > div > div.well > div.form-group.required > input[name=\"inputName[]\"]")).clear(); + driver.findElement(By.cssSelector("div.create-app-interface-block > div.appInterfaceInputs > div.form-group > div.app-inputs > div > div.well > div.form-group.required > input[name=\"inputName[]\"]")).sendKeys("TEST_INPUT1"); + driver.findElement(By.cssSelector("div.create-app-interface-block > div.appInterfaceInputs > div.form-group > div.app-inputs > div > div.well > div.form-group > input[name=\"inputValue[]\"]")).clear(); + driver.findElement(By.cssSelector("div.create-app-interface-block > div.appInterfaceInputs > div.form-group > div.app-inputs > div > div.well > div.form-group > input[name=\"inputValue[]\"]")).sendKeys("100.10"); + new Select(driver.findElement(By.cssSelector("div.create-app-interface-block > div.appInterfaceInputs > div.form-group > div.app-inputs > div > div.well > div.form-group > select[name=\"inputType[]\"]"))).selectByVisibleText("FLOAT"); + driver.findElement(By.cssSelector("div.create-app-interface-block > div.appInterfaceInputs > div.form-group > div.app-inputs > div > div.well > div.form-group > input[name=\"applicationArgument[]\"]")).clear(); + driver.findElement(By.cssSelector("div.create-app-interface-block > div.appInterfaceInputs > div.form-group > div.app-inputs > div > div.well > div.form-group > input[name=\"applicationArgument[]\"]")).sendKeys("NONE"); + new Select(driver.findElement(By.cssSelector("div.create-app-interface-block > div.appInterfaceInputs > div.form-group > div.app-inputs > div > div.well > div.form-group > select[name=\"standardInput[]\"]"))).selectByVisibleText("True"); + driver.findElement(By.cssSelector("div.create-app-interface-block > div.appInterfaceInputs > div.form-group > div.app-inputs > div > div.well > div.form-group > textarea[name=\"userFriendlyDescription[]\"]")).clear(); + driver.findElement(By.cssSelector("div.create-app-interface-block > div.appInterfaceInputs > div.form-group > div.app-inputs > div > div.well > div.form-group > textarea[name=\"userFriendlyDescription[]\"]")).sendKeys("NONE"); + driver.findElement(By.cssSelector("div.create-app-interface-block > div.appInterfaceInputs > div.form-group > div.app-inputs > div > div.well > div.form-group > textarea[name=\"metaData[]\"]")).clear(); + driver.findElement(By.cssSelector("div.create-app-interface-block > div.appInterfaceInputs > div.form-group > div.app-inputs > div > div.well > div.form-group > textarea[name=\"metaData[]\"]")).sendKeys("NONE"); + driver.findElement(By.xpath("(//input[@value='Add Application Output'])[27]")).click(); + driver.findElement(By.cssSelector("div.create-app-interface-block > div.appInterfaceInputs > div.form-group > div.app-outputs > div > div.well > div.form-group.required > input[name=\"outputName[]\"]")).clear(); + driver.findElement(By.cssSelector("div.create-app-interface-block > div.appInterfaceInputs > div.form-group > div.app-outputs > div > div.well > div.form-group.required > input[name=\"outputName[]\"]")).sendKeys("TEST_OUTPUT1"); + driver.findElement(By.cssSelector("div.create-app-interface-block > div.appInterfaceInputs > div.form-group > div.app-outputs > div > div.well > div.form-group > input[name=\"outputValue[]\"]")).clear(); + driver.findElement(By.cssSelector("div.create-app-interface-block > div.appInterfaceInputs > div.form-group > div.app-outputs > div > div.well > div.form-group > input[name=\"outputValue[]\"]")).sendKeys("TEST_OUTPUT"); + driver.findElement(By.xpath("//input[@value='Create']")).click(); + driver.findElement(By.xpath("(//input[@value=''])[186]")).click(); + } + + @After + public void tearDown() throws Exception { + driver.quit(); + String verificationErrorString = verificationErrors.toString(); + if (!"".equals(verificationErrorString)) { + fail(verificationErrorString); + } + } + + private boolean isElementPresent(By by) { + try { + driver.findElement(by); + return true; + } catch (NoSuchElementException e) { + return false; + } + } + + private boolean isAlertPresent() { + try { + driver.switchTo().alert(); + return true; + } catch (NoAlertPresentException e) { + return false; + } + } + + private String closeAlertAndGetItsText() { + try { + Alert alert = driver.switchTo().alert(); + String alertText = alert.getText(); + if (acceptNextAlert) { + alert.accept(); + } else { + alert.dismiss(); + } + return alertText; + } finally { + acceptNextAlert = true; + } + } +} diff --git a/tests/seleniumjava/PHPAiravataTest/src/test/java/com/example/tests/appcatalog/example/tests/AddComputeResource.java b/tests/seleniumjava/PHPAiravataTest/src/test/java/com/example/tests/appcatalog/example/tests/AddComputeResource.java new file mode 100644 index 0000000..f52deaa --- /dev/null +++ b/tests/seleniumjava/PHPAiravataTest/src/test/java/com/example/tests/appcatalog/example/tests/AddComputeResource.java @@ -0,0 +1,270 @@ +package com.example.tests.appcatalog.example.tests; + +import java.util.concurrent.TimeUnit; + +import com.example.tests.UserLogin; +import com.example.tests.utils.CurrentDateTime; +import com.example.tests.utils.ExpFileReadUtils; +import org.junit.*; +import static org.junit.Assert.*; +import org.openqa.selenium.*; +import org.openqa.selenium.firefox.FirefoxDriver; +import org.openqa.selenium.support.ui.Select; + +/* + **********Create a Compute Resource********** + * Created by Eroma on 11/12/14. + * The script creates a new Compute Resource with Description, Queues, File system, Job and Data MMovement Interfaces + * Some input parameters are read from the exp.properties file fore ease of use + * Modified by Eroma on 12/08/14. +*/ + +public class AddComputeResource extends UserLogin { + private WebDriver driver; + private String subUrl; + private String baseUrl; + private String securityProtocol; + private String resourceJobManagerType; + private boolean acceptNextAlert = true; + private StringBuffer verificationErrors = new StringBuffer(); + + @Before + public void setUp() throws Exception { + driver = new FirefoxDriver(); + baseUrl = ExpFileReadUtils.readProperty("base.url"); + subUrl = ExpFileReadUtils.readProperty("sub.url"); + securityProtocol = ExpFileReadUtils.readProperty("securityProtocol.value"); + resourceJobManagerType = ExpFileReadUtils.readProperty("resourceJobManagerType.value"); + driver.manage().timeouts().implicitlyWait(30, TimeUnit.SECONDS); + + } + + @Test + public void testAddComputeResource() throws Exception { + driver.get(baseUrl + subUrl); + authenticate(driver); + driver.findElement(By.linkText("Compute Resource")).click(); + driver.findElement(By.id("register")).click(); + driver.findElement(By.name("hostname")).clear(); + waitTime (500); + driver.findElement(By.name("hostname")).sendKeys("TEST_COMP_RES_" + CurrentDateTime.getTodayDate()); + waitTime (500); + driver.findElement(By.name("hostaliases[]")).sendKeys("ALIAS_1"); + waitTime (500); + driver.findElement(By.xpath("(//button[@type='button'])[2]")).click(); + driver.findElement(By.xpath("(//input[@name='hostaliases[]'])[2]")).sendKeys("ALIAS_2"); + waitTime (500); + driver.findElement(By.name("ips[]")).sendKeys("100.125.225.95"); + waitTime (500); + driver.findElement(By.xpath("(//button[@type='button'])[3]")).click(); + waitTime (500); + driver.findElement(By.xpath("(//input[@name='ips[]'])[2]")).sendKeys("2.5.6.100"); + waitTime (500); + driver.findElement(By.name("description")).sendKeys("ADD_COMPUTE_RESOURCE_DESCRIPTION"); + waitTime (500); + driver.findElement(By.name("step1")).click(); + waitTime (500); + driver.findElement(By.linkText("Queues")).click(); + waitTime (500); + driver.findElement(By.xpath("(//button[@type='button'])[4]")).click(); + waitTime (500); + driver.findElement(By.cssSelector("div.form-group.well > form > div.queue > div.queue > div.form-group.required > input[name=\"qname\"]")).sendKeys("TEST-NORMAL"); + waitTime (500); + driver.findElement(By.cssSelector("div.form-group.well > form > div.queue > div.queue > div.form-group > textarea[name=\"qdesc\"]")).sendKeys("ADD_QUEUE_DESCRIPTION"); + waitTime (500); + driver.findElement(By.cssSelector("div.form-group.well > form > div.queue > div.queue > div.form-group > input[name=\"qmaxruntime\"]")).sendKeys("120"); + waitTime (500); + driver.findElement(By.cssSelector("div.form-group.well > form > div.queue > div.queue > div.form-group > input[name=\"qmaxnodes\"]")).sendKeys("500"); + waitTime (500); + driver.findElement(By.cssSelector("div.form-group.well > form > div.queue > div.queue > div.form-group > input[name=\"qmaxprocessors\"]")).sendKeys("32"); + waitTime (500); + driver.findElement(By.cssSelector("div.form-group.well > form > div.queue > div.queue > div.form-group > input[name=\"qmaxjobsinqueue\"]")).sendKeys("1000"); + waitTime (500); + driver.findElement(By.cssSelector("div.form-group.well > form > div.queue > div.form-group > input[name=\"step1\"]")).click(); + driver.findElement(By.xpath("(//button[@type='button'])[4]")).click(); + driver.findElement(By.cssSelector("div.form-group.well > form > div.queue > div.queue > div.form-group.required > input[name=\"qname\"]")).sendKeys("TEST-VIP"); + waitTime (500); + driver.findElement(By.cssSelector("div.form-group.well > form > div.queue > div.queue > div.form-group > textarea[name=\"qdesc\"]")).sendKeys("TEST_DESCRIPTION"); + waitTime (500); + driver.findElement(By.cssSelector("div.form-group.well > form > div.queue > div.queue > div.form-group > input[name=\"qmaxruntime\"]")).sendKeys("90"); + waitTime (500); + driver.findElement(By.cssSelector("div.form-group.well > form > div.queue > div.queue > div.form-group > input[name=\"qmaxnodes\"]")).sendKeys("350"); + waitTime (500); + driver.findElement(By.cssSelector("div.form-group.well > form > div.queue > div.queue > div.form-group > input[name=\"qmaxprocessors\"]")).sendKeys("64"); + waitTime (500); + driver.findElement(By.cssSelector("div.form-group.well > form > div.queue > div.queue > div.form-group > input[name=\"qmaxjobsinqueue\"]")).sendKeys("999"); + waitTime (500); + driver.findElement(By.cssSelector("div.form-group.well > form > div.queue > div.form-group > input[name=\"step1\"]")).click(); + waitTime (500); + driver.findElement(By.linkText("FileSystem")).click(); + driver.findElement(By.name("fileSystems[0]")).sendKeys("TEST/LOCAL/CURRENT/HOME"); + waitTime(500); + driver.findElement(By.name("fileSystems[1]")).sendKeys("TEST/LOCAL/CURRENT/WORK"); + waitTime(500); + driver.findElement(By.name("fileSystems[2]")).sendKeys("TEST/LOCAL/CURRENT/LOCALTMP"); + waitTime(500); + driver.findElement(By.name("fileSystems[3]")).sendKeys("TEST/LOCAL/CURRENT/SCRATCH"); + waitTime(500); + driver.findElement(By.name("fileSystems[4]")).sendKeys("TEST/LOCAL/CURRENT/ARCHIVE"); + waitTime(500); + driver.findElement(By.cssSelector("button.btn.btn-prim")).click(); + driver.findElement(By.linkText("Job Submission Interfaces")).click(); + driver.findElement(By.xpath("(//button[@type='button'])[5]")).click(); + new Select(driver.findElement(By.cssSelector("div.job-protocol-block.col-md-12 > form > div.form-group > select[name=\"jobSubmissionProtocol\"]"))).selectByVisibleText("LOCAL"); + waitTime (500); + new Select(driver.findElement(By.cssSelector("div.resourcemanager-local > div.select-resource-manager-type > div.form-group.required > select[name=\"resourceJobManagerType\"]"))).selectByVisibleText(resourceJobManagerType); + waitTime (500); + driver.findElement(By.cssSelector("div.resourcemanager-local > div.form-group > input[name=\"pushMonitoringEndpoint\"]")).sendKeys("TEST_END_POINT"); + waitTime (500); + driver.findElement(By.cssSelector("div.resourcemanager-local > div.form-group > input[name=\"jobManagerBinPath\"]")).sendKeys("TEST/PATH/HOME/CURRENT/BIN"); + waitTime (500); + driver.findElement(By.cssSelector("div.resourcemanager-local > div.form-group > input[name=\"jobManagerCommands[0]\"]")).sendKeys("TEST_QSUB"); + waitTime (500); + driver.findElement(By.cssSelector("div.resourcemanager-local > div.form-group > input[name=\"jobManagerCommands[1]\"]")).sendKeys("TEST_QMON"); + waitTime (500); + driver.findElement(By.cssSelector("div.resourcemanager-local > div.form-group > input[name=\"jobManagerCommands[2]\"]")).sendKeys("TEST_QDEL"); + waitTime (500); + driver.findElement(By.cssSelector("div.resourcemanager-local > div.form-group > input[name=\"jobManagerCommands[3]\"]")).sendKeys("TEST_QCHK"); + waitTime (500); + driver.findElement(By.cssSelector("div.resourcemanager-local > div.form-group > input[name=\"jobManagerCommands[4]\"]")).sendKeys("TEST_QSHW"); + waitTime (500); + driver.findElement(By.cssSelector("div.resourcemanager-local > div.form-group > input[name=\"jobManagerCommands[5]\"]")).sendKeys("TEST_QRESV"); + waitTime (500); + driver.findElement(By.cssSelector("div.resourcemanager-local > div.form-group > input[name=\"jobManagerCommands[6]\"]")).sendKeys("TEST_QSTRT"); + waitTime (500); + driver.findElement(By.xpath("(//button[@type='submit'])[5]")).click(); + //waitTime (500); + driver.findElement(By.xpath("(//button[@type='button'])[5]")).click(); + new Select(driver.findElement(By.cssSelector("div.job-protocol-block.col-md-12 > form > div.form-group > select[name=\"jobSubmissionProtocol\"]"))).selectByVisibleText("SSH"); + waitTime (500); + new Select(driver.findElement(By.cssSelector("div.resourcemanager-ssh > div.form-group.required > select[name=\"securityProtocol\"]"))).selectByVisibleText(securityProtocol); + driver.findElement(By.cssSelector("div.resourcemanager-ssh > div.form-group.addedScpValue > input[name=\"alternativeSSHHostName\"]")).sendKeys("HOST4"); + waitTime (500); + driver.findElement(By.cssSelector("div.resourcemanager-ssh > div.form-group.addedScpValue > input[name=\"sshPort\"]")).sendKeys("7777"); + waitTime (500); + new Select(driver.findElement(By.cssSelector("div.resourcemanager-ssh > div.select-resource-manager-type > div.form-group.required > select[name=\"resourceJobManagerType\"]"))).selectByVisibleText(resourceJobManagerType); + waitTime (500); + driver.findElement(By.cssSelector("div.resourcemanager-ssh > div.form-group > input[name=\"pushMonitoringEndpoint\"]")).sendKeys("TEST_END_POINT"); + waitTime (500); + driver.findElement(By.cssSelector("div.resourcemanager-ssh > div.form-group > input[name=\"jobManagerBinPath\"]")).sendKeys("TEST/PATH/HOME/CURRENT/LOCAL/BIN"); + waitTime (500); + driver.findElement(By.cssSelector("div.resourcemanager-ssh > div.form-group > input[name=\"jobManagerCommands[0]\"]")).sendKeys("TEST_SUBMISSION"); + waitTime (500); + driver.findElement(By.cssSelector("div.resourcemanager-ssh > div.form-group > input[name=\"jobManagerCommands[1]\"]")).sendKeys("TEST_MONITORING"); + waitTime (500); + driver.findElement(By.cssSelector("div.resourcemanager-ssh > div.form-group > input[name=\"jobManagerCommands[2]\"]")).sendKeys("TEST_DELETION"); + waitTime (500); + driver.findElement(By.cssSelector("div.resourcemanager-ssh > div.form-group > input[name=\"jobManagerCommands[3]\"]")).sendKeys("TEST_CHECK_JOB"); + waitTime (500); + driver.findElement(By.cssSelector("div.resourcemanager-ssh > div.form-group > input[name=\"jobManagerCommands[4]\"]")).sendKeys("TEST_SHOW_QUEUE"); + waitTime (500); + driver.findElement(By.cssSelector("div.resourcemanager-ssh > div.form-group > input[name=\"jobManagerCommands[5]\"]")).sendKeys("TEST_SHOW_RESERVATION"); + driver.findElement(By.cssSelector("div.resourcemanager-ssh > div.form-group > input[name=\"jobManagerCommands[6]\"]")).sendKeys("TEST_SHOW_START"); + waitTime (500); + driver.findElement(By.xpath("(//button[@type='submit'])[6]")).click(); + waitTime (500); + /*driver.findElement(By.xpath("(//button[@type='button'])[6]")).click(); + //driver.findElement(By.xpath("(//input[@name='jsi-priority[]'])[1]")).clear(); + // driver.findElement(By.xpath("(//input[@name='jsi-priority[]'])[1]")).sendKeys("0"); + // waitTime (500); + // driver.findElement(By.xpath("(//input[@name='jsi-priority[]'])[2]")).clear(); + // driver.findElement(By.xpath("(//input[@name='jsi-priority[]'])[2]")).sendKeys("1"); + // waitTime (500); + // driver.findElement(By.cssSelector("button.btn.btn-update")).click(); + waitTime (500); + */driver.findElement(By.linkText("Data Movement Interfaces")).click(); + waitTime (500); + driver.findElement(By.xpath("(//button[@type='button'])[9]")).click(); + new Select(driver.findElement(By.cssSelector("div.data-movement-block.col-md-12 > form > select[name=\"dataMovementProtocol\"]"))).selectByVisibleText("LOCAL"); + waitTime (500); + driver.findElement(By.xpath("(//button[@type='submit'])[8]")).click(); + waitTime (500); + driver.findElement(By.xpath("(//button[@type='button'])[9]")).click(); + new Select(driver.findElement(By.cssSelector("div.data-movement-block.col-md-12 > form > select[name=\"dataMovementProtocol\"]"))).selectByVisibleText("SCP"); + waitTime (500); + new Select(driver.findElement(By.cssSelector("div.dataprotocol-scp > div.form-group.required > select[name=\"securityProtocol\"]"))).selectByVisibleText(securityProtocol); + waitTime (500); + driver.findElement(By.cssSelector("div.dataprotocol-scp > div.form-group.addedScpValue > input[name=\"alternativeSSHHostName\"]")).sendKeys("HOST5"); + waitTime (500); + driver.findElement(By.cssSelector("div.dataprotocol-scp > div.form-group.addedScpValue > input[name=\"sshPort\"]")).sendKeys("8888"); + waitTime (500); + driver.findElement(By.xpath("(//button[@type='submit'])[8]")).click(); + waitTime (500); + driver.findElement(By.xpath("(//button[@type='button'])[9]")).click(); + waitTime(500); + new Select(driver.findElement(By.cssSelector("div.data-movement-block.col-md-12 > form > select[name=\"dataMovementProtocol\"]"))).selectByVisibleText("GridFTP"); + waitTime (500); + // driver.findElement(By.cssSelector("div.dataprotocol-gridftp > div.form-group.required > input[name=\"gridFTPEndPoints[]\"]")).clear(); + waitTime (500); + driver.findElement(By.cssSelector("div.dataprotocol-gridftp > div.form-group.required > input[name=\"gridFTPEndPoints[]\"]")).sendKeys("TEST_E-END1"); + waitTime (500); + driver.findElement(By.xpath("(//button[@type='button'])[16]")).click(); + waitTime(500); + driver.findElement(By.xpath("(//input[@name='gridFTPEndPoints[]'])[3]")).sendKeys("TEST_E-END2"); + waitTime (500); + driver.findElement(By.xpath("(//button[@type='submit'])[9]")).click(); + waitTime (500); + driver.findElement(By.xpath("(//button[@type='button'])[10]")).click(); + waitTime (500); + driver.findElement(By.name("dmi-priority[]")).clear(); + driver.findElement(By.name("dmi-priority[]")).sendKeys("1"); + driver.findElement(By.xpath("(//input[@name='dmi-priority[]'])[2]")).clear(); + driver.findElement(By.xpath("(//input[@name='dmi-priority[]'])[2]")).sendKeys("2"); + driver.findElement(By.xpath("(//input[@name='dmi-priority[]'])[3]")).clear(); + driver.findElement(By.xpath("(//input[@name='dmi-priority[]'])[3]")).sendKeys("3"); + driver.findElement(By.cssSelector("#dmi-priority-form > button.btn.btn-update")).click(); + } + + + private void waitTime(int i) { + try { + Thread.sleep(i); + } catch (InterruptedException e) { + e.printStackTrace(); + } + + } + + + @After + public void tearDown() throws Exception { + driver.quit(); + String verificationErrorString = verificationErrors.toString(); + if (!"".equals(verificationErrorString)) { + fail(verificationErrorString); + } + } + + private boolean isElementPresent(By by) { + try { + driver.findElement(by); + return true; + } catch (NoSuchElementException e) { + return false; + } + } + + private boolean isAlertPresent() { + try { + driver.switchTo().alert(); + return true; + } catch (NoAlertPresentException e) { + return false; + } + } + + private String closeAlertAndGetItsText() { + try { + Alert alert = driver.switchTo().alert(); + String alertText = alert.getText(); + if (acceptNextAlert) { + alert.accept(); + } else { + alert.dismiss(); + } + return alertText; + } finally { + acceptNextAlert = true; + } + } +} diff --git a/tests/seleniumjava/PHPAiravataTest/src/test/java/com/example/tests/appcatalog/example/tests/DeleteAppInterface.java b/tests/seleniumjava/PHPAiravataTest/src/test/java/com/example/tests/appcatalog/example/tests/DeleteAppInterface.java new file mode 100644 index 0000000..78637f9 --- /dev/null +++ b/tests/seleniumjava/PHPAiravataTest/src/test/java/com/example/tests/appcatalog/example/tests/DeleteAppInterface.java @@ -0,0 +1,113 @@ +package com.example.tests.appcatalog.example.tests; + +import java.util.regex.Pattern; +import java.util.concurrent.TimeUnit; + +import com.example.tests.UserLogin; +import com.example.tests.utils.ExpFileReadUtils; +import org.junit.*; +import static org.junit.Assert.*; +import static org.hamcrest.CoreMatchers.*; +import org.openqa.selenium.*; +import org.openqa.selenium.firefox.FirefoxDriver; +import org.openqa.selenium.support.ui.Select; + +/* + **********Add an Application Module********** + * Created by Eroma on 12/09/14. + * The script creates an Application Module in Airavata Application Catalog + * base URL, sub URL and Application Name are read from the exp.properties file +*/ + +public class DeleteAppInterface extends UserLogin { + private WebDriver driver; + private String subUrl; + private String baseUrl; + private boolean acceptNextAlert = true; + private StringBuffer verificationErrors = new StringBuffer(); + + @Before + public void setUp() throws Exception { + driver = new FirefoxDriver(); + baseUrl = ExpFileReadUtils.readProperty("base.url"); + subUrl = ExpFileReadUtils.readProperty("sub.url"); + driver.manage().timeouts().implicitlyWait(30, TimeUnit.SECONDS); + + } + + @Test + public void testDeleteAppInterface() throws Exception { + driver.get(baseUrl + subUrl); + authenticate(driver); + driver.findElement(By.linkText("App Catalog")).click(); + driver.findElement(By.id("interface")).click(); + try { + assertEquals(ExpFileReadUtils.readProperty("appInterface.name"), driver.findElement(By.linkText(ExpFileReadUtils.readProperty("appInterface.name"))).getText()); + } catch (Error e) { + verificationErrors.append(e.toString()); + } + + String id_ = ExpFileReadUtils.readProperty("appInterface.name"); + String clickId = null; + for(int h = 1; h < 100; ++h) { + String findPath = "(//div[@id='accordion']/div[" + h + "]/div/h4)"; + String foundid = driver.findElement(By.xpath(findPath)).getText().trim(); + System.out.println(foundid); + if (foundid.equals(id_)) { + clickId = "(//div[@id='accordion']/div[" + h + "]/div/h4/div/span[2])"; + System.out.println(clickId); + driver.findElement(By.xpath(clickId)).click(); + break; + } + } + if (clickId == null) { + System.out.println("Searched Application Interface Does Not Exists in the System !"); + return; + } + + // driver.findElement(By.xpath("//div[@id='accordion']/div[15]/div/h4/div/span[2]")).click(); + driver.findElement(By.cssSelector("input.btn.btn-danger")).click(); + } + + @After + public void tearDown() throws Exception { + driver.quit(); + String verificationErrorString = verificationErrors.toString(); + if (!"".equals(verificationErrorString)) { + fail(verificationErrorString); + } + } + + private boolean isElementPresent(By by) { + try { + driver.findElement(by); + return true; + } catch (NoSuchElementException e) { + return false; + } + } + + private boolean isAlertPresent() { + try { + driver.switchTo().alert(); + return true; + } catch (NoAlertPresentException e) { + return false; + } + } + + private String closeAlertAndGetItsText() { + try { + Alert alert = driver.switchTo().alert(); + String alertText = alert.getText(); + if (acceptNextAlert) { + alert.accept(); + } else { + alert.dismiss(); + } + return alertText; + } finally { + acceptNextAlert = true; + } + } +} diff --git a/tests/seleniumjava/PHPAiravataTest/src/test/java/com/example/tests/appcatalog/example/tests/DeleteAppModule.java b/tests/seleniumjava/PHPAiravataTest/src/test/java/com/example/tests/appcatalog/example/tests/DeleteAppModule.java new file mode 100644 index 0000000..d104068 --- /dev/null +++ b/tests/seleniumjava/PHPAiravataTest/src/test/java/com/example/tests/appcatalog/example/tests/DeleteAppModule.java @@ -0,0 +1,121 @@ +package com.example.tests.appcatalog.example.tests; + +import java.util.concurrent.TimeUnit; + +import com.example.tests.UserLogin; +import com.example.tests.utils.ExpFileReadUtils; +import org.junit.*; +import static org.junit.Assert.*; + +import org.openqa.selenium.*; +import org.openqa.selenium.firefox.FirefoxDriver; +/* + **********Delete an Application Module********** + * Created by Eroma on 12/09/14. + * The script deletes an Application Module in Airavata Application Catalog + * base URL, sub URL and Application Name are read from the exp.properties file +*/ + + public class DeleteAppModule extends UserLogin { + private WebDriver driver; + private String subUrl; + private String baseUrl; + private boolean acceptNextAlert = true; + private StringBuffer verificationErrors = new StringBuffer(); + + @Before + public void setUp() throws Exception { + driver = new FirefoxDriver(); + baseUrl = ExpFileReadUtils.readProperty("base.url"); + subUrl = ExpFileReadUtils.readProperty("sub.url"); + driver.manage().timeouts().implicitlyWait(30, TimeUnit.SECONDS); + + } + + @Test + public void testDeleteAppModule() throws Exception { + driver.get(baseUrl + subUrl); + authenticate(driver); + driver.findElement(By.linkText("App Catalog")).click(); + waitTime (500); + driver.findElement(By.id("module")).click(); + waitTime (500); + String id_ = ExpFileReadUtils.readProperty("appModuleName"); + waitTime (500); + String clickId = null; + for(int h = 1; h < 100; ++h) { + String findPath = "(//div[@id='accordion']/div[" + h + "]/div/h4/a)"; + waitTime (500); + String foundid = driver.findElement(By.xpath(findPath)).getText().trim(); + waitTime (500); + System.out.println(foundid); + waitTime (500); + if (foundid.equals(id_)) { + clickId = "(//div[@id='accordion']/div[" + h + "]/div/h4/div/span[2])"; + waitTime (500); + System.out.println(clickId); + waitTime (500); + driver.findElement(By.xpath(clickId)).click(); + waitTime (500); + break; + } + } + if (clickId == null) { + System.out.println("Searched Application Module Does Not Exists in the System !"); + return; + } + driver.findElement(By.cssSelector("input.btn.btn-danger")).click(); + } + + private void waitTime(int i) { + try { + Thread.sleep(i); + } catch (InterruptedException e) { + e.printStackTrace(); + } + + } + + + @After + public void tearDown() throws Exception { + driver.quit(); + String verificationErrorString = verificationErrors.toString(); + if (!"".equals(verificationErrorString)) { + fail(verificationErrorString); + } + } + + private boolean isElementPresent(By by) { + try { + driver.findElement(by); + return true; + } catch (NoSuchElementException e) { + return false; + } + } + + private boolean isAlertPresent() { + try { + driver.switchTo().alert(); + return true; + } catch (NoAlertPresentException e) { + return false; + } + } + + private String closeAlertAndGetItsText() { + try { + Alert alert = driver.switchTo().alert(); + String alertText = alert.getText(); + if (acceptNextAlert) { + alert.accept(); + } else { + alert.dismiss(); + } + return alertText; + } finally { + acceptNextAlert = true; + } + } +} diff --git a/tests/seleniumjava/PHPAiravataTest/src/test/java/com/example/tests/appcatalog/example/tests/DeleteComputeResource.java b/tests/seleniumjava/PHPAiravataTest/src/test/java/com/example/tests/appcatalog/example/tests/DeleteComputeResource.java new file mode 100644 index 0000000..b45c380 --- /dev/null +++ b/tests/seleniumjava/PHPAiravataTest/src/test/java/com/example/tests/appcatalog/example/tests/DeleteComputeResource.java @@ -0,0 +1,102 @@ +package com.example.tests; + +import java.util.regex.Pattern; +import java.util.concurrent.TimeUnit; + +import com.example.tests.utils.ExpFileReadUtils; +import org.junit.*; +import static org.junit.Assert.*; +import static org.hamcrest.CoreMatchers.*; +import org.openqa.selenium.*; +import org.openqa.selenium.firefox.FirefoxDriver; +import org.openqa.selenium.support.ui.Select; +/* + **********Modify an Application Module********** + * Created by Eroma on 12/09/14. + * The script modifies an existing Application Module in Airavata Application Catalog + * base URL, sub URL, existing application Name and modified name are read from the exp.properties file +*/ + +public class DeleteComputeResource extends UserLogin { + private WebDriver driver; + private String subUrl; + private String baseUrl; + private boolean acceptNextAlert = true; + private StringBuffer verificationErrors = new StringBuffer(); + + @Before + public void setUp() throws Exception { + driver = new FirefoxDriver(); + baseUrl = ExpFileReadUtils.readProperty("base.url"); + subUrl = ExpFileReadUtils.readProperty("sub.url"); + driver.manage().timeouts().implicitlyWait(30, TimeUnit.SECONDS); + + } + + @Test + public void testDeleteComputeResource() throws Exception { + driver.get(baseUrl + subUrl); + authenticate(driver); + driver.findElement(By.linkText("Compute Resource")).click(); + driver.findElement(By.id("browse")).click(); +// assertEquals("TEST_COMP_RES_2014-12-10T15:34:56_e842c9dd-03c6-473d-9395-3425fb2ee27d", driver.findElement(By.xpath("(//tr[@id='crDetails']/td[2])[11]")).getText()); + String id_ = "TEST_COMP_RES_2014-12-10T15:34:56_e842c9dd-03c6-473d-9395-3425fb2ee27d"; + for(int h = 1; h < 100; ++h) { + String findPath = "(//tr[@id='crDetails']/td[2])[" + h + "]"; + String foundid = driver.findElement(By.xpath(findPath)).getText(); + //System.out.println(foundid); + if (foundid.equals(id_)) { + String clickId = "(//tr[@id='crDetails']/td[5]/a/span)[" + h + "]"; + //System.out.println(clickId); + driver.findElement(By.xpath(clickId)).click(); + break; + } + } + //driver.findElement(By.xpath("(//tr[@id='crDetails']/td[5]/a/span)[11]")).click(); + driver.findElement(By.cssSelector("input.btn.btn-danger")).click(); + //TEST_COMP_RES_2014-12-10T15:34:56_e842c9dd-03c6-473d-9395-3425fb2ee27d_MODIFIED + //driver.findElement(By.linkText("Log out")).click(); + } + + @After + public void tearDown() throws Exception { + driver.quit(); + String verificationErrorString = verificationErrors.toString(); + if (!"".equals(verificationErrorString)) { + fail(verificationErrorString); + } + } + + private boolean isElementPresent(By by) { + try { + driver.findElement(by); + return true; + } catch (NoSuchElementException e) { + return false; + } + } + + private boolean isAlertPresent() { + try { + driver.switchTo().alert(); + return true; + } catch (NoAlertPresentException e) { + return false; + } + } + + private String closeAlertAndGetItsText() { + try { + Alert alert = driver.switchTo().alert(); + String alertText = alert.getText(); + if (acceptNextAlert) { + alert.accept(); + } else { + alert.dismiss(); + } + return alertText; + } finally { + acceptNextAlert = true; + } + } +} diff --git a/tests/seleniumjava/PHPAiravataTest/src/test/java/com/example/tests/appcatalog/example/tests/EditAppInterface.java b/tests/seleniumjava/PHPAiravataTest/src/test/java/com/example/tests/appcatalog/example/tests/EditAppInterface.java new file mode 100644 index 0000000..a06b6b9 --- /dev/null +++ b/tests/seleniumjava/PHPAiravataTest/src/test/java/com/example/tests/appcatalog/example/tests/EditAppInterface.java @@ -0,0 +1,158 @@ +package com.example.tests.appcatalog.example.tests; + +import java.util.regex.Pattern; +import java.util.concurrent.TimeUnit; + +import com.example.tests.UserLogin; +import com.example.tests.utils.ExpFileReadUtils; +import org.junit.*; +import static org.junit.Assert.*; +import static org.hamcrest.CoreMatchers.*; +import org.openqa.selenium.*; +import org.openqa.selenium.firefox.FirefoxDriver; +import org.openqa.selenium.support.ui.Select; + +/* + **********Add an Application Module********** + * Created by Eroma on 12/09/14. + * The script creates an Application Module in Airavata Application Catalog + * base URL, sub URL and Application Name are read from the exp.properties file +*/ + +public class EditAppInterface extends UserLogin { + private WebDriver driver; + private String subUrl; + private String baseUrl; + private boolean acceptNextAlert = true; + private StringBuffer verificationErrors = new StringBuffer(); + + @Before + public void setUp() throws Exception { + driver = new FirefoxDriver(); + baseUrl = ExpFileReadUtils.readProperty("base.url"); + subUrl = ExpFileReadUtils.readProperty("sub.url"); + driver.manage().timeouts().implicitlyWait(30, TimeUnit.SECONDS); + + } + + @Test + public void testEditAppInterface() throws Exception { + driver.get(baseUrl + subUrl); + authenticate(driver); + driver.findElement(By.linkText("App Catalog")).click(); + driver.findElement(By.id("interface")).click(); + assertEquals("TEST_APP_INT_MODIFIED", driver.findElement(By.linkText("TEST_APP_INT_MODIFIED")).getText()); + driver.findElement(By.xpath("//div[@id='accordion']/div[15]/div/h4/div/span")).click(); + driver.findElement(By.cssSelector("div.app-interface-form-content.col-md-12 > div.appInterfaceInputs > div.form-group.required > input[name=\"applicationName\"]")).clear(); + driver.findElement(By.cssSelector("div.app-interface-form-content.col-md-12 > div.appInterfaceInputs > div.form-group.required > input[name=\"applicationName\"]")).sendKeys("TEST_APP_INT_MODIFIED"); + driver.findElement(By.cssSelector("div.app-interface-form-content.col-md-12 > div.appInterfaceInputs > div.form-group > input[name=\"applicationDescription\"]")).clear(); + driver.findElement(By.cssSelector("div.app-interface-form-content.col-md-12 > div.appInterfaceInputs > div.form-group > input[name=\"applicationDescription\"]")).sendKeys("TEST_APP_INT_MODIFIED"); + new Select(driver.findElement(By.cssSelector("div.app-interface-form-content.col-md-12 > div.appInterfaceInputs > div.form-group > div.app-modules > div.input-group > select[name=\"applicationModules[]\"]"))).selectByVisibleText("TEST_APP2014-12-11T03:08:10"); + new Select(driver.findElement(By.xpath("(//select[@name='applicationModules[]'])[24]"))).selectByVisibleText("TEST_APP_MOD"); + driver.findElement(By.xpath("(//button[@type='button'])[129]")).click(); + new Select(driver.findElement(By.xpath("(//select[@name='applicationModules[]'])[25]"))).selectByVisibleText("HooraY"); + driver.findElement(By.cssSelector("div.app-interface-form-content.col-md-12 > div.appInterfaceInputs > div.form-group > div.well > div.form-group.required > input[name=\"inputName[]\"]")).clear(); + driver.findElement(By.cssSelector("div.app-interface-form-content.col-md-12 > div.appInterfaceInputs > div.form-group > div.well > div.form-group.required > input[name=\"inputName[]\"]")).sendKeys("TEST_INPUT1_MODIFIED"); + driver.findElement(By.cssSelector("div.app-interface-form-content.col-md-12 > div.appInterfaceInputs > div.form-group > div.well > div.form-group > input[name=\"inputValue[]\"]")).clear(); + driver.findElement(By.cssSelector("div.app-interface-form-content.col-md-12 > div.appInterfaceInputs > div.form-group > div.well > div.form-group > input[name=\"inputValue[]\"]")).sendKeys("1000"); + new Select(driver.findElement(By.cssSelector("div.app-interface-form-content.col-md-12 > div.appInterfaceInputs > div.form-group > div.well > div.form-group > select[name=\"inputType[]\"]"))).selectByVisibleText("FLOAT"); + driver.findElement(By.cssSelector("div.app-interface-form-content.col-md-12 > div.appInterfaceInputs > div.form-group > div.well > div.form-group > input[name=\"applicationArgument[]\"]")).clear(); + driver.findElement(By.cssSelector("div.app-interface-form-content.col-md-12 > div.appInterfaceInputs > div.form-group > div.well > div.form-group > input[name=\"applicationArgument[]\"]")).sendKeys("TEST ARGUMENT MODIFIED"); + new Select(driver.findElement(By.cssSelector("div.app-interface-form-content.col-md-12 > div.appInterfaceInputs > div.form-group > div.well > div.form-group > select[name=\"standardInput[]\"]"))).selectByVisibleText("False"); + driver.findElement(By.cssSelector("div.app-interface-form-content.col-md-12 > div.appInterfaceInputs > div.form-group > div.well > div.form-group > textarea[name=\"userFriendlyDescription[]\"]")).clear(); + driver.findElement(By.cssSelector("div.app-interface-form-content.col-md-12 > div.appInterfaceInputs > div.form-group > div.well > div.form-group > textarea[name=\"userFriendlyDescription[]\"]")).sendKeys("TETST MODIFIED"); + driver.findElement(By.cssSelector("div.app-interface-form-content.col-md-12 > div.appInterfaceInputs > div.form-group > div.well > div.form-group > textarea[name=\"metaData[]\"]")).clear(); + driver.findElement(By.cssSelector("div.app-interface-form-content.col-md-12 > div.appInterfaceInputs > div.form-group > div.well > div.form-group > textarea[name=\"metaData[]\"]")).sendKeys("TEST MODIFIED"); + driver.findElement(By.xpath("(//input[@name='inputName[]'])[37]")).clear(); + driver.findElement(By.xpath("(//input[@name='inputName[]'])[37]")).sendKeys("TEST_INPUT2_MODIFIED"); + driver.findElement(By.xpath("(//input[@name='inputValue[]'])[37]")).clear(); + driver.findElement(By.xpath("(//input[@name='inputValue[]'])[37]")).sendKeys("TEST_MODIFIED"); + new Select(driver.findElement(By.xpath("(//select[@name='inputType[]'])[37]"))).selectByVisibleText("STDOUT"); + driver.findElement(By.xpath("(//input[@name='applicationArgument[]'])[37]")).clear(); + driver.findElement(By.xpath("(//input[@name='applicationArgument[]'])[37]")).sendKeys("TEST_ARGUMENT_MODIFIED"); + new Select(driver.findElement(By.xpath("(//select[@name='standardInput[]'])[37]"))).selectByVisibleText("False"); + driver.findElement(By.xpath("(//textarea[@name='userFriendlyDescription[]'])[37]")).clear(); + driver.findElement(By.xpath("(//textarea[@name='userFriendlyDescription[]'])[37]")).sendKeys("TEST MODIFIED"); + driver.findElement(By.xpath("(//textarea[@name='metaData[]'])[37]")).clear(); + driver.findElement(By.xpath("(//textarea[@name='metaData[]'])[37]")).sendKeys("TEST TEST MODIFIED"); + driver.findElement(By.xpath("(//button[@type='button'])[132]")).click(); + driver.findElement(By.cssSelector("div.app-interface-form-content.col-md-12 > div.appInterfaceInputs > div.form-group > div.app-inputs > div > div.well > div.form-group.required > input[name=\"inputName[]\"]")).clear(); + driver.findElement(By.cssSelector("div.app-interface-form-content.col-md-12 > div.appInterfaceInputs > div.form-group > div.app-inputs > div > div.well > div.form-group.required > input[name=\"inputName[]\"]")).sendKeys("TEST_INPUT3"); + driver.findElement(By.cssSelector("div.app-interface-form-content.col-md-12 > div.appInterfaceInputs > div.form-group > div.app-inputs > div > div.well > div.form-group > input[name=\"inputValue[]\"]")).clear(); + driver.findElement(By.cssSelector("div.app-interface-form-content.col-md-12 > div.appInterfaceInputs > div.form-group > div.app-inputs > div > div.well > div.form-group > input[name=\"inputValue[]\"]")).sendKeys("NONE/TEST/MMP"); + new Select(driver.findElement(By.cssSelector("div.app-interface-form-content.col-md-12 > div.appInterfaceInputs > div.form-group > div.app-inputs > div > div.well > div.form-group > select[name=\"inputType[]\"]"))).selectByVisibleText("URI"); + driver.findElement(By.cssSelector("div.app-interface-form-content.col-md-12 > div.appInterfaceInputs > div.form-group > div.app-inputs > div > div.well > div.form-group > input[name=\"applicationArgument[]\"]")).clear(); + driver.findElement(By.cssSelector("div.app-interface-form-content.col-md-12 > div.appInterfaceInputs > div.form-group > div.app-inputs > div > div.well > div.form-group > input[name=\"applicationArgument[]\"]")).sendKeys("NO ARGUMENTS"); + new Select(driver.findElement(By.cssSelector("div.app-interface-form-content.col-md-12 > div.appInterfaceInputs > div.form-group > div.app-inputs > div > div.well > div.form-group > select[name=\"standardInput[]\"]"))).selectByVisibleText("True"); + driver.findElement(By.cssSelector("div.app-interface-form-content.col-md-12 > div.appInterfaceInputs > div.form-group > div.app-inputs > div > div.well > div.form-group > textarea[name=\"userFriendlyDescription[]\"]")).clear(); + driver.findElement(By.cssSelector("div.app-interface-form-content.col-md-12 > div.appInterfaceInputs > div.form-group > div.app-inputs > div > div.well > div.form-group > textarea[name=\"userFriendlyDescription[]\"]")).sendKeys("JUST TEST APP"); + driver.findElement(By.cssSelector("div.app-interface-form-content.col-md-12 > div.appInterfaceInputs > div.form-group > div.app-inputs > div > div.well > div.form-group > textarea[name=\"metaData[]\"]")).clear(); + driver.findElement(By.cssSelector("div.app-interface-form-content.col-md-12 > div.appInterfaceInputs > div.form-group > div.app-inputs > div > div.well > div.form-group > textarea[name=\"metaData[]\"]")).sendKeys("NO MET DATA"); + driver.findElement(By.cssSelector("div.app-interface-form-content.col-md-12 > div.appInterfaceInputs > div.form-group > div.well > div.form-group.required > input[name=\"outputName[]\"]")).clear(); + driver.findElement(By.cssSelector("div.app-interface-form-content.col-md-12 > div.appInterfaceInputs > div.form-group > div.well > div.form-group.required > input[name=\"outputName[]\"]")).sendKeys("TEST_OUTPUT1_MODIFIED"); + driver.findElement(By.cssSelector("div.app-interface-form-content.col-md-12 > div.appInterfaceInputs > div.form-group > div.well > div.form-group > input[name=\"outputValue[]\"]")).clear(); + driver.findElement(By.cssSelector("div.app-interface-form-content.col-md-12 > div.appInterfaceInputs > div.form-group > div.well > div.form-group > input[name=\"outputValue[]\"]")).sendKeys("TEST_MODIFIED"); + new Select(driver.findElement(By.cssSelector("div.app-interface-form-content.col-md-12 > div.appInterfaceInputs > div.form-group > div.well > div.form-group > select[name=\"outputType[]\"]"))).selectByVisibleText("STDERR"); + driver.findElement(By.xpath("(//input[@name='outputName[]'])[34]")).clear(); + driver.findElement(By.xpath("(//input[@name='outputName[]'])[34]")).sendKeys("TEST_OUTPUT2_MODIFIED"); + driver.findElement(By.xpath("(//input[@name='outputValue[]'])[34]")).clear(); + driver.findElement(By.xpath("(//input[@name='outputValue[]'])[34]")).sendKeys("1000"); + new Select(driver.findElement(By.xpath("(//select[@name='outputType[]'])[34]"))).selectByVisibleText("FLOAT"); + driver.findElement(By.xpath("(//button[@type='button'])[156]")).click(); + driver.findElement(By.cssSelector("div.app-interface-form-content.col-md-12 > div.appInterfaceInputs > div.form-group > div.app-outputs > div > div.well > div.form-group.required > input[name=\"outputName[]\"]")).clear(); + driver.findElement(By.cssSelector("div.app-interface-form-content.col-md-12 > div.appInterfaceInputs > div.form-group > div.app-outputs > div > div.well > div.form-group.required > input[name=\"outputName[]\"]")).sendKeys("TEST_OUTPUT3"); + driver.findElement(By.cssSelector("div.app-interface-form-content.col-md-12 > div.appInterfaceInputs > div.form-group > div.app-outputs > div > div.well > div.form-group > input[name=\"outputValue[]\"]")).clear(); + driver.findElement(By.cssSelector("div.app-interface-form-content.col-md-12 > div.appInterfaceInputs > div.form-group > div.app-outputs > div > div.well > div.form-group > input[name=\"outputValue[]\"]")).sendKeys("N/A"); + new Select(driver.findElement(By.cssSelector("div.app-interface-form-content.col-md-12 > div.appInterfaceInputs > div.form-group > div.app-outputs > div > div.well > div.form-group > select[name=\"outputType[]\"]"))).selectByVisibleText("STDOUT"); + driver.findElement(By.xpath("//input[@value='Update']")).click(); + driver.findElement(By.xpath("(//input[@value=''])[153]")).click(); + try { + assertEquals("TEST_APP_INT_MODIFIED", driver.findElement(By.linkText("TEST_APP_INT_MODIFIED")).getText()); + } catch (Error e) { + verificationErrors.append(e.toString()); + } + driver.findElement(By.linkText("TEST_APP_INT_MODIFIED")).click(); + } + + @After + public void tearDown() throws Exception { + driver.quit(); + String verificationErrorString = verificationErrors.toString(); + if (!"".equals(verificationErrorString)) { + fail(verificationErrorString); + } + } + + private boolean isElementPresent(By by) { + try { + driver.findElement(by); + return true; + } catch (NoSuchElementException e) { + return false; + } + } + + private boolean isAlertPresent() { + try { + driver.switchTo().alert(); + return true; + } catch (NoAlertPresentException e) { + return false; + } + } + + private String closeAlertAndGetItsText() { + try { + Alert alert = driver.switchTo().alert(); + String alertText = alert.getText(); + if (acceptNextAlert) { + alert.accept(); + } else { + alert.dismiss(); + } + return alertText; + } finally { + acceptNextAlert = true; + } + } +} diff --git a/tests/seleniumjava/PHPAiravataTest/src/test/java/com/example/tests/appcatalog/example/tests/EditAppModule.java b/tests/seleniumjava/PHPAiravataTest/src/test/java/com/example/tests/appcatalog/example/tests/EditAppModule.java new file mode 100644 index 0000000..42a4b3f --- /dev/null +++ b/tests/seleniumjava/PHPAiravataTest/src/test/java/com/example/tests/appcatalog/example/tests/EditAppModule.java @@ -0,0 +1,110 @@ +package com.example.tests.appcatalog.example.tests; + +import java.util.concurrent.TimeUnit; + +import com.example.tests.UserLogin; +import com.example.tests.utils.CurrentDateTime; +import com.example.tests.utils.ExpFileReadUtils; +import org.junit.*; +import static org.junit.Assert.*; + +import org.openqa.selenium.*; +import org.openqa.selenium.firefox.FirefoxDriver; + +/* + **********Modify an Application Module********** + * Created by Eroma on 12/09/14. + * The script modifies an existing Application Module in Airavata Application Catalog + * base URL, sub URL, existing application Name and modified name are read from the exp.properties file +*/ + public class EditAppModule extends UserLogin { + private WebDriver driver; + private String subUrl; + private String baseUrl; + private boolean acceptNextAlert = true; + private StringBuffer verificationErrors = new StringBuffer(); + + @Before + public void setUp() throws Exception { + driver = new FirefoxDriver(); + baseUrl = ExpFileReadUtils.readProperty("base.url"); + subUrl = ExpFileReadUtils.readProperty("sub.url"); + driver.manage().timeouts().implicitlyWait(30, TimeUnit.SECONDS); + + } + + @Test + public void testModAppModule() throws Exception { + driver.get(baseUrl + subUrl); + authenticate(driver); + driver.findElement(By.linkText("App Catalog")).click(); + driver.findElement(By.id("module")).click(); + String id_ = ExpFileReadUtils.readProperty("appModuleName"); + String clickId = null; + for(int h = 1; h < 100; ++h) { + String findPath = "(//div[@id='accordion']/div[" + h + "]/div/h4/a)"; + String foundid = driver.findElement(By.xpath(findPath)).getText().trim(); + System.out.println(foundid); + if (foundid.equals(id_)) { + clickId = "(//div[@id='accordion']/div[" + h + "]/div/h4/div/span)"; + System.out.println(clickId); + driver.findElement(By.xpath(clickId)).click(); + break; + } + } + if (clickId == null) { + System.out.println("Searched Application Module Does Not Exists in the System !"); + return; + } + + driver.findElement(By.cssSelector("#edit-app-module-block > div.modal-dialog > form > div.modal-content > div.modal-body > #new-app-module-block > div.form-group.required > input[name=\"appModuleName\"]")).clear(); + driver.findElement(By.cssSelector("#edit-app-module-block > div.modal-dialog > form > div.modal-content > div.modal-body > #new-app-module-block > div.form-group.required > input[name=\"appModuleName\"]")).sendKeys("MODIFIED_APP_" + CurrentDateTime.getTodayDate()); + driver.findElement(By.cssSelector("#edit-app-module-block > div.modal-dialog > form > div.modal-content > div.modal-body > #new-app-module-block > div.form-group > input[name=\"appModuleVersion\"]")).clear(); + driver.findElement(By.cssSelector("#edit-app-module-block > div.modal-dialog > form > div.modal-content > div.modal-body > #new-app-module-block > div.form-group > input[name=\"appModuleVersion\"]")).sendKeys("V2.0.0.0"); + driver.findElement(By.cssSelector("#edit-app-module-block > div.modal-dialog > form > div.modal-content > div.modal-body > #new-app-module-block > div.form-group > textarea[name=\"appModuleDescription\"]")).clear(); + driver.findElement(By.cssSelector("#edit-app-module-block > div.modal-dialog > form > div.modal-content > div.modal-body > #new-app-module-block > div.form-group > textarea[name=\"appModuleDescription\"]")).sendKeys("TEST APPLICATION MODULE MODIFY"); + driver.findElement(By.cssSelector("#edit-app-module-block > div.modal-dialog > form > div.modal-content > div.modal-footer > div.form-group > input.btn.btn-primary")).click(); + } + + @After + public void tearDown() throws Exception { + driver.quit(); + String verificationErrorString = verificationErrors.toString(); + if (!"".equals(verificationErrorString)) { + fail(verificationErrorString); + } + } + + private boolean isElementPresent(By by) { + try { + driver.findElement(by); + return true; + } catch (NoSuchElementException e) { + return false; + } + } + + private boolean isAlertPresent() { + try { + driver.switchTo().alert(); + return true; + } catch (NoAlertPresentException e) { + return false; + } + } + + private String closeAlertAndGetItsText() { + try { + Alert alert = driver.switchTo().alert(); + String alertText = alert.getText(); + if (acceptNextAlert) { + alert.accept(); + } else { + alert.dismiss(); + } + return alertText; + } finally { + acceptNextAlert = true; + } + } +} diff --git a/tests/seleniumjava/PHPAiravataTest/src/test/java/com/example/tests/appcatalog/example/tests/EditComputeResource.java b/tests/seleniumjava/PHPAiravataTest/src/test/java/com/example/tests/appcatalog/example/tests/EditComputeResource.java new file mode 100644 index 0000000..37914ea --- /dev/null +++ b/tests/seleniumjava/PHPAiravataTest/src/test/java/com/example/tests/appcatalog/example/tests/EditComputeResource.java @@ -0,0 +1,261 @@ +package com.example.tests.appcatalog.example.tests; + +import java.util.concurrent.TimeUnit; + +import com.example.tests.UserLogin; +import com.example.tests.utils.CurrentDateTime; +import com.example.tests.utils.ExpFileReadUtils; +import org.junit.*; +import static org.junit.Assert.*; + +import org.openqa.selenium.*; +import org.openqa.selenium.firefox.FirefoxDriver; +import org.openqa.selenium.support.ui.Select; + +/* + **********Create a Compute Resource********** + * Created by Eroma on 11/12/14. + * The script creates a new Compute Resource with Description, Queues, File system, Job and Data MMovement Interfaces + * Some input parameters are read from the exp.properties file fore ease of use + * Modified by Eroma on 12/08/14. +*/ + +public class EditComputeResource extends UserLogin { + private WebDriver driver; + private String baseUrl; + private String subUrl; + private String computeResourceID; + private boolean acceptNextAlert = true; + private StringBuffer verificationErrors = new StringBuffer(); + + @Before + public void setUp() throws Exception { + driver = new FirefoxDriver(); + baseUrl = ExpFileReadUtils.readProperty("base.url"); + subUrl = ExpFileReadUtils.readProperty("sub.url"); + computeResourceID = ExpFileReadUtils.readProperty("computeResource.ID"); + driver.manage().timeouts().implicitlyWait(30, TimeUnit.SECONDS); + } + + @Test + public void testEditComputeResource() throws Exception { + driver.get(baseUrl + subUrl); + authenticate(driver); + driver.findElement(By.linkText("Compute Resource")).click(); + driver.findElement(By.id("browse")).click(); + assertEquals(computeResourceID, driver.findElement(By.xpath("(//tr[@id='crDetails']/td[2])[81]")).getText()); + //assertEquals("TEST_COMP_RES_2014-12-10T15:34:56_e842c9dd-03c6-473d-9395-3425fb2ee27d", driver.findElement(By.xpath("(//tr[@id='crDetails']/td[2])[29]")).getText()); + //System.out.println("here1 ....."); + String id_ = computeResourceID; + for(int h = 1; h < 100; ++h) { + String findPath = "(//tr[@id='crDetails']/td[2])[" + h + "]"; + String foundid = driver.findElement(By.xpath(findPath)).getText(); + //System.out.println(foundid); + if (foundid.equals(id_)) { + String clickId = "(//tr[@id='crDetails']/td[3]/a/span)[" + h + "]"; + //System.out.println(clickId); + driver.findElement(By.xpath(clickId)).click(); + break; + } + } + //driver.findElement(By.xpath("(//tr[@id='crDetails']/td[3]/a/span)[81]")).click(); + driver.findElement(By.name("hostname")).clear(); + driver.findElement(By.name("hostname")).sendKeys("TEST_COMP_RES_MODIFIED" + CurrentDateTime.getTodayDate()); + driver.findElement(By.name("hostaliases[]")).clear(); + driver.findElement(By.name("hostaliases[]")).sendKeys("ALIAS_1_MODIFIED"); + driver.findElement(By.xpath("(//input[@name='hostaliases[]'])[2]")).clear(); + driver.findElement(By.xpath("(//input[@name='hostaliases[]'])[2]")).sendKeys("ALIAS_2_MODIFIED"); + driver.findElement(By.name("ips[]")).clear(); + driver.findElement(By.name("ips[]")).sendKeys("100.125.225.195"); + driver.findElement(By.xpath("(//input[@name='ips[]'])[2]")).clear(); + driver.findElement(By.xpath("(//input[@name='ips[]'])[2]")).sendKeys("2.5.6.200"); + driver.findElement(By.name("step1")).click(); + driver.findElement(By.name("description")).clear(); + driver.findElement(By.name("description")).sendKeys("ADD_COMPUTE_RESOURCE_DESCRIPTION_MODIFIED"); + driver.findElement(By.name("step1")).click(); + driver.findElement(By.linkText("Queues")).click(); + try { + assertEquals("TEST-NORMAL", driver.findElement(By.linkText("TEST-NORMAL")).getText()); + } catch (Error e) { + verificationErrors.append(e.toString()); + } + driver.findElement(By.xpath("//div[@id='accordion']/div/div/h4/div/span")).click(); + driver.findElement(By.cssSelector("#delete-queue > div.modal-dialog > div.modal-content > form > div.modal-footer > button.btn.btn-danger")).click(); + try { + assertEquals("TEST-VIP", driver.findElement(By.linkText("TEST-VIP")).getText()); + } catch (Error e) { + verificationErrors.append(e.toString()); + } + driver.findElement(By.linkText("TEST-VIP")).click(); + driver.findElement(By.name("qdesc")).clear(); + driver.findElement(By.name("qdesc")).sendKeys("TEST QUEUE DESCRIPTION MODIFIED"); + driver.findElement(By.name("qmaxruntime")).clear(); + driver.findElement(By.name("qmaxruntime")).sendKeys("900"); + driver.findElement(By.name("qmaxnodes")).clear(); + driver.findElement(By.name("qmaxnodes")).sendKeys("3500"); + driver.findElement(By.name("qmaxprocessors")).clear(); + driver.findElement(By.name("qmaxprocessors")).sendKeys("640"); + driver.findElement(By.name("qmaxjobsinqueue")).clear(); + driver.findElement(By.name("qmaxjobsinqueue")).sendKeys("9990"); + driver.findElement(By.cssSelector("div.queue > div.form-group > input[name=\"step1\"]")).click(); + driver.findElement(By.xpath("(//button[@type='button'])[4]")).click(); + driver.findElement(By.xpath("(//input[@name='qname'])[3]")).clear(); + driver.findElement(By.xpath("(//input[@name='qname'])[3]")).sendKeys("TEST-NORMAL"); + driver.findElement(By.xpath("(//textarea[@name='qdesc'])[3]")).clear(); + driver.findElement(By.xpath("(//textarea[@name='qdesc'])[3]")).sendKeys("TEST QUEUE DESCRIPTION"); + driver.findElement(By.xpath("(//input[@name='qmaxruntime'])[3]")).clear(); + driver.findElement(By.xpath("(//input[@name='qmaxruntime'])[3]")).sendKeys("25"); + driver.findElement(By.xpath("(//input[@name='qmaxnodes'])[3]")).clear(); + driver.findElement(By.xpath("(//input[@name='qmaxnodes'])[3]")).sendKeys("64"); + driver.findElement(By.xpath("(//input[@name='qmaxprocessors'])[3]")).clear(); + driver.findElement(By.xpath("(//input[@name='qmaxprocessors'])[3]")).sendKeys("100"); + driver.findElement(By.xpath("(//input[@name='qmaxjobsinqueue'])[3]")).clear(); + driver.findElement(By.xpath("(//input[@name='qmaxjobsinqueue'])[3]")).sendKeys("2500"); + driver.findElement(By.xpath("(//input[@name='step1'])[4]")).click(); + driver.findElement(By.linkText("FileSystem")).click(); + driver.findElement(By.name("fileSystems[0]")).clear(); + driver.findElement(By.name("fileSystems[0]")).sendKeys("TEST/LOCAL/CURRENT/HOME/MODIFIED"); + driver.findElement(By.name("fileSystems[1]")).clear(); + driver.findElement(By.name("fileSystems[1]")).sendKeys("TEST/LOCAL/CURRENT/WORK/MODIFIED"); + driver.findElement(By.name("fileSystems[2]")).clear(); + driver.findElement(By.name("fileSystems[2]")).sendKeys("TEST/LOCAL/CURRENT/LOCALTMP/MODIFIED"); + driver.findElement(By.name("fileSystems[3]")).clear(); + driver.findElement(By.name("fileSystems[3]")).sendKeys("TEST/LOCAL/CURRENT/SCRATCH/MODIFIED"); + driver.findElement(By.name("fileSystems[4]")).clear(); + driver.findElement(By.name("fileSystems[4]")).sendKeys("TEST/LOCAL/CURRENT/ARCHIVE/MODIFIED"); + driver.findElement(By.cssSelector("button.btn.btn-prim")).click(); + driver.findElement(By.linkText("Job Submission Interfaces")).click(); + try { + assertEquals("Job Submission Protocol : LOCAL", driver.findElement(By.cssSelector("form > h4")).getText()); + } catch (Error e) { + verificationErrors.append(e.toString()); + } + driver.findElement(By.cssSelector("button.close.delete-jsi")).click(); + driver.findElement(By.xpath("(//button[@type='submit'])[7]")).click(); + new Select(driver.findElement(By.name("securityProtocol"))).selectByVisibleText("USERNAME_PASSWORD"); + driver.findElement(By.name("alternativeSSHHostName")).clear(); + driver.findElement(By.name("alternativeSSHHostName")).sendKeys("HOST4_MODIFIED"); + driver.findElement(By.name("sshPort")).clear(); + driver.findElement(By.name("sshPort")).sendKeys("8888"); + new Select(driver.findElement(By.name("resourceJobManagerType"))).selectByVisibleText("PBS"); + driver.findElement(By.name("pushMonitoringEndpoint")).clear(); + driver.findElement(By.name("pushMonitoringEndpoint")).sendKeys("TEST_END_POINT_MODIFIED"); + driver.findElement(By.name("jobManagerBinPath")).clear(); + driver.findElement(By.name("jobManagerBinPath")).sendKeys("TEST/PATH/HOME/CURRENT/LOCAL/BIN/MODIFIED"); + driver.findElement(By.name("jobManagerCommands[0]")).clear(); + driver.findElement(By.name("jobManagerCommands[0]")).sendKeys("TEST_SUBMISSION_MOD"); + driver.findElement(By.name("jobManagerCommands[1]")).clear(); + driver.findElement(By.name("jobManagerCommands[1]")).sendKeys("TEST_MONITORING_MOD"); + driver.findElement(By.name("jobManagerCommands[2]")).clear(); + driver.findElement(By.name("jobManagerCommands[2]")).sendKeys("TEST_DELETION_MOD"); + driver.findElement(By.name("jobManagerCommands[3]")).clear(); + driver.findElement(By.name("jobManagerCommands[3]")).sendKeys("TEST_CHECK_JOB_MOD"); + driver.findElement(By.name("jobManagerCommands[4]")).clear(); + driver.findElement(By.name("jobManagerCommands[4]")).sendKeys("TEST_SHOW_QUEUE_MOD"); + driver.findElement(By.name("jobManagerCommands[5]")).clear(); + driver.findElement(By.name("jobManagerCommands[5]")).sendKeys("TEST_SHOW_RESERVATION_MOD"); + driver.findElement(By.name("jobManagerCommands[6]")).clear(); + driver.findElement(By.name("jobManagerCommands[6]")).sendKeys("TEST_SHOW_START_MOD"); + driver.findElement(By.cssSelector("div.job-protocol-block > form > div.form-group > button.btn")).click(); + driver.findElement(By.xpath("(//button[@type='button'])[5]")).click(); + new Select(driver.findElement(By.cssSelector("div.job-protocol-block.col-md-12 > form > div.form-group > select[name=\"jobSubmissionProtocol\"]"))).selectByVisibleText("LOCAL"); + new Select(driver.findElement(By.cssSelector("div.resourcemanager-local > div.select-resource-manager-type > div.form-group.required > select[name=\"resourceJobManagerType\"]"))).selectByVisibleText("UGE"); + driver.findElement(By.cssSelector("div.resourcemanager-local > div.form-group > input[name=\"pushMonitoringEndpoint\"]")).clear(); + driver.findElement(By.cssSelector("div.resourcemanager-local > div.form-group > input[name=\"pushMonitoringEndpoint\"]")).sendKeys("TEST_END_POINT`"); + driver.findElement(By.cssSelector("div.resourcemanager-local > div.form-group > input[name=\"jobManagerBinPath\"]")).clear(); + driver.findElement(By.cssSelector("div.resourcemanager-local > div.form-group > input[name=\"jobManagerBinPath\"]")).sendKeys("TEST_E PATH/HOME/BIN/CURRENT/LOCAL"); + driver.findElement(By.cssSelector("div.resourcemanager-local > div.form-group > input[name=\"jobManagerCommands[0]\"]")).clear(); + driver.findElement(By.cssSelector("div.resourcemanager-local > div.form-group > input[name=\"jobManagerCommands[0]\"]")).sendKeys("TEST_QSUBM"); + driver.findElement(By.cssSelector("div.resourcemanager-local > div.form-group > input[name=\"jobManagerCommands[1]\"]")).clear(); + driver.findElement(By.cssSelector("div.resourcemanager-local > div.form-group > input[name=\"jobManagerCommands[1]\"]")).sendKeys("TEST_QMONITOR"); + driver.findElement(By.cssSelector("div.resourcemanager-local > div.form-group > input[name=\"jobManagerCommands[2]\"]")).clear(); + driver.findElement(By.cssSelector("div.resourcemanager-local > div.form-group > input[name=\"jobManagerCommands[2]\"]")).sendKeys("TEST_DELETION"); + driver.findElement(By.cssSelector("div.resourcemanager-local > div.form-group > input[name=\"jobManagerCommands[3]\"]")).clear(); + driver.findElement(By.cssSelector("div.resourcemanager-local > div.form-group > input[name=\"jobManagerCommands[3]\"]")).sendKeys("TEST_QCHKJB"); + driver.findElement(By.cssSelector("div.resourcemanager-local > div.form-group > input[name=\"jobManagerCommands[4]\"]")).clear(); + driver.findElement(By.cssSelector("div.resourcemanager-local > div.form-group > input[name=\"jobManagerCommands[4]\"]")).sendKeys("TEST_QSHWQU"); + driver.findElement(By.cssSelector("div.resourcemanager-local > div.form-group > input[name=\"jobManagerCommands[5]\"]")).clear(); + driver.findElement(By.cssSelector("div.resourcemanager-local > div.form-group > input[name=\"jobManagerCommands[5]\"]")).sendKeys("TEST_E_QRESERVATION"); + driver.findElement(By.cssSelector("div.resourcemanager-local > div.form-group > input[name=\"jobManagerCommands[6]\"]")).clear(); + driver.findElement(By.cssSelector("div.resourcemanager-local > div.form-group > input[name=\"jobManagerCommands[6]\"]")).sendKeys("TEST_E_QSTART"); + driver.findElement(By.xpath("(//button[@type='submit'])[8]")).click(); + driver.findElement(By.xpath("(//button[@type='button'])[6]")).click(); + driver.findElement(By.name("jsi-priority[]")).clear(); + driver.findElement(By.name("jsi-priority[]")).sendKeys("1"); + driver.findElement(By.xpath("(//input[@name='jsi-priority[]'])[2]")).clear(); + driver.findElement(By.xpath("(//input[@name='jsi-priority[]'])[2]")).sendKeys("2"); + driver.findElement(By.cssSelector("button.btn.btn-update")).click(); + driver.findElement(By.linkText("Data Movement Interfaces")).click(); + try { + assertEquals("Data Movement Protocol : LOCAL", driver.findElement(By.cssSelector("div.data-movement-block > form > h4")).getText()); + } catch (Error e) { + verificationErrors.append(e.toString()); + } + driver.findElement(By.cssSelector("button.close.delete-dmi")).click(); + driver.findElement(By.xpath("(//button[@type='submit'])[8]")).click(); + driver.findElement(By.xpath("(//button[@type='button'])[9]")).click(); + new Select(driver.findElement(By.cssSelector("div.data-movement-block.col-md-12 > form > select[name=\"dataMovementProtocol\"]"))).selectByVisibleText("LOCAL"); + driver.findElement(By.xpath("(//button[@type='submit'])[10]")).click(); + new Select(driver.findElement(By.cssSelector("div.data-movement-block > form > div.form-group > select[name=\"securityProtocol\"]"))).selectByVisibleText("SSH_KEYS"); + driver.findElement(By.cssSelector("div.data-movement-block > form > div.form-group > input[name=\"alternativeSSHHostName\"]")).clear(); + driver.findElement(By.cssSelector("div.data-movement-block > form > div.form-group > input[name=\"alternativeSSHHostName\"]")).sendKeys("HOST5_MODIFIED"); + driver.findElement(By.cssSelector("div.data-movement-block > form > div.form-group > input[name=\"sshPort\"]")).clear(); + driver.findElement(By.cssSelector("div.data-movement-block > form > div.form-group > input[name=\"sshPort\"]")).sendKeys("9999"); + driver.findElement(By.cssSelector("div.data-movement-block > form > div.form-group > button.btn")).click(); + new Select(driver.findElement(By.xpath("(//select[@name='securityProtocol'])[3]"))).selectByVisibleText("KERBEROS"); + driver.findElement(By.name("gridFTPEndPoints[]")).clear(); + driver.findElement(By.name("gridFTPEndPoints[]")).sendKeys("TEST_E-END1_MODIFIED"); + driver.findElement(By.xpath("(//input[@name='gridFTPEndPoints[]'])[2]")).clear(); + driver.findElement(By.xpath("(//input[@name='gridFTPEndPoints[]'])[2]")).sendKeys("TEST_E-END2_MODIFIED"); + driver.findElement(By.xpath("(//button[@type='button'])[14]")).click(); + driver.findElement(By.xpath("(//input[@name='gridFTPEndPoints[]'])[3]")).clear(); + driver.findElement(By.xpath("(//input[@name='gridFTPEndPoints[]'])[3]")).sendKeys("TEST_E-END3_ADD"); + driver.findElement(By.cssSelector("div.form-group > div.form-group > button.btn")).click(); + driver.findElement(By.xpath("(//button[@type='button'])[10]")).click(); + driver.findElement(By.name("dmi-priority[]")).clear(); + driver.findElement(By.name("dmi-priority[]")).sendKeys("1"); + driver.findElement(By.cssSelector("#dmi-priority-form > button.btn.btn-update")).click(); + } + + @After + public void tearDown() throws Exception { + driver.quit(); + String verificationErrorString = verificationErrors.toString(); + if (!"".equals(verificationErrorString)) { + fail(verificationErrorString); + } + } + + private boolean isElementPresent(By by) { + try { + driver.findElement(by); + return true; + } catch (NoSuchElementException e) { + return false; + } + } + + private boolean isAlertPresent() { + try { + driver.switchTo().alert(); + return true; + } catch (NoAlertPresentException e) { + return false; + } + } + + private String closeAlertAndGetItsText() { + try { + Alert alert = driver.switchTo().alert(); + String alertText = alert.getText(); + if (acceptNextAlert) { + alert.accept(); + } else { + alert.dismiss(); + } + return alertText; + } finally { + acceptNextAlert = true; + } + } +} diff --git a/tests/seleniumjava/PHPAiravataTest/src/test/java/com/example/tests/appcatalog/example/tests/ModCompResource.java b/tests/seleniumjava/PHPAiravataTest/src/test/java/com/example/tests/appcatalog/example/tests/ModCompResource.java new file mode 100644 index 0000000..bd9edd3 --- /dev/null +++ b/tests/seleniumjava/PHPAiravataTest/src/test/java/com/example/tests/appcatalog/example/tests/ModCompResource.java @@ -0,0 +1,271 @@ +package com.example.tests.appcatalog.example.tests; + +import java.util.concurrent.TimeUnit; + +import com.example.tests.UserLogin; +import com.example.tests.utils.CurrentDateTime; +import com.example.tests.utils.ExpFileReadUtils; +import org.junit.*; +import static org.junit.Assert.*; + +import org.openqa.selenium.*; +import org.openqa.selenium.firefox.FirefoxDriver; +import org.openqa.selenium.support.ui.Select; +/* + **********Create a Compute Resource********** + * Created by Eroma on 11/12/14. + * The script creates a new Compute Resource with Description, Queues, File system, Job and Data MMovement Interfaces + * Some input parameters are read from the exp.properties file fore ease of use + * Modified by Eroma on 12/08/14. +*/ + +public class ModCompResource extends UserLogin { + private WebDriver driver; + private String baseUrl; + private String subUrl; + private boolean acceptNextAlert = true; + private StringBuffer verificationErrors = new StringBuffer(); + + @Before + public void setUp() throws Exception { + driver = new FirefoxDriver(); + baseUrl = ExpFileReadUtils.readProperty("base.url"); + subUrl = ExpFileReadUtils.readProperty("sub.url"); + driver.manage().timeouts().implicitlyWait(30, TimeUnit.SECONDS); + } + + @Test + public void testModCompResource() throws Exception { + driver.get(baseUrl + subUrl); + authenticate(driver); + driver.findElement(By.linkText("Compute Resource")).click(); + driver.findElement(By.id("browse")).click(); + //System.out.println("here1 ....."); + String id_ = "TEST_COMP_RES_2014-12-09T16:07:31_06a36d00-97f9-4e54-8c91-394e1817c08b"; + for(int h = 1; h < 100; ++h) { + String findPath = "(//tr[@id='crDetails']/td[2])[" + h + "]"; + String foundid = driver.findElement(By.xpath(findPath)).getText(); + //System.out.println(foundid); + if (foundid.equals(id_)) { + String clickId = "(//tr[@id='crDetails']/td[3]/a/span)[" + h + "]"; + //System.out.println(clickId); + driver.findElement(By.xpath(clickId)).click(); + break; + } + } + + driver.findElement(By.name("hostname")).clear(); + driver.findElement(By.name("hostname")).sendKeys("MODIFIED_COMP_" + CurrentDateTime.getTodayDate()); + driver.findElement(By.name("hostaliases[]")).clear(); + driver.findElement(By.name("hostaliases[]")).sendKeys("CH8"); + driver.findElement(By.xpath("(//input[@name='hostaliases[]'])[2]")).clear(); + driver.findElement(By.xpath("(//input[@name='hostaliases[]'])[2]")).sendKeys("CMPHOST8"); + driver.findElement(By.name("ips[]")).clear(); + driver.findElement(By.name("ips[]")).sendKeys("1.2.3.4.5"); + driver.findElement(By.xpath("(//input[@name='ips[]'])[2]")).clear(); + driver.findElement(By.xpath("(//input[@name='ips[]'])[2]")).sendKeys("100.100.100.100.5"); + driver.findElement(By.name("description")).clear(); + driver.findElement(By.name("description")).sendKeys("TEST_E-Compute_Resource_Description 7.5"); + driver.findElement(By.name("step1")).click(); + driver.findElement(By.linkText("Queues")).click(); + driver.findElement(By.linkText("Queue : TEST-NORMAL")).click(); + driver.findElement(By.name("qdesc")).clear(); + driver.findElement(By.name("qdesc")).sendKeys("TEST_E-DESCRIPTION MOD"); + driver.findElement(By.name("qmaxruntime")).clear(); + driver.findElement(By.name("qmaxruntime")).sendKeys("303"); + driver.findElement(By.name("qmaxnodes")).clear(); + driver.findElement(By.name("qmaxnodes")).sendKeys("1001"); + driver.findElement(By.name("qmaxprocessors")).clear(); + driver.findElement(By.name("qmaxprocessors")).sendKeys("323"); + driver.findElement(By.name("qmaxjobsinqueue")).clear(); + driver.findElement(By.name("qmaxjobsinqueue")).sendKeys("2002"); + driver.findElement(By.cssSelector("div.queue > div.form-group > input[name=\"step1\"]")).click(); + // driver.findElement(By.xpath("//div[@id='accordion']/div[2]/div/h4/div/span")).click(); + // driver.findElement(By.cssSelector("form > div.modal-footer > button.btn.btn-danger")).click(); + driver.findElement(By.xpath("(//button[@type='button'])[4]")).click(); + driver.findElement(By.cssSelector("div.form-group.well > form > div.queue > div.queue > div.form-group.required > input[name=\"qname\"]")).clear(); + driver.findElement(By.cssSelector("div.form-group.well > form > div.queue > div.queue > div.form-group.required > input[name=\"qname\"]")).sendKeys("TEST-VVIP"); + driver.findElement(By.cssSelector("div.form-group.well > form > div.queue > div.queue > div.form-group > textarea[name=\"qdesc\"]")).clear(); + driver.findElement(By.cssSelector("div.form-group.well > form > div.queue > div.queue > div.form-group > textarea[name=\"qdesc\"]")).sendKeys("VIP User Queue"); + driver.findElement(By.cssSelector("div.form-group.well > form > div.queue > div.queue > div.form-group > input[name=\"qmaxruntime\"]")).clear(); + driver.findElement(By.cssSelector("div.form-group.well > form > div.queue > div.queue > div.form-group > input[name=\"qmaxruntime\"]")).sendKeys("360"); + driver.findElement(By.cssSelector("div.form-group.well > form > div.queue > div.queue > div.form-group > input[name=\"qmaxnodes\"]")).clear(); + driver.findElement(By.cssSelector("div.form-group.well > form > div.queue > div.queue > div.form-group > input[name=\"qmaxnodes\"]")).sendKeys("1000"); + driver.findElement(By.cssSelector("div.form-group.well > form > div.queue > div.queue > div.form-group > input[name=\"qmaxprocessors\"]")).clear(); + driver.findElement(By.cssSelector("div.form-group.well > form > div.queue > div.queue > div.form-group > input[name=\"qmaxprocessors\"]")).sendKeys("320"); + driver.findElement(By.cssSelector("div.form-group.well > form > div.queue > div.queue > div.form-group > input[name=\"qmaxjobsinqueue\"]")).clear(); + driver.findElement(By.cssSelector("div.form-group.well > form > div.queue > div.queue > div.form-group > input[name=\"qmaxjobsinqueue\"]")).sendKeys("550"); + driver.findElement(By.cssSelector("div.form-group.well > form > div.queue > div.form-group > input[name=\"step1\"]")).click(); + //driver.findElement(By.linkText("Queues")).click(); + // driver.findElement(By.xpath("(//button[@type='button'])[4]")).click(); + // driver.findElement(By.cssSelector("div.form-group.well > form > div.queue > div.queue > div.form-group.required > input[name=\"qname\"]")).clear(); + // driver.findElement(By.cssSelector("div.form-group.well > form > div.queue > div.queue > div.form-group.required > input[name=\"qname\"]")).sendKeys("NORMAL"); + // driver.findElement(By.cssSelector("div.form-group.well > form > div.queue > div.form-group > input[name=\"step1\"]")).click(); + //driver.findElement(By.linkText("Description")).click(); + // driver.findElement(By.name("hostaliases[]")).clear(); + // driver.findElement(By.name("hostaliases[]")).sendKeys("CH4_MOD_1.234"); + // driver.findElement(By.linkText("FileSystem")).click(); + // driver.findElement(By.name("fileSystems[0]")).clear(); + // driver.findElement(By.name("fileSystems[0]")).sendKeys("TEST/LOCAL/CURRENT/HOME/MOD/MOD"); + // driver.findElement(By.cssSelector("button.btn.btn-prim")).click(); + // driver.findElement(By.linkText("Description")).click(); + // driver.findElement(By.name("hostaliases[]")).clear(); + // driver.findElement(By.name("hostaliases[]")).sendKeys("CH4_MOD_1.234"); + // driver.findElement(By.name("step1")).click(); + driver.findElement(By.linkText("FileSystem")).click(); + driver.findElement(By.name("fileSystems[0]")).clear(); + driver.findElement(By.name("fileSystems[0]")).sendKeys("TEST_E/LOCAL/CURRENT/VIP/HOME"); + driver.findElement(By.name("fileSystems[1]")).clear(); + driver.findElement(By.name("fileSystems[1]")).sendKeys("TEST_E/LOCAL/CURRENT/VIP/WORK"); + driver.findElement(By.name("fileSystems[2]")).clear(); + driver.findElement(By.name("fileSystems[2]")).sendKeys("TEST_E/LOCAL/CURRENT/VIP/LOCALTMP"); + driver.findElement(By.name("fileSystems[3]")).clear(); + driver.findElement(By.name("fileSystems[3]")).sendKeys("TEST_E/LOCAL/CURRENT/VIP/SCRATCH"); + driver.findElement(By.name("fileSystems[4]")).clear(); + driver.findElement(By.name("fileSystems[4]")).sendKeys("TEST_E/LOCAL/CURRENT/VIP/ARCHIVE"); + driver.findElement(By.cssSelector("button.btn.btn-prim")).click(); + driver.findElement(By.linkText("Job Submission Interfaces")).click(); +// driver.findElement(By.cssSelector("button.close.delete-jsi")).click(); +// driver.findElement(By.xpath("(//button[@type='button'])[23]")).click(); + try { + assertEquals("Job Submission Protocol : SSH", driver.findElement(By.cssSelector("form > h4")).getText()); + } catch (Error e) { + verificationErrors.append(e.toString()); + } + new Select(driver.findElement(By.name("securityProtocol"))).selectByVisibleText("USERNAME_PASSWORD"); + driver.findElement(By.name("alternativeSSHHostName")).clear(); + driver.findElement(By.name("alternativeSSHHostName")).sendKeys("TEST_E-SSH_HOST"); + driver.findElement(By.name("sshPort")).clear(); + driver.findElement(By.name("sshPort")).sendKeys("5555"); + new Select(driver.findElement(By.name("resourceJobManagerType"))).selectByVisibleText("UGE"); + driver.findElement(By.name("pushMonitoringEndpoint")).clear(); + driver.findElement(By.name("pushMonitoringEndpoint")).sendKeys("TEST_E-END_POINT_NULL"); + driver.findElement(By.name("jobManagerBinPath")).clear(); + driver.findElement(By.name("jobManagerBinPath")).sendKeys("TEST_E-PATH/HOME/CURRENT/LOCAL/BIN/VIP"); + driver.findElement(By.name("jobManagerCommands[0]")).clear(); + driver.findElement(By.name("jobManagerCommands[0]")).sendKeys("TEST_E-QSUBMISSION"); + driver.findElement(By.name("jobManagerCommands[1]")).clear(); + driver.findElement(By.name("jobManagerCommands[1]")).sendKeys("TEST_E-QMONITORING"); + driver.findElement(By.name("jobManagerCommands[2]")).clear(); + driver.findElement(By.name("jobManagerCommands[2]")).sendKeys("TEST_E-QDELETION"); + driver.findElement(By.name("jobManagerCommands[3]")).clear(); + driver.findElement(By.name("jobManagerCommands[3]")).sendKeys("TEST_E-QCHECK"); + driver.findElement(By.name("jobManagerCommands[4]")).clear(); + driver.findElement(By.name("jobManagerCommands[4]")).sendKeys("TEST_E-QSHOW"); + driver.findElement(By.name("jobManagerCommands[5]")).clear(); + driver.findElement(By.name("jobManagerCommands[5]")).sendKeys("TEST_E-QRESERVATION"); + driver.findElement(By.name("jobManagerCommands[6]")).clear(); + driver.findElement(By.name("jobManagerCommands[6]")).sendKeys("TEST_E-QSTART"); + driver.findElement(By.cssSelector("div.job-protocol-block > form > div.form-group > button.btn")).click(); + driver.findElement(By.xpath("(//button[@type='button'])[5]")).click(); + new Select(driver.findElement(By.cssSelector("div.job-protocol-block.col-md-12 > form > div.form-group > select[name=\"jobSubmissionProtocol\"]"))).selectByVisibleText("LOCAL"); + new Select(driver.findElement(By.cssSelector("div.resourcemanager-local > div.select-resource-manager-type > div.form-group.required > select[name=\"resourceJobManagerType\"]"))).selectByVisibleText("PBS"); + driver.findElement(By.cssSelector("div.resourcemanager-local > div.form-group > input[name=\"pushMonitoringEndpoint\"]")).clear(); + driver.findElement(By.cssSelector("div.resourcemanager-local > div.form-group > input[name=\"pushMonitoringEndpoint\"]")).sendKeys("PUSH_END_POINT"); + driver.findElement(By.cssSelector("div.resourcemanager-local > div.form-group > input[name=\"jobManagerBinPath\"]")).clear(); + driver.findElement(By.cssSelector("div.resourcemanager-local > div.form-group > input[name=\"jobManagerBinPath\"]")).sendKeys("HOME/BIN"); + driver.findElement(By.cssSelector("div.resourcemanager-local > div.form-group > input[name=\"jobManagerCommands[0]\"]")).clear(); + driver.findElement(By.cssSelector("div.resourcemanager-local > div.form-group > input[name=\"jobManagerCommands[0]\"]")).sendKeys("TEST_E QSUB"); + driver.findElement(By.cssSelector("div.resourcemanager-local > div.form-group > input[name=\"jobManagerCommands[1]\"]")).clear(); + driver.findElement(By.cssSelector("div.resourcemanager-local > div.form-group > input[name=\"jobManagerCommands[1]\"]")).sendKeys("TEST_E QMON"); + driver.findElement(By.cssSelector("div.resourcemanager-local > div.form-group > input[name=\"jobManagerCommands[2]\"]")).clear(); + driver.findElement(By.cssSelector("div.resourcemanager-local > div.form-group > input[name=\"jobManagerCommands[2]\"]")).sendKeys("TEST_E QDEL"); + driver.findElement(By.cssSelector("div.resourcemanager-local > div.form-group > input[name=\"jobManagerCommands[3]\"]")).clear(); + driver.findElement(By.cssSelector("div.resourcemanager-local > div.form-group > input[name=\"jobManagerCommands[3]\"]")).sendKeys("TEST_E QCHK"); + driver.findElement(By.cssSelector("div.resourcemanager-local > div.form-group > input[name=\"jobManagerCommands[4]\"]")).clear(); + driver.findElement(By.cssSelector("div.resourcemanager-local > div.form-group > input[name=\"jobManagerCommands[4]\"]")).sendKeys("TEST_E QSHW"); + driver.findElement(By.cssSelector("div.resourcemanager-local > div.form-group > input[name=\"jobManagerCommands[5]\"]")).clear(); + driver.findElement(By.cssSelector("div.resourcemanager-local > div.form-group > input[name=\"jobManagerCommands[5]\"]")).sendKeys("TEST_E QRESV"); + driver.findElement(By.cssSelector("div.resourcemanager-local > div.form-group > input[name=\"jobManagerCommands[6]\"]")).clear(); + driver.findElement(By.cssSelector("div.resourcemanager-local > div.form-group > input[name=\"jobManagerCommands[6]\"]")).sendKeys("TEST_E-QSTART"); + driver.findElement(By.xpath("(//button[@type='submit'])[7]")).click(); + try { + assertEquals("Job Submission Protocol : LOCAL", driver.findElement(By.cssSelector("form > h4")).getText()); + } catch (Error e) { + verificationErrors.append(e.toString()); + } + driver.findElement(By.cssSelector("button.close.delete-jsi")).click(); + driver.findElement(By.xpath("(//button[@type='submit'])[7]")).click(); + driver.findElement(By.linkText("Data Movement Interfaces")).click(); + try { + assertEquals("Data Movement Protocol : LOCAL", driver.findElement(By.cssSelector("div.data-movement-block > form > h4")).getText()); + } catch (Error e) { + verificationErrors.append(e.toString()); + } + try { + assertEquals("Data Movement Protocol : SCP", driver.findElement(By.xpath("//div[@id='tab-dataMovement']/div[2]/div[2]/form/h4")).getText()); + } catch (Error e) { + verificationErrors.append(e.toString()); + } + driver.findElement(By.cssSelector("div.data-movement-block > form > div.form-group > input[name=\"alternativeSSHHostName\"]")).clear(); + driver.findElement(By.cssSelector("div.data-movement-block > form > div.form-group > input[name=\"alternativeSSHHostName\"]")).sendKeys("HOST5"); + driver.findElement(By.cssSelector("div.data-movement-block > form > div.form-group > input[name=\"sshPort\"]")).clear(); + driver.findElement(By.cssSelector("div.data-movement-block > form > div.form-group > input[name=\"sshPort\"]")).sendKeys("7777"); + driver.findElement(By.cssSelector("div.data-movement-block > form > div.form-group > button.btn")).click(); + try { + assertEquals("Data Movement Protocol : GridFTP", driver.findElement(By.xpath("//div[@id='tab-dataMovement']/div[2]/div[3]/form/h4")).getText()); + } catch (Error e) { + verificationErrors.append(e.toString()); + } + driver.findElement(By.xpath("(//button[@type='button'])[13]")).click(); + driver.findElement(By.xpath("(//button[@type='button'])[19]")).click(); + //driver.findElement(By.cssSelector("div.data-movement-block > form > h4 > button.close")).click(); + //driver.findElement(By.name("gridFTPEndPoints[]")).clear(); + //driver.findElement(By.name("gridFTPEndPoints[]")).sendKeys("END_POINT1_7.5"); + //driver.findElement(By.xpath("(//input[@name='gridFTPEndPoints[]'])[2]")).clear(); + // driver.findElement(By.xpath("(//input[@name='gridFTPEndPoints[]'])[2]")).sendKeys("END_POINT2 7.5"); + //driver.findElement(By.xpath("(//button[@type='button'])[13]")).click(); + //driver.findElement(By.xpath("(//input[@name='gridFTPEndPoints[]'])[3]")).clear(); + //driver.findElement(By.xpath("(//input[@name='gridFTPEndPoints[]'])[3]")).sendKeys("END_POINT3 7.5"); + // driver.findElement(By.name("gridFTPEndPoints[]")).clear(); + //driver.findElement(By.name("gridFTPEndPoints[]")).sendKeys(""); + // driver.findElement(By.cssSelector("div.form-group > div.form-group > button.btn")).click(); + //driver.findElement(By.cssSelector("div.form-group > div.form-group > button.btn")).click(); + // driver.findElement(By.cssSelector("div.form-group > div.form-group > button.btn")).click(); + // driver.findElement(By.name("gridFTPEndPoints[]")).clear(); + // driver.findElement(By.name("gridFTPEndPoints[]")).sendKeys("END_POINT1 7.5"); + // driver.findElement(By.cssSelector("div.form-group > div.form-group > button.btn")).click(); + } + + @After + public void tearDown() throws Exception { + driver.quit(); + String verificationErrorString = verificationErrors.toString(); + if (!"".equals(verificationErrorString)) { + fail(verificationErrorString); + } + } + + private boolean isElementPresent(By by) { + try { + driver.findElement(by); + return true; + } catch (NoSuchElementException e) { + return false; + } + } + + private boolean isAlertPresent() { + try { + driver.switchTo().alert(); + return true; + } catch (NoAlertPresentException e) { + return false; + } + } + + private String closeAlertAndGetItsText() { + try { + Alert alert = driver.switchTo().alert(); + String alertText = alert.getText(); + if (acceptNextAlert) { + alert.accept(); + } else { + alert.dismiss(); + } + return alertText; + } finally { + acceptNextAlert = true; + } + } +} diff --git a/tests/seleniumjava/PHPAiravataTest/src/test/java/com/example/tests/appcatalog/example/tests/Untitled.java b/tests/seleniumjava/PHPAiravataTest/src/test/java/com/example/tests/appcatalog/example/tests/Untitled.java new file mode 100644 index 0000000..7b19fa8 --- /dev/null +++ b/tests/seleniumjava/PHPAiravataTest/src/test/java/com/example/tests/appcatalog/example/tests/Untitled.java @@ -0,0 +1,89 @@ +package com.example.tests; + +import java.util.regex.Pattern; +import java.util.concurrent.TimeUnit; + +import com.example.tests.utils.ExpFileReadUtils; +import org.junit.*; +import static org.junit.Assert.*; +import static org.hamcrest.CoreMatchers.*; +import org.openqa.selenium.*; +import org.openqa.selenium.firefox.FirefoxDriver; +import org.openqa.selenium.support.ui.Select; + +public class Untitled extends UserLogin { + private WebDriver driver; + private String baseUrl; + private String subUrl; + private String computeResourceID; + private boolean acceptNextAlert = true; + private StringBuffer verificationErrors = new StringBuffer(); + + @Before + public void setUp() throws Exception { + driver = new FirefoxDriver(); + baseUrl = ExpFileReadUtils.readProperty("base.url"); + subUrl = ExpFileReadUtils.readProperty("sub.url"); + computeResourceID = ExpFileReadUtils.readProperty("computeResource.ID"); + driver.manage().timeouts().implicitlyWait(30, TimeUnit.SECONDS); + } + + @Test + public void testUntitled() throws Exception { + driver.get(baseUrl + subUrl); + authenticate(driver); + driver.findElement(By.linkText("App Catalog")).click(); + driver.findElement(By.id("interface")).click(); + driver.findElement(By.xpath("//div/div/div/button")).click(); + driver.findElement(By.cssSelector("div.create-app-interface-block > div.appInterfaceInputs > div.form-group.required > input[name=\"applicationName\"]")).clear(); + driver.findElement(By.cssSelector("div.create-app-interface-block > div.appInterfaceInputs > div.form-group.required > input[name=\"applicationName\"]")).sendKeys("TEST_APP1"); + driver.findElement(By.cssSelector("div.create-app-interface-block > div.appInterfaceInputs > div.form-group > input[name=\"applicationDescription\"]")).clear(); + driver.findElement(By.cssSelector("div.create-app-interface-block > div.appInterfaceInputs > div.form-group > input[name=\"applicationDescription\"]")).sendKeys("TEST APP Interface"); + driver.findElement(By.xpath("(//input[@value=''])[51]")).click(); + new Select(driver.findElement(By.cssSelector("div.create-app-interface-block > div.appInterfaceInputs > div.form-group > div.app-modules > div.input-group > select[name=\"applicationModules[]\"]"))).selectByVisibleText("TEST_APP2014-12-11T03:08:10"); + driver.findElement(By.xpath("//input[@value='Create']")).click(); + driver.findElement(By.xpath("(//input[@value=''])[52]")).click(); + } + + @After + public void tearDown() throws Exception { + driver.quit(); + String verificationErrorString = verificationErrors.toString(); + if (!"".equals(verificationErrorString)) { + fail(verificationErrorString); + } + } + + private boolean isElementPresent(By by) { + try { + driver.findElement(by); + return true; + } catch (NoSuchElementException e) { + return false; + } + } + + private boolean isAlertPresent() { + try { + driver.switchTo().alert(); + return true; + } catch (NoAlertPresentException e) { + return false; + } + } + + private String closeAlertAndGetItsText() { + try { + Alert alert = driver.switchTo().alert(); + String alertText = alert.getText(); + if (acceptNextAlert) { + alert.accept(); + } else { + alert.dismiss(); + } + return alertText; + } finally { + acceptNextAlert = true; + } + } +} diff --git a/tests/seleniumjava/PHPAiravataTest/src/test/java/com/example/tests/exp/example/tests/AmberBR2.java b/tests/seleniumjava/PHPAiravataTest/src/test/java/com/example/tests/exp/example/tests/AmberBR2.java new file mode 100644 index 0000000..8848681 --- /dev/null +++ b/tests/seleniumjava/PHPAiravataTest/src/test/java/com/example/tests/exp/example/tests/AmberBR2.java @@ -0,0 +1,130 @@ +package com.example.tests.exp.example.tests; + +import java.util.concurrent.TimeUnit; + +import com.example.tests.UserLogin; +import com.example.tests.utils.AppCatFileReadUtils; +import com.example.tests.utils.ExpFileReadUtils; +import org.junit.*; +import static org.junit.Assert.*; +import org.openqa.selenium.*; +import org.openqa.selenium.firefox.FirefoxDriver; +import org.openqa.selenium.support.ui.Select; + +/* + **********Executing Amber Application on BR2********** + * Created by Eroma on 9/12/14. + * The script generates Amber application execution on BR2 + * experiment-name and experiment-description are read from the exp.properties file + * Modified by Eroma on 10/23/14. Base URL & Sub URL to be read from the exp.properties file +*/ + +public class AmberBR2 extends UserLogin { + private WebDriver driver; + private String subUrl; + private String baseUrl; + private boolean acceptNextAlert = true; + private StringBuffer verificationErrors = new StringBuffer(); + private String path = null; + private String expName = null; + + @Before + public void setUp() throws Exception { + driver = new FirefoxDriver(); + baseUrl = ExpFileReadUtils.readProperty("base.url"); + subUrl = ExpFileReadUtils.readProperty("sub.url"); + path = ExpFileReadUtils.readProperty("local.path"); + expName = ExpFileReadUtils.readProperty("experiment.name"); + driver.manage().timeouts().implicitlyWait(30, TimeUnit.SECONDS); + + } + + @Test + public void testAmberBR2() throws Exception { + driver.get(baseUrl + subUrl); + authenticate(driver); + driver.findElement(By.linkText("Experiment")).click(); + driver.findElement(By.id("create-experiment")).click(); + driver.findElement(By.id("experiment-name")).clear(); + waitTime (500); + driver.findElement(By.id("experiment-name")).sendKeys(expName +"Amber-BR2"); + driver.findElement(By.id("experiment-description")).clear(); + waitTime (500); + driver.findElement(By.id("experiment-description")).sendKeys("Test Experiment"); + new Select(driver.findElement(By.id("project"))).selectByVisibleText(ExpFileReadUtils.readProperty("project.name")); + waitTime (500); + new Select(driver.findElement(By.id("application"))).selectByVisibleText("Amber"); + waitTime (500); + driver.findElement(By.name("continue")).click(); + driver.findElement(By.id("Heat_Restart_File")).sendKeys(ExpFileReadUtils.AMBER_INPUT1); + waitTime (500); + driver.findElement(By.id("Parameter_Topology_File")).sendKeys(ExpFileReadUtils.AMBER_INPUT2); + waitTime (500); + driver.findElement(By.id("Production_Control_File")).sendKeys(ExpFileReadUtils.AMBER_INPUT3); + waitTime (500); + new Select(driver.findElement(By.id("compute-resource"))).selectByVisibleText("bigred2.uits.iu.edu"); + waitTime (500); + driver.findElement(By.id("node-count")).clear(); + driver.findElement(By.id("node-count")).sendKeys("1"); + driver.findElement(By.id("cpu-count")).clear(); + driver.findElement(By.id("cpu-count")).sendKeys("4"); + driver.findElement(By.id("wall-time")).clear(); + driver.findElement(By.id("wall-time")).sendKeys("30"); + driver.findElement(By.name("launch")).click(); + waitTime (500); + } + + + private void waitTime(int i) { + try { + Thread.sleep(i); + } catch (InterruptedException e) { + e.printStackTrace(); + } + + } + + + @After + public void tearDown() throws Exception { + driver.quit(); + String verificationErrorString = verificationErrors.toString(); + if (!"".equals(verificationErrorString)) { + fail(verificationErrorString); + } + } + + + private boolean isElementPresent(By by) { + try { + driver.findElement(by); + return true; + } catch (NoSuchElementException e) { + return false; + } + } + + private boolean isAlertPresent() { + try { + driver.switchTo().alert(); + return true; + } catch (NoAlertPresentException e) { + return false; + } + } + + private String closeAlertAndGetItsText() { + try { + Alert alert = driver.switchTo().alert(); + String alertText = alert.getText(); + if (acceptNextAlert) { + alert.accept(); + } else { + alert.dismiss(); + } + return alertText; + } finally { + acceptNextAlert = true; + } + } +} diff --git a/tests/seleniumjava/PHPAiravataTest/src/test/java/com/example/tests/exp/example/tests/AmberStampede.java b/tests/seleniumjava/PHPAiravataTest/src/test/java/com/example/tests/exp/example/tests/AmberStampede.java new file mode 100644 index 0000000..6bf9345 --- /dev/null +++ b/tests/seleniumjava/PHPAiravataTest/src/test/java/com/example/tests/exp/example/tests/AmberStampede.java @@ -0,0 +1,131 @@ +package com.example.tests.exp.example.tests; + +import com.example.tests.UserLogin; +import com.example.tests.utils.AppCatFileReadUtils; +import com.example.tests.utils.ExpFileReadUtils; +import org.junit.*; +import org.openqa.selenium.*; +import org.openqa.selenium.firefox.FirefoxDriver; +import org.openqa.selenium.support.ui.Select; + +import java.util.concurrent.TimeUnit; + +import static org.junit.Assert.*; + +/* + **********Executing Amber Application on Stampede********** + * Created by Eroma on 9/15/14. + * The script generates Amber application execution on Stampede + * experiment-name and experiment-description are read from the exp.properties file + * Modified by Eroma on 10/23/14. Base URL & Sub URL to be read from the exp.properties file +*/ + +public class AmberStampede extends UserLogin { + private WebDriver driver; + private String subUrl; + private String baseUrl; + private boolean acceptNextAlert = true; + private StringBuffer verificationErrors = new StringBuffer(); + private String path = null; + private String expName = null; + + @Before + public void setUp() throws Exception { + driver = new FirefoxDriver(); + baseUrl = ExpFileReadUtils.readProperty("base.url"); + subUrl = ExpFileReadUtils.readProperty("sub.url"); + path = ExpFileReadUtils.readProperty("local.path"); + expName = ExpFileReadUtils.readProperty("experiment.name"); + driver.manage().timeouts().implicitlyWait(30, TimeUnit.SECONDS); + + } + + @Test + public void testAmberStampede() throws Exception { + driver.get(baseUrl + subUrl); + authenticate(driver); + driver.findElement(By.linkText("Project")).click(); + driver.findElement(By.linkText("Experiment")).click(); + driver.findElement(By.id("create-experiment")).click(); + driver.findElement(By.id("experiment-name")).clear(); + driver.findElement(By.id("experiment-name")).sendKeys(expName + "Amber-Stampede"); + waitTime (500); + driver.findElement(By.id("experiment-description")).clear(); + driver.findElement(By.id("experiment-description")).sendKeys("Test Experiment"); + waitTime (500); + new Select(driver.findElement(By.id("project"))).selectByVisibleText(ExpFileReadUtils.readProperty("project.name")); + waitTime (500); + new Select(driver.findElement(By.id("application"))).selectByVisibleText("Amber"); + waitTime (500); + driver.findElement(By.name("continue")).click(); + waitTime (500); + driver.findElement(By.id("Heat_Restart_File")).sendKeys(ExpFileReadUtils.AMBER_INPUT1); + waitTime (500); + driver.findElement(By.id("Parameter_Topology_File")).sendKeys(ExpFileReadUtils.AMBER_INPUT2); + waitTime (500); + driver.findElement(By.id("Production_Control_File")).sendKeys(ExpFileReadUtils.AMBER_INPUT3); + waitTime (500); + new Select(driver.findElement(By.id("compute-resource"))).selectByVisibleText("stampede.tacc.xsede.org"); + waitTime (500); + driver.findElement(By.id("node-count")).clear(); + driver.findElement(By.id("node-count")).sendKeys("1"); + driver.findElement(By.id("cpu-count")).clear(); + driver.findElement(By.id("cpu-count")).sendKeys("4"); + driver.findElement(By.id("wall-time")).clear(); + driver.findElement(By.id("wall-time")).sendKeys("30"); + driver.findElement(By.name("launch")).click(); + waitTime (500); + } + + private void waitTime(int i) { + try { + Thread.sleep(i); + } catch (InterruptedException e) { + e.printStackTrace(); + } + + } + + + @After + public void tearDown() throws Exception { + driver.quit(); + String verificationErrorString = verificationErrors.toString(); + if (!"".equals(verificationErrorString)) { + fail(verificationErrorString); + } + } + + private boolean isElementPresent(By by) { + try { + driver.findElement(by); + return true; + } catch (NoSuchElementException e) { + return false; + } + } + + private boolean isAlertPresent() { + try { + driver.switchTo().alert(); + return true; + } catch (NoAlertPresentException e) { + return false; + } + } + + private String closeAlertAndGetItsText() { + try { + Alert alert = driver.switchTo().alert(); + String alertText = alert.getText(); + if (acceptNextAlert) { + alert.accept(); + } else { + alert.dismiss(); + } + return alertText; + } finally { + acceptNextAlert = true; + } + } +} diff --git a/tests/seleniumjava/PHPAiravataTest/src/test/java/com/example/tests/exp/example/tests/AmberTrestles.java b/tests/seleniumjava/PHPAiravataTest/src/test/java/com/example/tests/exp/example/tests/AmberTrestles.java new file mode 100644 index 0000000..0649083 --- /dev/null +++ b/tests/seleniumjava/PHPAiravataTest/src/test/java/com/example/tests/exp/example/tests/AmberTrestles.java @@ -0,0 +1,130 @@ +package com.example.tests.exp.example.tests; + +import java.util.concurrent.TimeUnit; + +import com.example.tests.UserLogin; +import com.example.tests.utils.AppCatFileReadUtils; +import com.example.tests.utils.ExpFileReadUtils; +import org.junit.*; +import static org.junit.Assert.*; + +import org.openqa.selenium.*; +import org.openqa.selenium.firefox.FirefoxDriver; +import org.openqa.selenium.support.ui.Select; + +/* + **********Executing Amber Application on Trestles********** + * Created by Eroma on 9/16/14. + * The script generates Amber application execution on Trestles + * experiment-name and experiment-description are read from the exp.properties file + * Modified by Eroma on 10/23/14. Base URL & Sub URL to be read from the exp.properties file +*/ + +public class AmberTrestles extends UserLogin { + private WebDriver driver; + private String baseUrl; + private String subUrl; + private boolean acceptNextAlert = true; + private StringBuffer verificationErrors = new StringBuffer(); + private String path = null; + private String expName = null; + + @Before + public void setUp() throws Exception { + driver = new FirefoxDriver(); + baseUrl = ExpFileReadUtils.readProperty("base.url"); + subUrl = ExpFileReadUtils.readProperty("sub.url"); + path = ExpFileReadUtils.readProperty("local.path"); + expName = ExpFileReadUtils.readProperty("experiment.name"); + driver.manage().timeouts().implicitlyWait(30, TimeUnit.SECONDS); + } + + @Test + public void testAmberTrestles() throws Exception { + driver.get(baseUrl + subUrl); + authenticate(driver); + driver.findElement(By.linkText("Experiment")).click(); + driver.findElement(By.id("create-experiment")).click(); + waitTime (500); + driver.findElement(By.id("experiment-name")).clear(); + driver.findElement(By.id("experiment-name")).sendKeys(expName + "Amber-Trestles"); + waitTime (500); + driver.findElement(By.id("experiment-description")).clear(); + driver.findElement(By.id("experiment-description")).sendKeys("Test Experiment"); + waitTime (500); + new Select(driver.findElement(By.id("project"))).selectByVisibleText(ExpFileReadUtils.readProperty("project.name")); + waitTime (500); + new Select(driver.findElement(By.id("application"))).selectByVisibleText("Amber"); + waitTime (500); + driver.findElement(By.name("continue")).click(); + waitTime (500); + driver.findElement(By.id("Heat_Restart_File")).sendKeys(ExpFileReadUtils.AMBER_INPUT1); + waitTime (500); + driver.findElement(By.id("Parameter_Topology_File")).sendKeys(ExpFileReadUtils.AMBER_INPUT2); + waitTime (500); + driver.findElement(By.id("Production_Control_File")).sendKeys(ExpFileReadUtils.AMBER_INPUT3); + waitTime (500); + new Select(driver.findElement(By.id("compute-resource"))).selectByVisibleText("trestles.sdsc.xsede.org"); + waitTime (500); + driver.findElement(By.id("node-count")).clear(); + driver.findElement(By.id("node-count")).sendKeys("1"); + driver.findElement(By.id("cpu-count")).clear(); + driver.findElement(By.id("cpu-count")).sendKeys("4"); + driver.findElement(By.id("wall-time")).clear(); + driver.findElement(By.id("wall-time")).sendKeys("30"); + driver.findElement(By.name("launch")).click(); + waitTime (500); + } + + private void waitTime(int i) { + try { + Thread.sleep(i); + } catch (InterruptedException e) { + e.printStackTrace(); + } + + } + + + @After + public void tearDown() throws Exception { + driver.quit(); + String verificationErrorString = verificationErrors.toString(); + if (!"".equals(verificationErrorString)) { + fail(verificationErrorString); + } + } + + private boolean isElementPresent(By by) { + try { + driver.findElement(by); + return true; + } catch (NoSuchElementException e) { + return false; + } + } + + private boolean isAlertPresent() { + try { + driver.switchTo().alert(); + return true; + } catch (NoAlertPresentException e) { + return false; + } + } + + private String closeAlertAndGetItsText() { + try { + Alert alert = driver.switchTo().alert(); + String alertText = alert.getText(); + if (acceptNextAlert) { + alert.accept(); + } else { + alert.dismiss(); + } + return alertText; + } finally { + acceptNextAlert = true; + } + } +} diff --git a/tests/seleniumjava/PHPAiravataTest/src/test/java/com/example/tests/exp/example/tests/CreateModifySearchProject.java b/tests/seleniumjava/PHPAiravataTest/src/test/java/com/example/tests/exp/example/tests/CreateModifySearchProject.java new file mode 100644 index 0000000..680f56e --- /dev/null +++ b/tests/seleniumjava/PHPAiravataTest/src/test/java/com/example/tests/exp/example/tests/CreateModifySearchProject.java @@ -0,0 +1,123 @@ +package com.example.tests.exp.example.tests; + +import java.util.concurrent.TimeUnit; + +import com.example.tests.UserLogin; +import com.example.tests.utils.ExpFileReadUtils; + +import org.junit.After; +import org.junit.Before; +import org.junit.Test; +import org.openqa.selenium.*; +import org.openqa.selenium.firefox.FirefoxDriver; + +import static org.testng.Assert.fail; + +/* + **********Create, Modify & Search Project********** + * Created by Airavata on 9/12/14. + * The script creates, modifies and searches for the created Project + * project-name and project-description are read from the exp.properties file + * Modified by Eroma on 10/23/14. Base URL & Sub URL to be read from the exp.properties file +*/ + + +public class CreateModifySearchProject extends UserLogin { + private WebDriver driver; + private String subUrl; + private String baseUrl; + private String projectDescription; + private boolean acceptNextAlert = true; + private StringBuffer verificationErrors = new StringBuffer(); + + @Before + public void setUp() throws Exception { + driver = new FirefoxDriver(); + baseUrl = ExpFileReadUtils.readProperty("base.url"); + subUrl = ExpFileReadUtils.readProperty("sub.url"); + projectDescription = ExpFileReadUtils.readProperty("project.description"); + driver.manage().timeouts().implicitlyWait(30, TimeUnit.SECONDS); + } + + @Test + public void testCreateModifySearchProject() throws Exception { + driver.get(baseUrl + subUrl); + authenticate(driver); + driver.findElement(By.linkText("Project")).click(); + driver.findElement(By.id("create-project")).click(); + driver.findElement(By.id("project-name")).clear(); + driver.findElement(By.id("project-name")).sendKeys(ExpFileReadUtils.readProperty("project.name")); + waitTime (500); + driver.findElement(By.id("project-description")).clear(); + driver.findElement(By.id("project-description")).sendKeys(projectDescription); + waitTime (500); + driver.findElement(By.name("save")).click(); + waitTime(750); + driver.findElement(By.cssSelector("span.glyphicon.glyphicon-pencil")).click(); + driver.findElement(By.id("project-description")).clear(); + driver.findElement(By.id("project-description")).sendKeys(projectDescription + "_MODIFIED_2014"); + waitTime(500); + driver.findElement(By.name("save")).click(); + waitTime(500); + driver.findElement(By.linkText("Project")).click(); + driver.findElement(By.id("search-projects")).click(); + waitTime(500); + driver.findElement(By.id("search-value")).clear(); + driver.findElement(By.id("search-value")).sendKeys(ExpFileReadUtils.readProperty("project.name")); + waitTime(500); + driver.findElement(By.name("search")).click(); + driver.findElement(By.linkText("View")).click(); + waitTime(500); + } + + private void waitTime(int i) { + try { + Thread.sleep(i); + } catch (InterruptedException e) { + e.printStackTrace(); + } + + } + + @After + public void tearDown() throws Exception { + driver.quit(); + String verificationErrorString = verificationErrors.toString(); + if (!"".equals(verificationErrorString)) { + fail(verificationErrorString); + } + } + + private boolean isElementPresent(By by) { + try { + driver.findElement(by); + return true; + } catch (NoSuchElementException e) { + return false; + } + } + + private boolean isAlertPresent() { + try { + driver.switchTo().alert(); + return true; + } catch (NoAlertPresentException e) { + return false; + } + } + + private String closeAlertAndGetItsText() { + try { + Alert alert = driver.switchTo().alert(); + String alertText = alert.getText(); + if (acceptNextAlert) { + alert.accept(); + } else { + alert.dismiss(); + } + return alertText; + } finally { + acceptNextAlert = true; + } + } +} diff --git a/tests/seleniumjava/PHPAiravataTest/src/test/java/com/example/tests/exp/example/tests/CreateUserLogin.java b/tests/seleniumjava/PHPAiravataTest/src/test/java/com/example/tests/exp/example/tests/CreateUserLogin.java new file mode 100644 index 0000000..de3e793 --- /dev/null +++ b/tests/seleniumjava/PHPAiravataTest/src/test/java/com/example/tests/exp/example/tests/CreateUserLogin.java @@ -0,0 +1,109 @@ +package com.example.tests.exp.example.tests; + +import java.util.concurrent.TimeUnit; + +import com.example.tests.utils.ExpFileReadUtils; +import org.junit.*; +import static org.junit.Assert.*; + +import org.openqa.selenium.*; +import org.openqa.selenium.firefox.FirefoxDriver; + +public class CreateUserLogin { + private WebDriver driver; + private String baseUrl; + private boolean acceptNextAlert = true; + private StringBuffer verificationErrors = new StringBuffer(); + + @Before + public void setUp() throws Exception { + driver = new FirefoxDriver(); + baseUrl = ExpFileReadUtils.readProperty("base.url"); + driver.manage().timeouts().implicitlyWait(30, TimeUnit.SECONDS); + } + + @Test + public void testCreateUserLogin() throws Exception { + driver.get(baseUrl); + driver.findElement(By.linkText("Create account")).click(); + driver.findElement(By.id("username")).sendKeys("Henry56"); + waitTime(500); + driver.findElement(By.id("password")).sendKeys("hen123"); + waitTime(500); + driver.findElement(By.id("confirm_password")).sendKeys("hen123"); + waitTime(500); + driver.findElement(By.id("email")).sendKeys("henry56@gmail.com"); + waitTime(500); + driver.findElement(By.id("first_name")).sendKeys("Henry"); + waitTime(500); + driver.findElement(By.id("last_name")).sendKeys("Pens"); + waitTime(500); + driver.findElement(By.id("organization")).sendKeys("IU"); + waitTime(500); + driver.findElement(By.id("address")).sendKeys("IU, CIB Building Bloomington"); + waitTime(500); + driver.findElement(By.id("country")).sendKeys("USA"); + waitTime(500); + driver.findElement(By.id("telephone")).sendKeys("812 400 5000"); + waitTime(500); + driver.findElement(By.id("mobile")).sendKeys("812 333 9999"); + waitTime(500); + driver.findElement(By.id("im")).sendKeys("-"); + waitTime(500); + driver.findElement(By.id("url")).sendKeys("-"); + waitTime(500); + driver.findElement(By.name("Submit")).click(); + waitTime(5000); + } + + private void waitTime(int i) { + try { + Thread.sleep(i); + } catch (InterruptedException e) { + e.printStackTrace(); + } + + } + + @After + public void tearDown() throws Exception { + driver.quit(); + String verificationErrorString = verificationErrors.toString(); + if (!"".equals(verificationErrorString)) { + fail(verificationErrorString); + } + } + + private boolean isElementPresent(By by) { + try { + driver.findElement(by); + return true; + } catch (NoSuchElementException e) { + return false; + } + } + + private boolean isAlertPresent() { + try { + driver.switchTo().alert(); + return true; + } catch (NoAlertPresentException e) { + return false; + } + } + + private String closeAlertAndGetItsText() { + try { + Alert alert = driver.switchTo().alert(); + String alertText = alert.getText(); + if (acceptNextAlert) { + alert.accept(); + } else { + alert.dismiss(); + } + return alertText; + } finally { + acceptNextAlert = true; + } + } +} diff --git a/tests/seleniumjava/PHPAiravataTest/src/test/java/com/example/tests/exp/example/tests/EchoBR2.java b/tests/seleniumjava/PHPAiravataTest/src/test/java/com/example/tests/exp/example/tests/EchoBR2.java new file mode 100644 index 0000000..aac6b4a --- /dev/null +++ b/tests/seleniumjava/PHPAiravataTest/src/test/java/com/example/tests/exp/example/tests/EchoBR2.java @@ -0,0 +1,123 @@ +package com.example.tests.exp.example.tests; + +import java.util.concurrent.TimeUnit; + +import com.example.tests.UserLogin; +import com.example.tests.utils.ExpFileReadUtils; +import org.junit.*; +import static org.junit.Assert.*; + +import org.openqa.selenium.*; +import org.openqa.selenium.firefox.FirefoxDriver; +import org.openqa.selenium.support.ui.Select; + +/* + **********Executing Echo Application on BR2********** + * Created by Airavata on 9/16/14. + * The script generates Echo application execution on BR2 + * experiment-name and experiment-description are read from the exp.properties file + * Modified by Eroma on 10/23/14. Base URL & Sub URL to be read from the exp.properties file +*/ + +public class EchoBR2 extends UserLogin { + private WebDriver driver; + private String baseUrl; + private String subUrl; + private boolean acceptNextAlert = true; + private StringBuffer verificationErrors = new StringBuffer(); + private String expName = null; + + @Before + public void setUp() throws Exception { + driver = new FirefoxDriver(); + baseUrl = ExpFileReadUtils.readProperty("base.url"); + subUrl = ExpFileReadUtils.readProperty("sub.url"); + expName = ExpFileReadUtils.readProperty("experiment.name"); + driver.manage().timeouts().implicitlyWait(30, TimeUnit.SECONDS); + } + + @Test + public void testEchoBR2() throws Exception { + driver.get(baseUrl + subUrl); + authenticate(driver); + driver.findElement(By.linkText("Experiment")).click(); + driver.findElement(By.id("create-experiment")).click(); + driver.findElement(By.id("experiment-name")).clear(); + driver.findElement(By.id("experiment-name")).sendKeys(expName + "Echo-BR2"); + waitTime (500); + driver.findElement(By.id("experiment-description")).clear(); + driver.findElement(By.id("experiment-description")).sendKeys("Test Experiment"); + waitTime (500); + new Select(driver.findElement(By.id("project"))).selectByVisibleText(ExpFileReadUtils.readProperty("project.name")); + waitTime (500); + new Select(driver.findElement(By.id("application"))).selectByVisibleText("Echo"); + waitTime (500); + driver.findElement(By.name("continue")).click(); + waitTime (500); + driver.findElement(By.id("Input_to_Echo")).clear(); + driver.findElement(By.id("Input_to_Echo")).sendKeys("Echo Test"); + waitTime (500); + new Select(driver.findElement(By.id("compute-resource"))).selectByVisibleText("bigred2.uits.iu.edu"); + waitTime (500); + driver.findElement(By.id("node-count")).clear(); + driver.findElement(By.id("node-count")).sendKeys("1"); + driver.findElement(By.id("cpu-count")).clear(); + driver.findElement(By.id("cpu-count")).sendKeys("4"); + driver.findElement(By.id("wall-time")).clear(); + driver.findElement(By.id("wall-time")).sendKeys("30"); + driver.findElement(By.name("launch")).click(); + driver.findElement(By.name("launch")).click(); + waitTime (500); + } + + private void waitTime(int i) { + try { + Thread.sleep(i); + } catch (InterruptedException e) { + e.printStackTrace(); + } + + } + + @After + public void tearDown() throws Exception { + driver.quit(); + String verificationErrorString = verificationErrors.toString(); + if (!"".equals(verificationErrorString)) { + fail(verificationErrorString); + } + } + + private boolean isElementPresent(By by) { + try { + driver.findElement(by); + return true; + } catch (NoSuchElementException e) { + return false; + } + } + + private boolean isAlertPresent() { + try { + driver.switchTo().alert(); + return true; + } catch (NoAlertPresentException e) { + return false; + } + } + + private String closeAlertAndGetItsText() { + try { + Alert alert = driver.switchTo().alert(); + String alertText = alert.getText(); + if (acceptNextAlert) { + alert.accept(); + } else { + alert.dismiss(); + } + return alertText; + } finally { + acceptNextAlert = true; + } + } +} diff --git a/tests/seleniumjava/PHPAiravataTest/src/test/java/com/example/tests/exp/example/tests/EchoStampede.java b/tests/seleniumjava/PHPAiravataTest/src/test/java/com/example/tests/exp/example/tests/EchoStampede.java new file mode 100644 index 0000000..861b68b --- /dev/null +++ b/tests/seleniumjava/PHPAiravataTest/src/test/java/com/example/tests/exp/example/tests/EchoStampede.java @@ -0,0 +1,124 @@ +package com.example.tests.exp.example.tests; + +import java.util.concurrent.TimeUnit; + +import com.example.tests.UserLogin; +import com.example.tests.utils.ExpFileReadUtils; +import org.junit.*; +import static org.junit.Assert.*; + +import org.openqa.selenium.*; +import org.openqa.selenium.firefox.FirefoxDriver; +import org.openqa.selenium.support.ui.Select; + +/* + **********Executing Echo Application on Stampede********** + * Created by Eroma on 9/16/14. + * The script generates Echo application execution on Stampede + * experiment-name and experiment-description are read from the exp.properties file + * Modified by Eroma on 10/23/14. Base URL & Sub URL to be read from the exp.properties file +*/ + +public class EchoStampede extends UserLogin { + private WebDriver driver; + private String baseUrl; + private String subUrl; + private boolean acceptNextAlert = true; + private StringBuffer verificationErrors = new StringBuffer(); + private String expName = null; + + @Before + public void setUp() throws Exception { + driver = new FirefoxDriver(); + baseUrl = ExpFileReadUtils.readProperty("base.url"); + subUrl = ExpFileReadUtils.readProperty("sub.url"); + expName = ExpFileReadUtils.readProperty("experiment.name"); + driver.manage().timeouts().implicitlyWait(30, TimeUnit.SECONDS); + } + + @Test + public void testEchoStampede() throws Exception { + driver.get(baseUrl + subUrl); + authenticate(driver); + driver.findElement(By.linkText("Experiment")).click(); + driver.findElement(By.id("create-experiment")).click(); + waitTime (500); + driver.findElement(By.id("experiment-name")).clear(); + driver.findElement(By.id("experiment-name")).sendKeys(expName + "Echo-Stampede"); + waitTime (500); + driver.findElement(By.id("experiment-description")).clear(); + driver.findElement(By.id("experiment-description")).sendKeys("Test Experiment"); + waitTime (500); + new Select(driver.findElement(By.id("project"))).selectByVisibleText(ExpFileReadUtils.readProperty("project.name")); + waitTime (500); + new Select(driver.findElement(By.id("application"))).selectByVisibleText("Echo"); + waitTime (500); + driver.findElement(By.name("continue")).click(); + waitTime (500); + driver.findElement(By.id("Input_to_Echo")).clear(); + driver.findElement(By.id("Input_to_Echo")).sendKeys("Echo Test"); + waitTime (500); + new Select(driver.findElement(By.id("compute-resource"))).selectByVisibleText("stampede.tacc.xsede.org"); + waitTime (500); + driver.findElement(By.id("node-count")).clear(); + driver.findElement(By.id("node-count")).sendKeys("1"); + driver.findElement(By.id("cpu-count")).clear(); + driver.findElement(By.id("cpu-count")).sendKeys("4"); + driver.findElement(By.id("wall-time")).clear(); + driver.findElement(By.id("wall-time")).sendKeys("30"); + driver.findElement(By.name("launch")).click(); + waitTime (500); + + } + + private void waitTime(int i) { + try { + Thread.sleep(i); + } catch (InterruptedException e) { + e.printStackTrace(); + } + + } + + @After + public void tearDown() throws Exception { + driver.quit(); + String verificationErrorString = verificationErrors.toString(); + if (!"".equals(verificationErrorString)) { + fail(verificationErrorString); + } + } + + private boolean isElementPresent(By by) { + try { + driver.findElement(by); + return true; + } catch (NoSuchElementException e) { + return false; + } + } + + private boolean isAlertPresent() { + try { + driver.switchTo().alert(); + return true; + } catch (NoAlertPresentException e) { + return false; + } + } + + private String closeAlertAndGetItsText() { + try { + Alert alert = driver.switchTo().alert(); + String alertText = alert.getText(); + if (acceptNextAlert) { + alert.accept(); + } else { + alert.dismiss(); + } + return alertText; + } finally { + acceptNextAlert = true; + } + } +} diff --git a/tests/seleniumjava/PHPAiravataTest/src/test/java/com/example/tests/exp/example/tests/EchoTrestles.java b/tests/seleniumjava/PHPAiravataTest/src/test/java/com/example/tests/exp/example/tests/EchoTrestles.java new file mode 100644 index 0000000..a04517f --- /dev/null +++ b/tests/seleniumjava/PHPAiravataTest/src/test/java/com/example/tests/exp/example/tests/EchoTrestles.java @@ -0,0 +1,121 @@ +package com.example.tests.exp.example.tests; + +import java.util.concurrent.TimeUnit; + +import com.example.tests.UserLogin; +import com.example.tests.utils.ExpFileReadUtils; +import org.junit.*; +import static org.junit.Assert.*; + +import org.openqa.selenium.*; +import org.openqa.selenium.firefox.FirefoxDriver; +import org.openqa.selenium.support.ui.Select; + +/* + **********Executing Echo Application on Trestles********** + * Created by Eroma on 9/16/14. + * The script generates Echo application execution on Trestles + * experiment-name and experiment-description are read from the exp.properties file + * Modified by Eroma on 10/23/14. Base URL & Sub URL to be read from the exp.properties file +*/ + +public class EchoTrestles extends UserLogin { + private WebDriver driver; + private String baseUrl; + private String subUrl; + private boolean acceptNextAlert = true; + private StringBuffer verificationErrors = new StringBuffer(); + private String expName = null; + + @Before + public void setUp() throws Exception { + driver = new FirefoxDriver(); + baseUrl = ExpFileReadUtils.readProperty("base.url"); + subUrl = ExpFileReadUtils.readProperty("sub.url"); + expName = ExpFileReadUtils.readProperty("experiment.name"); + driver.manage().timeouts().implicitlyWait(30, TimeUnit.SECONDS); + } + + @Test + public void testEchoTrestles() throws Exception { + driver.get(baseUrl + subUrl); + authenticate(driver); + driver.findElement(By.linkText("Experiment")).click(); + driver.findElement(By.id("create-experiment")).click(); + driver.findElement(By.id("experiment-name")).clear(); + driver.findElement(By.id("experiment-name")).sendKeys(expName + "Echo-Trestles"); + waitTime (500); + driver.findElement(By.id("experiment-description")).clear(); + driver.findElement(By.id("experiment-description")).sendKeys("Test Experiment"); + waitTime (500); + new Select(driver.findElement(By.id("project"))).selectByVisibleText(ExpFileReadUtils.readProperty("project.name")); + waitTime (500); + new Select(driver.findElement(By.id("application"))).selectByVisibleText("Echo"); + waitTime (500); + driver.findElement(By.name("continue")).click(); + waitTime (500); + driver.findElement(By.id("Input_to_Echo")).clear(); + driver.findElement(By.id("Input_to_Echo")).sendKeys("Echo Test"); + waitTime (500); + new Select(driver.findElement(By.id("compute-resource"))).selectByVisibleText("trestles.sdsc.xsede.org"); + waitTime (500); + driver.findElement(By.id("node-count")).clear(); + driver.findElement(By.id("node-count")).sendKeys("1"); + driver.findElement(By.id("cpu-count")).clear(); + driver.findElement(By.id("cpu-count")).sendKeys("4"); + driver.findElement(By.id("wall-time")).clear(); + driver.findElement(By.id("wall-time")).sendKeys("30"); + driver.findElement(By.name("launch")).click(); + } + + private void waitTime(int i) { + try { + Thread.sleep(i); + } catch (InterruptedException e) { + e.printStackTrace(); + } + + } + + @After + public void tearDown() throws Exception { + driver.quit(); + String verificationErrorString = verificationErrors.toString(); + if (!"".equals(verificationErrorString)) { + fail(verificationErrorString); + } + } + + private boolean isElementPresent(By by) { + try { + driver.findElement(by); + return true; + } catch (NoSuchElementException e) { + return false; + } + } + + private boolean isAlertPresent() { + try { + driver.switchTo().alert(); + return true; + } catch (NoAlertPresentException e) { + return false; + } + } + + private String closeAlertAndGetItsText() { + try { + Alert alert = driver.switchTo().alert(); + String alertText = alert.getText(); + if (acceptNextAlert) { + alert.accept(); + } else { + alert.dismiss(); + } + return alertText; + } finally { + acceptNextAlert = true; + } + } +} diff --git a/tests/seleniumjava/PHPAiravataTest/src/test/java/com/example/tests/exp/example/tests/EspressoStampede.java b/tests/seleniumjava/PHPAiravataTest/src/test/java/com/example/tests/exp/example/tests/EspressoStampede.java new file mode 100644 index 0000000..3a99ecf --- /dev/null +++ b/tests/seleniumjava/PHPAiravataTest/src/test/java/com/example/tests/exp/example/tests/EspressoStampede.java @@ -0,0 +1,126 @@ +package com.example.tests.exp.example.tests; + +import java.util.concurrent.TimeUnit; + +import com.example.tests.UserLogin; +import com.example.tests.utils.ExpFileReadUtils; +import org.junit.*; +import static org.junit.Assert.*; + +import org.openqa.selenium.*; +import org.openqa.selenium.firefox.FirefoxDriver; +import org.openqa.selenium.support.ui.Select; + +/* + **********Executing Espresso Application on Stampede********** + * Created by Eroma on 9/16/14. + * The script generates Espresso application execution on Stampede + * experiment-name and experiment-description are read from the exp.properties file + * Modified by Eroma on 10/27/14. Base URL & Sub URL to be read from the exp.properties file +*/ + +public class EspressoStampede extends UserLogin { + private WebDriver driver; + private String baseUrl; + private String subUrl; + private boolean acceptNextAlert = true; + private StringBuffer verificationErrors = new StringBuffer(); + private String path = null; + private String expName = null; + + @Before + public void setUp() throws Exception { + driver = new FirefoxDriver(); + baseUrl = ExpFileReadUtils.readProperty("base.url"); + subUrl = ExpFileReadUtils.readProperty("sub.url"); + path = ExpFileReadUtils.readProperty("local.path"); + expName = ExpFileReadUtils.readProperty("experiment.name"); + driver.manage().timeouts().implicitlyWait(30, TimeUnit.SECONDS); + } + + @Test + public void testEspressoStampede() throws Exception { + driver.get(baseUrl + subUrl); + authenticate(driver); + driver.findElement(By.linkText("Experiment")).click(); + driver.findElement(By.id("create-experiment")).click(); + waitTime (500); + driver.findElement(By.id("experiment-name")).clear(); + driver.findElement(By.id("experiment-name")).sendKeys(expName + "Espresso-Stampede"); + waitTime (500); + driver.findElement(By.id("experiment-description")).clear(); + driver.findElement(By.id("experiment-description")).sendKeys("Test Experiment"); + waitTime (500); + new Select(driver.findElement(By.id("project"))).selectByVisibleText(ExpFileReadUtils.readProperty("project.name")); + waitTime (500); + new Select(driver.findElement(By.id("application"))).selectByVisibleText("ESPRESSO"); + waitTime (500); + driver.findElement(By.name("continue")).click(); + waitTime (500); + driver.findElement(By.id("AI_Primitive_Cell")).sendKeys(ExpFileReadUtils.ESPRESSO_INPUT1); + waitTime (500); + driver.findElement(By.id("AI_Pseudopotential_File")).sendKeys(ExpFileReadUtils.ESPRESSO_INPUT2); + waitTime (500); + new Select(driver.findElement(By.id("compute-resource"))).selectByVisibleText("stampede.tacc.xsede.org"); + waitTime (500); + driver.findElement(By.id("node-count")).clear(); + driver.findElement(By.id("node-count")).sendKeys("1"); + driver.findElement(By.id("cpu-count")).clear(); + driver.findElement(By.id("cpu-count")).sendKeys("4"); + driver.findElement(By.id("wall-time")).clear(); + driver.findElement(By.id("wall-time")).sendKeys("30"); + driver.findElement(By.name("launch")).click(); + waitTime (500); + } + + private void waitTime(int i) { + try { + Thread.sleep(i); + } catch (InterruptedException e) { + e.printStackTrace(); + } + + } + + @After + public void tearDown() throws Exception { + driver.quit(); + String verificationErrorString = verificationErrors.toString(); + if (!"".equals(verificationErrorString)) { + fail(verificationErrorString); + } + } + + private boolean isElementPresent(By by) { + try { + driver.findElement(by); + return true; + } catch (NoSuchElementException e) { + return false; + } + } + + private boolean isAlertPresent() { + try { + driver.switchTo().alert(); + return true; + } catch (NoAlertPresentException e) { + return false; + } + } + + private String closeAlertAndGetItsText() { + try { + Alert alert = driver.switchTo().alert(); + String alertText = alert.getText(); + if (acceptNextAlert) { + alert.accept(); + } else { + alert.dismiss(); + } + return alertText; + } finally { + acceptNextAlert = true; + } + } +} diff --git a/tests/seleniumjava/PHPAiravataTest/src/test/java/com/example/tests/exp/example/tests/GromacsStampede.java b/tests/seleniumjava/PHPAiravataTest/src/test/java/com/example/tests/exp/example/tests/GromacsStampede.java new file mode 100644 index 0000000..2805f99 --- /dev/null +++ b/tests/seleniumjava/PHPAiravataTest/src/test/java/com/example/tests/exp/example/tests/GromacsStampede.java @@ -0,0 +1,131 @@ +package com.example.tests.exp.example.tests; + +import java.util.concurrent.TimeUnit; + +import com.example.tests.UserLogin; +import com.example.tests.utils.ExpFileReadUtils; +import org.junit.*; +import static org.junit.Assert.*; + +import org.openqa.selenium.*; +import org.openqa.selenium.firefox.FirefoxDriver; +import org.openqa.selenium.support.ui.Select; + +/* + **********Executing Gromacs Application on Stampede********** + * Created by Eroma on 9/16/14. + * The script generates Gromacs application execution on Stampede + * experiment-name and experiment-description are read from the exp.properties file + * Modified by Eroma on 10/27/14. Base URL & Sub URL to be read from the exp.properties file +*/ + +public class GromacsStampede extends UserLogin { + private WebDriver driver; + private String baseUrl; + private String subUrl; + private boolean acceptNextAlert = true; + private StringBuffer verificationErrors = new StringBuffer(); + private String path = null; + private String expName = null; + + @Before + public void setUp() throws Exception { + driver = new FirefoxDriver(); + baseUrl = ExpFileReadUtils.readProperty("base.url"); + subUrl = ExpFileReadUtils.readProperty("sub.url"); + path = ExpFileReadUtils.readProperty("local.path"); + expName = ExpFileReadUtils.readProperty("experiment.name"); + driver.manage().timeouts().implicitlyWait(30, TimeUnit.SECONDS); + } + + @Test + public void testGromacsStampede() throws Exception { + driver.get(baseUrl + subUrl); + authenticate(driver); + driver.findElement(By.linkText("Experiment")).click(); + driver.findElement(By.id("create-experiment")).click(); + driver.findElement(By.id("experiment-name")).clear(); + driver.findElement(By.id("experiment-name")).sendKeys(expName + "Gromacs-Stampede"); + waitTime (500); + driver.findElement(By.id("experiment-description")).clear(); + driver.findElement(By.id("experiment-description")).sendKeys("Test Experiment"); + waitTime (500); + new Select(driver.findElement(By.id("project"))).selectByVisibleText(ExpFileReadUtils.readProperty("project.name")); + waitTime (500); + new Select(driver.findElement(By.id("application"))).selectByVisibleText("GROMACS"); + waitTime (500); + driver.findElement(By.name("continue")).click(); + waitTime (500); + driver.findElement(By.id("GROMOS_Coordinate_File")).sendKeys(ExpFileReadUtils.GROMACS_INPUT1); + waitTime (500); + driver.findElement(By.id("Portable_Input_Binary_File")).sendKeys(ExpFileReadUtils.GROMACS_INPUT2); + waitTime (500); + new Select(driver.findElement(By.id("compute-resource"))).selectByVisibleText("stampede.tacc.xsede.org"); + waitTime (500); + driver.findElement(By.id("node-count")).clear(); + driver.findElement(By.id("node-count")).sendKeys("1"); + driver.findElement(By.id("cpu-count")).clear(); + driver.findElement(By.id("cpu-count")).sendKeys("4"); + driver.findElement(By.id("wall-time")).clear(); + driver.findElement(By.id("wall-time")).sendKeys("30"); + driver.findElement(By.name("launch")).click(); + waitTime (5000); + driver.findElement(By.cssSelector("span.glyphicon.glyphicon-refresh")).click(); + waitTime (5000); + driver.findElement(By.cssSelector("span.glyphicon.glyphicon-refresh")).click(); + waitTime (5000); + driver.findElement(By.cssSelector("span.glyphicon.glyphicon-refresh")).click(); + waitTime (5000); + } + + private void waitTime(int i) { + try { + Thread.sleep(i); + } catch (InterruptedException e) { + e.printStackTrace(); + } + } + + + @After + public void tearDown() throws Exception { + driver.quit(); + String verificationErrorString = verificationErrors.toString(); + if (!"".equals(verificationErrorString)) { + fail(verificationErrorString); + } + } + + private boolean isElementPresent(By by) { + try { + driver.findElement(by); + return true; + } catch (NoSuchElementException e) { + return false; + } + } + + private boolean isAlertPresent() { + try { + driver.switchTo().alert(); + return true; + } catch (NoAlertPresentException e) { + return false; + } + } + + private String closeAlertAndGetItsText() { + try { + Alert alert = driver.switchTo().alert(); + String alertText = alert.getText(); + if (acceptNextAlert) { + alert.accept(); + } else { + alert.dismiss(); + } + return alertText; + } finally { + acceptNextAlert = true; + } + } +} diff --git a/tests/seleniumjava/PHPAiravataTest/src/test/java/com/example/tests/exp/example/tests/GromacsTrestles.java b/tests/seleniumjava/PHPAiravataTest/src/test/java/com/example/tests/exp/example/tests/GromacsTrestles.java new file mode 100644 index 0000000..1d2b582 --- /dev/null +++ b/tests/seleniumjava/PHPAiravataTest/src/test/java/com/example/tests/exp/example/tests/GromacsTrestles.java @@ -0,0 +1,130 @@ +package com.example.tests.exp.example.tests; + +import java.util.concurrent.TimeUnit; + +import com.example.tests.UserLogin; +import com.example.tests.utils.ExpFileReadUtils; +import org.junit.*; +import static org.junit.Assert.*; + +import org.openqa.selenium.*; +import org.openqa.selenium.firefox.FirefoxDriver; +import org.openqa.selenium.support.ui.Select; + +/* + **********Executing Gromacs Application on Trestles********** + * Created by Eroma on 9/16/14. + * The script generates Espresso application execution on Stampede + * experiment-name and experiment-description are read from the exp.properties file + * Modified by Eroma on 10/27/14. Base URL & Sub URL to be read from the exp.properties file +*/ + +public class GromacsTrestles extends UserLogin { + private WebDriver driver; + private String baseUrl; + private String subUrl; + private boolean acceptNextAlert = true; + private StringBuffer verificationErrors = new StringBuffer(); + private String path = null; + private String expName = null; + + @Before + public void setUp() throws Exception { + driver = new FirefoxDriver(); + baseUrl = ExpFileReadUtils.readProperty("base.url"); + subUrl = ExpFileReadUtils.readProperty("sub.url"); + path = ExpFileReadUtils.readProperty("local.path"); + expName = ExpFileReadUtils.readProperty("experiment.name"); + driver.manage().timeouts().implicitlyWait(30, TimeUnit.SECONDS); + } + + @Test + public void testGromacsTrestles() throws Exception { + driver.get(baseUrl + subUrl); + authenticate(driver); + driver.findElement(By.linkText("Experiment")).click(); + driver.findElement(By.id("create-experiment")).click(); + driver.findElement(By.id("experiment-name")).clear(); + driver.findElement(By.id("experiment-name")).sendKeys(expName + "Gromacs-Trestles"); + waitTime(500); + driver.findElement(By.id("experiment-description")).clear(); + driver.findElement(By.id("experiment-description")).sendKeys("Test Experiment"); + waitTime(500); + new Select(driver.findElement(By.id("project"))).selectByVisibleText(ExpFileReadUtils.readProperty("project.name")); + waitTime(500); + new Select(driver.findElement(By.id("application"))).selectByVisibleText("GROMACS"); + waitTime(500); + driver.findElement(By.name("continue")).click(); + waitTime(500); + driver.findElement(By.id("GROMOS_Coordinate_File")).sendKeys(ExpFileReadUtils.GROMACS_INPUT1); + waitTime(500); + driver.findElement(By.id("Portable_Input_Binary_File")).sendKeys(ExpFileReadUtils.GROMACS_INPUT2); + waitTime(500); + new Select(driver.findElement(By.id("compute-resource"))).selectByVisibleText("trestles.sdsc.xsede.org"); + waitTime(500); + driver.findElement(By.id("node-count")).clear(); + driver.findElement(By.id("node-count")).sendKeys("1"); + driver.findElement(By.id("cpu-count")).clear(); + driver.findElement(By.id("cpu-count")).sendKeys("4"); + driver.findElement(By.id("wall-time")).clear(); + driver.findElement(By.id("wall-time")).sendKeys("30"); + driver.findElement(By.name("launch")).click(); + waitTime(5000); + driver.findElement(By.cssSelector("span.glyphicon.glyphicon-refresh")).click(); + waitTime(5000); + driver.findElement(By.cssSelector("span.glyphicon.glyphicon-refresh")).click(); + waitTime(5000); + driver.findElement(By.cssSelector("span.glyphicon.glyphicon-refresh")).click(); + waitTime(5000); + } + + private void waitTime(int i) { + try { + Thread.sleep(i); + } catch (InterruptedException e) { + e.printStackTrace(); + } + } + + @After + public void tearDown() throws Exception { + driver.quit(); + String verificationErrorString = verificationErrors.toString(); + if (!"".equals(verificationErrorString)) { + fail(verificationErrorString); + } + } + + private boolean isElementPresent(By by) { + try { + driver.findElement(by); + return true; + } catch (NoSuchElementException e) { + return false; + } + } + + private boolean isAlertPresent() { + try { + driver.switchTo().alert(); + return true; + } catch (NoAlertPresentException e) { + return false; + } + } + + private String closeAlertAndGetItsText() { + try { + Alert alert = driver.switchTo().alert(); + String alertText = alert.getText(); + if (acceptNextAlert) { + alert.accept(); + } else { + alert.dismiss(); + } + return alertText; + } finally { + acceptNextAlert = true; + } + } +} diff --git a/tests/seleniumjava/PHPAiravataTest/src/test/java/com/example/tests/exp/example/tests/LammpsStampede.java b/tests/seleniumjava/PHPAiravataTest/src/test/java/com/example/tests/exp/example/tests/LammpsStampede.java new file mode 100644 index 0000000..a2bc7f1 --- /dev/null +++ b/tests/seleniumjava/PHPAiravataTest/src/test/java/com/example/tests/exp/example/tests/LammpsStampede.java @@ -0,0 +1,128 @@ +package com.example.tests.exp.example.tests; + +import java.util.concurrent.TimeUnit; + +import com.example.tests.UserLogin; +import com.example.tests.utils.ExpFileReadUtils; +import org.junit.*; +import static org.junit.Assert.*; + +import org.openqa.selenium.*; +import org.openqa.selenium.firefox.FirefoxDriver; +import org.openqa.selenium.support.ui.Select; + +/* + **********Executing Lammps Application on Stampede********** + * Created by Eroma on 9/16/14. + * The script generates Lammps application execution on Stampede + * experiment-name and experiment-description are read from the exp.properties file + * Modified by Eroma on 10/27/14. Base URL & Sub URL to be read from the exp.properties file +*/ + +public class LammpsStampede extends UserLogin { + private WebDriver driver; + private String baseUrl; + private String subUrl; + private boolean acceptNextAlert = true; + private StringBuffer verificationErrors = new StringBuffer(); + private String path = null; + private String expName = null; + + @Before + public void setUp() throws Exception { + driver = new FirefoxDriver(); + baseUrl = ExpFileReadUtils.readProperty("base.url"); + subUrl = ExpFileReadUtils.readProperty("sub.url"); + path = ExpFileReadUtils.readProperty("local.path"); + expName = ExpFileReadUtils.readProperty("experiment.name"); + driver.manage().timeouts().implicitlyWait(30, TimeUnit.SECONDS); + } + + @Test + public void testLammpsStampede() throws Exception { + driver.get(baseUrl + subUrl); + authenticate(driver); + driver.findElement(By.linkText("Experiment")).click(); + driver.findElement(By.id("create-experiment")).click(); + driver.findElement(By.id("experiment-name")).clear(); + driver.findElement(By.id("experiment-name")).sendKeys(expName + "Lammps-Stampede"); + waitTime(500); + driver.findElement(By.id("experiment-description")).clear(); + driver.findElement(By.id("experiment-description")).sendKeys("Test Experiment"); + waitTime(500); + new Select(driver.findElement(By.id("project"))).selectByVisibleText(ExpFileReadUtils.readProperty("project.name")); + waitTime(500); + new Select(driver.findElement(By.id("application"))).selectByVisibleText("LAMMPS"); + waitTime(500); + driver.findElement(By.name("continue")).click(); + waitTime(500); + driver.findElement(By.id("Friction_Simulation_Input")).sendKeys(ExpFileReadUtils.LAMMPS_INPUT1); + waitTime (500); + new Select(driver.findElement(By.id("compute-resource"))).selectByVisibleText("stampede.tacc.xsede.org"); + waitTime (500); + driver.findElement(By.id("node-count")).sendKeys("1"); + driver.findElement(By.id("cpu-count")).clear(); + driver.findElement(By.id("cpu-count")).sendKeys("4"); + driver.findElement(By.id("wall-time")).clear(); + driver.findElement(By.id("wall-time")).sendKeys("30"); + driver.findElement(By.name("launch")).click(); + waitTime(5000); + driver.findElement(By.cssSelector("span.glyphicon.glyphicon-refresh")).click(); + waitTime(5000); + driver.findElement(By.cssSelector("span.glyphicon.glyphicon-refresh")).click(); + waitTime(5000); + driver.findElement(By.cssSelector("span.glyphicon.glyphicon-refresh")).click(); + waitTime(5000); + + } + + private void waitTime(int i) { + try { + Thread.sleep(i); + } catch (InterruptedException e) { + e.printStackTrace(); + } + } + + @After + public void tearDown() throws Exception { + driver.quit(); + String verificationErrorString = verificationErrors.toString(); + if (!"".equals(verificationErrorString)) { + fail(verificationErrorString); + } + } + + private boolean isElementPresent(By by) { + try { + driver.findElement(by); + return true; + } catch (NoSuchElementException e) { + return false; + } + } + + private boolean isAlertPresent() { + try { + driver.switchTo().alert(); + return true; + } catch (NoAlertPresentException e) { + return false; + } + } + + private String closeAlertAndGetItsText() { + try { + Alert alert = driver.switchTo().alert(); + String alertText = alert.getText(); + if (acceptNextAlert) { + alert.accept(); + } else { + alert.dismiss(); + } + return alertText; + } finally { + acceptNextAlert = true; + } + } +} diff --git a/tests/seleniumjava/PHPAiravataTest/src/test/java/com/example/tests/exp/example/tests/LammpsTrestles.java b/tests/seleniumjava/PHPAiravataTest/src/test/java/com/example/tests/exp/example/tests/LammpsTrestles.java new file mode 100644 index 0000000..2627f9c --- /dev/null +++ b/tests/seleniumjava/PHPAiravataTest/src/test/java/com/example/tests/exp/example/tests/LammpsTrestles.java @@ -0,0 +1,128 @@ +package com.example.tests.exp.example.tests; + +import java.util.concurrent.TimeUnit; + +import com.example.tests.UserLogin; +import com.example.tests.utils.ExpFileReadUtils; +import org.junit.*; +import static org.junit.Assert.*; + +import org.openqa.selenium.*; +import org.openqa.selenium.firefox.FirefoxDriver; +import org.openqa.selenium.support.ui.Select; + +/* + **********Executing Lammps Application on Trestles********** + * Created by Eroma on 9/16/14. + * The script generates Lammps application execution on Trestles + * experiment-name and experiment-description are read from the exp.properties file + * Modified by Eroma on 10/27/14. Base URL & Sub URL to be read from the exp.properties file +*/ + +public class LammpsTrestles extends UserLogin { + private WebDriver driver; + private String baseUrl; + private String subUrl; + private boolean acceptNextAlert = true; + private StringBuffer verificationErrors = new StringBuffer(); + private String path = null; + private String expName = null; + + @Before + public void setUp() throws Exception { + driver = new FirefoxDriver(); + baseUrl = ExpFileReadUtils.readProperty("base.url"); + subUrl = ExpFileReadUtils.readProperty("sub.url"); + path = ExpFileReadUtils.readProperty("local.path"); + expName = ExpFileReadUtils.readProperty("experiment.name"); + driver.manage().timeouts().implicitlyWait(30, TimeUnit.SECONDS); + } + + @Test + public void testLammpsTrestles() throws Exception { + driver.get(baseUrl + subUrl); + authenticate(driver); + driver.findElement(By.linkText("Experiment")).click(); + driver.findElement(By.id("create-experiment")).click(); + driver.findElement(By.id("experiment-name")).clear(); + driver.findElement(By.id("experiment-name")).sendKeys(expName + "Lammps-Trestles"); + waitTime(500); + driver.findElement(By.id("experiment-description")).clear(); + driver.findElement(By.id("experiment-description")).sendKeys("Test Experiment"); + waitTime(500); + new Select(driver.findElement(By.id("project"))).selectByVisibleText(ExpFileReadUtils.readProperty("project.name")); + waitTime(500); + new Select(driver.findElement(By.id("application"))).selectByVisibleText("LAMMPS"); + waitTime(500); + driver.findElement(By.name("continue")).click(); + waitTime(500); + driver.findElement(By.id("Friction_Simulation_Input")).sendKeys(ExpFileReadUtils.LAMMPS_INPUT1); + waitTime(500); + new Select(driver.findElement(By.id("compute-resource"))).selectByVisibleText("trestles.sdsc.xsede.org"); + waitTime(500); + driver.findElement(By.id("node-count")).clear(); + driver.findElement(By.id("node-count")).sendKeys("1"); + driver.findElement(By.id("cpu-count")).clear(); + driver.findElement(By.id("cpu-count")).sendKeys("4"); + driver.findElement(By.id("wall-time")).clear(); + driver.findElement(By.id("wall-time")).sendKeys("30"); + driver.findElement(By.name("launch")).click(); + waitTime(5000); + driver.findElement(By.cssSelector("span.glyphicon.glyphicon-refresh")).click(); + waitTime(5000); + driver.findElement(By.cssSelector("span.glyphicon.glyphicon-refresh")).click(); + waitTime(5000); + driver.findElement(By.cssSelector("span.glyphicon.glyphicon-refresh")).click(); + waitTime(5000); + } + + private void waitTime(int i) { + try { + Thread.sleep(i); + } catch (InterruptedException e) { + e.printStackTrace(); + } + } + + @After + public void tearDown() throws Exception { + driver.quit(); + String verificationErrorString = verificationErrors.toString(); + if (!"".equals(verificationErrorString)) { + fail(verificationErrorString); + } + } + + private boolean isElementPresent(By by) { + try { + driver.findElement(by); + return true; + } catch (NoSuchElementException e) { + return false; + } + } + + private boolean isAlertPresent() { + try { + driver.switchTo().alert(); + return true; + } catch (NoAlertPresentException e) { + return false; + } + } + + private String closeAlertAndGetItsText() { + try { + Alert alert = driver.switchTo().alert(); + String alertText = alert.getText(); + if (acceptNextAlert) { + alert.accept(); + } else { + alert.dismiss(); + } + return alertText; + } finally { + acceptNextAlert = true; + } + } +} diff --git a/tests/seleniumjava/PHPAiravataTest/src/test/java/com/example/tests/exp/example/tests/NwChemStampede.java b/tests/seleniumjava/PHPAiravataTest/src/test/java/com/example/tests/exp/example/tests/NwChemStampede.java new file mode 100644 index 0000000..bd2b9b2 --- /dev/null +++ b/tests/seleniumjava/PHPAiravataTest/src/test/java/com/example/tests/exp/example/tests/NwChemStampede.java @@ -0,0 +1,123 @@ +package com.example.tests.exp.example.tests; + +import java.util.concurrent.TimeUnit; + +import com.example.tests.UserLogin; +import com.example.tests.utils.ExpFileReadUtils; +import org.junit.*; +import static org.junit.Assert.*; + +import org.openqa.selenium.*; +import org.openqa.selenium.firefox.FirefoxDriver; +import org.openqa.selenium.support.ui.Select; + +/* + **********Executing NwChem Application on Stampede********** + * Created by Eroma on 9/16/14. + * The script generates NwChem application execution on Stampede + * experiment-name and experiment-description are read from the exp.properties file + * Modified by Eroma on 10/27/14. Base URL & Sub URL to be read from the exp.properties file +*/ + +public class NwChemStampede extends UserLogin { + private WebDriver driver; + private String baseUrl; + private String subUrl; + private boolean acceptNextAlert = true; + private StringBuffer verificationErrors = new StringBuffer(); + private String path = null; + private String expName = null; + + @Before + public void setUp() throws Exception { + driver = new FirefoxDriver(); + baseUrl = ExpFileReadUtils.readProperty("base.url"); + subUrl = ExpFileReadUtils.readProperty("sub.url"); + path = ExpFileReadUtils.readProperty("local.path"); + expName = ExpFileReadUtils.readProperty("experiment.name"); + driver.manage().timeouts().implicitlyWait(30, TimeUnit.SECONDS); + } + + @Test + public void testNwChemStampede() throws Exception { + driver.get(baseUrl + subUrl); + authenticate(driver); + driver.findElement(By.linkText("Experiment")).click(); + driver.findElement(By.id("create-experiment")).click(); + driver.findElement(By.id("experiment-name")).clear(); + driver.findElement(By.id("experiment-name")).sendKeys(expName + "NwChem-Stampede"); + waitTime (500); + driver.findElement(By.id("experiment-description")).clear(); + driver.findElement(By.id("experiment-description")).sendKeys("Test Experiment"); + waitTime (500); + new Select(driver.findElement(By.id("project"))).selectByVisibleText(ExpFileReadUtils.readProperty("project.name")); + waitTime (500); + new Select(driver.findElement(By.id("application"))).selectByVisibleText("NWChem"); + waitTime (500); + driver.findElement(By.name("continue")).click(); + waitTime (500); + driver.findElement(By.id("Water_Molecule_Input")).sendKeys(ExpFileReadUtils.NWCHEM_INPUT1); + waitTime (500); + waitTime (500); + new Select(driver.findElement(By.id("compute-resource"))).selectByVisibleText("stampede.tacc.xsede.org"); + waitTime (500); + driver.findElement(By.id("node-count")).clear(); + driver.findElement(By.id("node-count")).sendKeys("1"); + driver.findElement(By.id("cpu-count")).clear(); + driver.findElement(By.id("cpu-count")).sendKeys("4"); + driver.findElement(By.id("wall-time")).clear(); + driver.findElement(By.id("wall-time")).sendKeys("30"); + driver.findElement(By.name("launch")).click(); + waitTime (500); + } + + private void waitTime(int i) { + try { + Thread.sleep(i); + } catch (InterruptedException e) { + e.printStackTrace(); + } + } + + @After + public void tearDown() throws Exception { + driver.quit(); + String verificationErrorString = verificationErrors.toString(); + if (!"".equals(verificationErrorString)) { + fail(verificationErrorString); + } + } + + private boolean isElementPresent(By by) { + try { + driver.findElement(by); + return true; + } catch (NoSuchElementException e) { + return false; + } + } + + private boolean isAlertPresent() { + try { + driver.switchTo().alert(); + return true; + } catch (NoAlertPresentException e) { + return false; + } + } + + private String closeAlertAndGetItsText() { + try { + Alert alert = driver.switchTo().alert(); + String alertText = alert.getText(); + if (acceptNextAlert) { + alert.accept(); + } else { + alert.dismiss(); + } + return alertText; + } finally { + acceptNextAlert = true; + } + } +} diff --git a/tests/seleniumjava/PHPAiravataTest/src/test/java/com/example/tests/exp/example/tests/PhastaStampede.java b/tests/seleniumjava/PHPAiravataTest/src/test/java/com/example/tests/exp/example/tests/PhastaStampede.java new file mode 100644 index 0000000..1de2c0f --- /dev/null +++ b/tests/seleniumjava/PHPAiravataTest/src/test/java/com/example/tests/exp/example/tests/PhastaStampede.java @@ -0,0 +1,130 @@ +package com.example.tests.exp.example.tests; + +import java.util.concurrent.TimeUnit; + +import com.example.tests.UserLogin; +import com.example.tests.utils.ExpFileReadUtils; +import org.junit.*; +import static org.junit.Assert.*; + +import org.openqa.selenium.*; +import org.openqa.selenium.firefox.FirefoxDriver; +import org.openqa.selenium.support.ui.Select; + +/* + **********Executing Phasta Application on Stampede********** + * Created by Eroma on 10/21/14. + * The script generates Phasta application execution on Stampede + * experiment-name and experiment-description are read from the exp.properties file + * Modified by Eroma on 10/27/14. Base URL & Sub URL to be read from the exp.properties file +*/ + +public class PhastaStampede extends UserLogin { + private WebDriver driver; + private String baseUrl; + private String subUrl; + private boolean acceptNextAlert = true; + private StringBuffer verificationErrors = new StringBuffer(); + private String path = null; + private String expName = null; + + @Before + public void setUp() throws Exception { + driver = new FirefoxDriver(); + baseUrl = ExpFileReadUtils.readProperty("base.url"); + subUrl = ExpFileReadUtils.readProperty("sub.url"); + path = ExpFileReadUtils.readProperty("local.path"); + expName = ExpFileReadUtils.readProperty("experiment.name"); + driver.manage().timeouts().implicitlyWait(30, TimeUnit.SECONDS); + } + + @Test + public void testPhastaStampede() throws Exception { + driver.get(baseUrl + subUrl); + authenticate(driver); + driver.findElement(By.linkText("Experiment")).click(); + driver.findElement(By.id("create-experiment")).click(); + driver.findElement(By.id("experiment-name")).clear(); + driver.findElement(By.id("experiment-name")).sendKeys(expName + "Phasta-Stampede"); + waitTime(500); + driver.findElement(By.id("experiment-description")).clear(); + driver.findElement(By.id("experiment-description")).sendKeys("Test Experiment"); + waitTime(500); + new Select(driver.findElement(By.id("project"))).selectByVisibleText(ExpFileReadUtils.readProperty("project.name")); + waitTime (500); + new Select(driver.findElement(By.id("application"))).selectByVisibleText("PHASTA"); + waitTime (500); + driver.findElement(By.name("continue")).click(); + driver.findElement(By.id("Mesh_Description_File")).sendKeys(ExpFileReadUtils.PHASTA_INPUT1); + driver.findElement(By.id("Parasolid_Geometric_Model")).sendKeys(ExpFileReadUtils.PHASTA_INPUT2); + driver.findElement(By.id("Problem_Definition")).sendKeys(ExpFileReadUtils.PHASTA_INPUT3); + driver.findElement(By.id("Solver_Inp")).sendKeys(ExpFileReadUtils.PHASTA_INPUT4); + waitTime (500); + new Select(driver.findElement(By.id("compute-resource"))).selectByVisibleText("stampede.tacc.xsede.org"); + waitTime (500); + driver.findElement(By.id("node-count")).clear(); + driver.findElement(By.id("node-count")).sendKeys("1"); + driver.findElement(By.id("cpu-count")).clear(); + driver.findElement(By.id("cpu-count")).sendKeys("4"); + driver.findElement(By.id("wall-time")).clear(); + driver.findElement(By.id("wall-time")).sendKeys("30"); + driver.findElement(By.name("launch")).click(); + waitTime(5000); + driver.findElement(By.cssSelector("span.glyphicon.glyphicon-refresh")).click(); + waitTime(5000); + driver.findElement(By.cssSelector("span.glyphicon.glyphicon-refresh")).click(); + waitTime(5000); + driver.findElement(By.cssSelector("span.glyphicon.glyphicon-refresh")).click(); + waitTime(5000); + } + + private void waitTime(int i) { + try { + Thread.sleep(i); + } catch (InterruptedException e) { + e.printStackTrace(); + } + } + + @After + public void tearDown() throws Exception { + driver.quit(); + String verificationErrorString = verificationErrors.toString(); + if (!"".equals(verificationErrorString)) { + fail(verificationErrorString); + } + } + + private boolean isElementPresent(By by) { + try { + driver.findElement(by); + return true; + } catch (NoSuchElementException e) { + return false; + } + } + + private boolean isAlertPresent() { + try { + driver.switchTo().alert(); + return true; + } catch (NoAlertPresentException e) { + return false; + } + } + + private String closeAlertAndGetItsText() { + try { + Alert alert = driver.switchTo().alert(); + String alertText = alert.getText(); + if (acceptNextAlert) { + alert.accept(); + } else { + alert.dismiss(); + } + return alertText; + } finally { + acceptNextAlert = true; + } + } +} diff --git a/tests/seleniumjava/PHPAiravataTest/src/test/java/com/example/tests/exp/example/tests/SearchProjectExp.java b/tests/seleniumjava/PHPAiravataTest/src/test/java/com/example/tests/exp/example/tests/SearchProjectExp.java new file mode 100644 index 0000000..20938ef --- /dev/null +++ b/tests/seleniumjava/PHPAiravataTest/src/test/java/com/example/tests/exp/example/tests/SearchProjectExp.java @@ -0,0 +1,98 @@ +package com.example.tests.exp.example.tests; + +import java.util.concurrent.TimeUnit; + +import com.example.tests.UserLogin; +import com.example.tests.utils.ExpFileReadUtils; +import org.junit.*; +import static org.junit.Assert.*; + +import org.openqa.selenium.*; +import org.openqa.selenium.firefox.FirefoxDriver; + +/* + **********Search for Project which has Experiments executed********** + * Created by Eroma on 9/16/14. + * The script will search for a project which will list all experiments created; can view the experiment status + * project-name is read from exp.properties file + * Changed by Eroma to read the base URL and sub URL from exp.properties file +*/ + +public class SearchProjectExp extends UserLogin { + private WebDriver driver; + private String baseUrl; + private String subUrl; + private boolean acceptNextAlert = true; + private StringBuffer verificationErrors = new StringBuffer(); + + @Before + public void setUp() throws Exception { + driver = new FirefoxDriver(); + baseUrl = ExpFileReadUtils.readProperty("base.url"); + subUrl = ExpFileReadUtils.readProperty("sub.url"); + driver.manage().timeouts().implicitlyWait(30, TimeUnit.SECONDS); + } + + @Test + public void testSearchProjectExp() throws Exception { + driver.get(baseUrl + subUrl); + authenticate(driver); + driver.findElement(By.linkText("Project")).click(); + driver.findElement(By.id("search-projects")).click(); + driver.findElement(By.id("search-value")).clear(); + driver.findElement(By.id("search-value")).sendKeys(ExpFileReadUtils.readProperty("project.name")); + driver.findElement(By.name("search")).click(); + driver.findElement(By.linkText("View")).click(); + waitTime (10000); + } + + private void waitTime(int i) { + try { + Thread.sleep(i); + } catch (InterruptedException e) { + e.printStackTrace(); + } + } + + @After + public void tearDown() throws Exception { + driver.quit(); + String verificationErrorString = verificationErrors.toString(); + if (!"".equals(verificationErrorString)) { + fail(verificationErrorString); + } + } + + private boolean isElementPresent(By by) { + try { + driver.findElement(by); + return true; + } catch (NoSuchElementException e) { + return false; + } + } + + private boolean isAlertPresent() { + try { + driver.switchTo().alert(); + return true; + } catch (NoAlertPresentException e) { + return false; + } + } + + private String closeAlertAndGetItsText() { + try { + Alert alert = driver.switchTo().alert(); + String alertText = alert.getText(); + if (acceptNextAlert) { + alert.accept(); + } else { + alert.dismiss(); + } + return alertText; + } finally { + acceptNextAlert = true; + } + } +} diff --git a/tests/seleniumjava/PHPAiravataTest/src/test/java/com/example/tests/exp/example/tests/TrinityStampede.java b/tests/seleniumjava/PHPAiravataTest/src/test/java/com/example/tests/exp/example/tests/TrinityStampede.java new file mode 100644 index 0000000..667e571 --- /dev/null +++ b/tests/seleniumjava/PHPAiravataTest/src/test/java/com/example/tests/exp/example/tests/TrinityStampede.java @@ -0,0 +1,126 @@ +package com.example.tests.exp.example.tests; + +import java.util.concurrent.TimeUnit; + +import com.example.tests.UserLogin; +import com.example.tests.utils.ExpFileReadUtils; +import org.junit.*; +import static org.junit.Assert.*; + +import org.openqa.selenium.*; +import org.openqa.selenium.firefox.FirefoxDriver; +import org.openqa.selenium.support.ui.Select; + +/* + **********Executing Trinity Application on Stampede********** + * Created by Eroma on 9/16/14. + * The script generates Trinity application execution on Stampede + * experiment-name and experiment-description are read from the exp.properties file + * Modified by Eroma on 10/27/14. Base URL & Sub URL to be read from the exp.properties file +*/ + +public class TrinityStampede extends UserLogin { + private WebDriver driver; + private String baseUrl; + private String subUrl; + private boolean acceptNextAlert = true; + private StringBuffer verificationErrors = new StringBuffer(); + private String path = null; + private String expName = null; + + @Before + public void setUp() throws Exception { + driver = new FirefoxDriver(); + baseUrl = ExpFileReadUtils.readProperty("base.url"); + subUrl = ExpFileReadUtils.readProperty("sub.url"); + path = ExpFileReadUtils.readProperty("local.path"); + expName = ExpFileReadUtils.readProperty("experiment.name"); + driver.manage().timeouts().implicitlyWait(30, TimeUnit.SECONDS); + } + + @Test + public void testTrinityStampede() throws Exception { + driver.get(baseUrl + subUrl); + authenticate(driver); + driver.findElement(By.linkText("Experiment")).click(); + driver.findElement(By.id("create-experiment")).click(); + driver.findElement(By.id("experiment-name")).clear(); + driver.findElement(By.id("experiment-name")).sendKeys(expName + "Trinity-Stampede"); + waitTime (500); + driver.findElement(By.id("experiment-description")).clear(); + driver.findElement(By.id("experiment-description")).sendKeys("Test Experiment"); + waitTime(500); + new Select(driver.findElement(By.id("project"))).selectByVisibleText(ExpFileReadUtils.readProperty("project.name")); + waitTime(500); + new Select(driver.findElement(By.id("application"))).selectByVisibleText("Trinity"); + waitTime(500); + driver.findElement(By.name("continue")).click(); + waitTime(500); + driver.findElement(By.id("RNA_Seq_Left_Input")).sendKeys(ExpFileReadUtils.TRINITY_INPUT1); + waitTime(500); + driver.findElement(By.id("RNA_Seq_Right_Input")).sendKeys(ExpFileReadUtils.TRINITY_INPUT2); + waitTime (500); + new Select(driver.findElement(By.id("compute-resource"))).selectByVisibleText("stampede.tacc.xsede.org"); + waitTime (500); + driver.findElement(By.id("node-count")).clear(); + driver.findElement(By.id("node-count")).sendKeys("1"); + driver.findElement(By.id("cpu-count")).clear(); + driver.findElement(By.id("cpu-count")).sendKeys("4"); + driver.findElement(By.id("wall-time")).clear(); + driver.findElement(By.id("wall-time")).sendKeys("30"); + driver.findElement(By.name("save")).click(); + waitTime(500); + driver.findElement(By.name("launch")).click(); + waitTime(500); + } + + private void waitTime(int i) { + try { + Thread.sleep(i); + } catch (InterruptedException e) { + e.printStackTrace(); + } + } + + @After + public void tearDown() throws Exception { + driver.quit(); + String verificationErrorString = verificationErrors.toString(); + if (!"".equals(verificationErrorString)) { + fail(verificationErrorString); + } + } + + private boolean isElementPresent(By by) { + try { + driver.findElement(by); + return true; + } catch (NoSuchElementException e) { + return false; + } + } + + private boolean isAlertPresent() { + try { + driver.switchTo().alert(); + return true; + } catch (NoAlertPresentException e) { + return false; + } + } + + private String closeAlertAndGetItsText() { + try { + Alert alert = driver.switchTo().alert(); + String alertText = alert.getText(); + if (acceptNextAlert) { + alert.accept(); + } else { + alert.dismiss(); + } + return alertText; + } finally { + acceptNextAlert = true; + } + } +} diff --git a/tests/seleniumjava/PHPAiravataTest/src/test/java/com/example/tests/exp/example/tests/UserLogout.java b/tests/seleniumjava/PHPAiravataTest/src/test/java/com/example/tests/exp/example/tests/UserLogout.java new file mode 100644 index 0000000..b6ea067 --- /dev/null +++ b/tests/seleniumjava/PHPAiravataTest/src/test/java/com/example/tests/exp/example/tests/UserLogout.java @@ -0,0 +1,51 @@ +package com.example.tests.exp.example.tests; + +import java.util.concurrent.TimeUnit; + +import com.example.tests.UserLogin; +import com.example.tests.utils.ExpFileReadUtils; +import org.junit.*; +import static org.junit.Assert.*; + +import org.openqa.selenium.*; +import org.openqa.selenium.firefox.FirefoxDriver; + +/* + **********User Logout from PHP-Reference-Gateway********** + * Created by Eroma on 9/12/14. + * User logout from the to PHP-Reference-Gateway + * Modified by Eroma on 10/27/14. Base URL & Sub URL to be read from the exp.properties file +*/ + +public class UserLogout extends UserLogin { + private WebDriver driver; + private String baseUrl; + private String subUrl; + private boolean acceptNextAlert = true; + private StringBuffer verificationErrors = new StringBuffer(); + + @Before + public void setUp() throws Exception { + driver = new FirefoxDriver(); + baseUrl = ExpFileReadUtils.readProperty("base.url"); + subUrl = ExpFileReadUtils.readProperty("sub.url"); + driver.manage().timeouts().implicitlyWait(30, TimeUnit.SECONDS); + } + + @Test + public void testUserLogout() throws Exception { + driver.get(baseUrl + subUrl); + authenticate(driver); + driver.findElement(By.linkText("Log out")).click(); + } + + @After + public void tearDown() throws Exception { + driver.quit(); + String verificationErrorString = verificationErrors.toString(); + if (!"".equals(verificationErrorString)) { + fail(verificationErrorString); + } + } + +} diff --git a/tests/seleniumjava/PHPAiravataTest/src/test/java/com/example/tests/exp/example/tests/WRFStampede.java b/tests/seleniumjava/PHPAiravataTest/src/test/java/com/example/tests/exp/example/tests/WRFStampede.java new file mode 100644 index 0000000..e6154ac --- /dev/null +++ b/tests/seleniumjava/PHPAiravataTest/src/test/java/com/example/tests/exp/example/tests/WRFStampede.java @@ -0,0 +1,123 @@ +package com.example.tests.exp.example.tests; + +import java.util.concurrent.TimeUnit; + +import com.example.tests.UserLogin; +import com.example.tests.utils.ExpFileReadUtils; +import org.junit.*; +import static org.junit.Assert.*; + +import org.openqa.selenium.*; +import org.openqa.selenium.firefox.FirefoxDriver; +import org.openqa.selenium.support.ui.Select; + +/* + **********Executing WRF Application on Stampede********** + * Created by Airavata on 9/16/14. + * The script generates WRF application execution on Stampede + * experiment-name and experiment-description are read from the exp.properties file + * Modified by Eroma on 10/27/14. Base URL & Sub URL to be read from the exp.properties file +*/ + +public class WRFStampede extends UserLogin { + private WebDriver driver; + private String baseUrl; + private String subUrl; + private boolean acceptNextAlert = true; + private StringBuffer verificationErrors = new StringBuffer(); + private String path = null; + private String expName = null; + + @Before + public void setUp() throws Exception { + driver = new FirefoxDriver(); + baseUrl = ExpFileReadUtils.readProperty("base.url"); + subUrl = ExpFileReadUtils.readProperty("sub.url"); + path = ExpFileReadUtils.readProperty("local.path"); + expName = ExpFileReadUtils.readProperty("experiment.name"); + driver.manage().timeouts().implicitlyWait(30, TimeUnit.SECONDS); + } + + @Test + public void testWRFStampede() throws Exception { + driver.get(baseUrl + subUrl); + authenticate(driver); + driver.findElement(By.linkText("Experiment")).click(); + driver.findElement(By.id("create-experiment")).click(); + driver.findElement(By.id("experiment-name")).clear(); + driver.findElement(By.id("experiment-name")).sendKeys(expName + "WRF-Stampede"); + waitTime(500); + driver.findElement(By.id("experiment-description")).clear(); + driver.findElement(By.id("experiment-description")).sendKeys("Test Experiment"); + waitTime(500); + new Select(driver.findElement(By.id("project"))).selectByVisibleText(ExpFileReadUtils.readProperty("project.name")); + waitTime(500); + driver.findElement(By.name("continue")).click(); + waitTime(500); + driver.findElement(By.id("Config_Namelist_File")).sendKeys(ExpFileReadUtils.WRF_INPUT1); + waitTime(500); + driver.findElement(By.id("WRF_Boundary_File")).sendKeys(ExpFileReadUtils.WRF_INPUT2); + waitTime(500); + driver.findElement(By.id("WRF_Initial_Conditions")).sendKeys(ExpFileReadUtils.WRF_INPUT3); + waitTime(500); + new Select(driver.findElement(By.id("compute-resource"))).selectByVisibleText("stampede.tacc.xsede.org"); + waitTime (500); + driver.findElement(By.id("node-count")).clear(); + driver.findElement(By.id("node-count")).sendKeys("1"); + driver.findElement(By.id("cpu-count")).clear(); + driver.findElement(By.id("cpu-count")).sendKeys("4"); + driver.findElement(By.id("wall-time")).clear(); + driver.findElement(By.id("wall-time")).sendKeys("30"); + driver.findElement(By.name("launch")).click(); + } + + private void waitTime(int i) { + try { + Thread.sleep(i); + } catch (InterruptedException e) { + e.printStackTrace(); + } + } + + @After + public void tearDown() throws Exception { + driver.quit(); + String verificationErrorString = verificationErrors.toString(); + if (!"".equals(verificationErrorString)) { + fail(verificationErrorString); + } + } + + private boolean isElementPresent(By by) { + try { + driver.findElement(by); + return true; + } catch (NoSuchElementException e) { + return false; + } + } + + private boolean isAlertPresent() { + try { + driver.switchTo().alert(); + return true; + } catch (NoAlertPresentException e) { + return false; + } + } + + private String closeAlertAndGetItsText() { + try { + Alert alert = driver.switchTo().alert(); + String alertText = alert.getText(); + if (acceptNextAlert) { + alert.accept(); + } else { + alert.dismiss(); + } + return alertText; + } finally { + acceptNextAlert = true; + } + } +} diff --git a/tests/seleniumjava/PHPAiravataTest/src/test/java/com/example/tests/utils/AppCatFileReadUtils.java b/tests/seleniumjava/PHPAiravataTest/src/test/java/com/example/tests/utils/AppCatFileReadUtils.java new file mode 100644 index 0000000..1feb94d --- /dev/null +++ b/tests/seleniumjava/PHPAiravataTest/src/test/java/com/example/tests/utils/AppCatFileReadUtils.java @@ -0,0 +1,45 @@ +package com.example.tests.utils; + +import java.io.InputStream; +import java.util.Properties; + + +/* + **********Reading Utilities File********** + * Created by Eroma on 12/11/14. +*/ + +public class AppCatFileReadUtils { + + + public static String AMBER_INPUT1 = getLocalPath() + "/AMBER_FILES/02_Heat.rst"; + public static String AMBER_INPUT2 = getLocalPath() + "/AMBER_FILES/prmtop"; + public static String AMBER_INPUT3 = getLocalPath() + "/AMBER_FILES/03_Prod.in"; + public static String INPUT_PATH2 = getLocalPath() + "/Stampede/Trinity/reads.left.fq"; + + public static String getLocalPath() { + try { + return AppCatFileReadUtils.readProperty("local.path"); + }catch(Exception e) { + e.printStackTrace(); + throw new RuntimeException(e); + } + } + + public static String readProperty (String propertyName) throws Exception{ + Properties prop = new Properties(); + InputStream input = null; + try{ + String filename = "app.catalog.properties"; + input = ExpFileReadUtils.class.getClassLoader().getResourceAsStream(filename); + if(input==null){ + throw new Exception("Unable to read the file.."); + } + //load a properties file from class path, inside static method + prop.load(input); + return prop.getProperty(propertyName); + }catch (Exception e){ + throw new Exception("Error while reading file..", e); + } + } +} diff --git a/tests/seleniumjava/PHPAiravataTest/src/test/java/com/example/tests/utils/CurrentDateTime.java b/tests/seleniumjava/PHPAiravataTest/src/test/java/com/example/tests/utils/CurrentDateTime.java new file mode 100644 index 0000000..19ced82 --- /dev/null +++ b/tests/seleniumjava/PHPAiravataTest/src/test/java/com/example/tests/utils/CurrentDateTime.java @@ -0,0 +1,19 @@ +package com.example.tests.utils; + +import java.text.SimpleDateFormat; +import java.util.Calendar; +import java.util.Date; + +/** + * Created by airavata on 11/24/14. + */ +public class CurrentDateTime { + private static final String DATE_PATTERN = "yyyy-MM-dd'T'HH:mm:ss"; + + public static String getTodayDate() { + Calendar calendar = Calendar.getInstance(); + Date date = calendar.getTime(); + SimpleDateFormat simpleDateFormat = new SimpleDateFormat(DATE_PATTERN); + return simpleDateFormat.format(date); + } +} diff --git a/tests/seleniumjava/PHPAiravataTest/src/test/java/com/example/tests/utils/ExpFileReadUtils.java b/tests/seleniumjava/PHPAiravataTest/src/test/java/com/example/tests/utils/ExpFileReadUtils.java new file mode 100644 index 0000000..2b35783 --- /dev/null +++ b/tests/seleniumjava/PHPAiravataTest/src/test/java/com/example/tests/utils/ExpFileReadUtils.java @@ -0,0 +1,65 @@ +package com.example.tests.utils; + +import java.io.InputStream; +import java.util.Enumeration; +import java.util.Properties; + +/* + **********Reading Utilities File********** + * Created by Airavata on 9/15/14. +*/ + +public class ExpFileReadUtils { + public static String readProperty (String propertyName) throws Exception{ + Properties prop = new Properties(); + InputStream input = null; + try{ + String filename = "exp.properties"; + input = ExpFileReadUtils.class.getClassLoader().getResourceAsStream(filename); + if(input==null){ + throw new Exception("Unable to read the file.."); + } + //load a properties file from class path, inside static method + prop.load(input); + + Enumeration e = prop.propertyNames(); + + while (e.hasMoreElements()) { + String key = (String) e.nextElement(); + System.out.println(key + " -- " + prop.getProperty(key)); + } + + return prop.getProperty(propertyName); + }catch (Exception e){ + throw new Exception("Error while reading file..", e); + } + } + public static String AMBER_INPUT1 = getLocalPath() + "/AMBER_FILES/02_Heat.rst"; + public static String AMBER_INPUT2 = getLocalPath() + "/AMBER_FILES/prmtop"; + public static String AMBER_INPUT3 = getLocalPath() + "/AMBER_FILES/03_Prod.in"; + public static String ESPRESSO_INPUT1 = getLocalPath() + "/ESPRESSO_FILES/Al.sample.in"; + public static String ESPRESSO_INPUT2 = getLocalPath() + "/ESPRESSO_FILES/Al.pz-vbc.UPF"; + public static String GROMACS_INPUT1 = getLocalPath() + "/GROMMACS_FILES/pdb1y6l.gro"; + public static String GROMACS_INPUT2 = getLocalPath() + "/GROMMACS_FILES/pdb1y6l-EM-vacuum.tpr"; + public static String LAMMPS_INPUT1 = getLocalPath() + "/LAMMPS_FILES/in.friction"; + public static String NWCHEM_INPUT1 = getLocalPath() + "/NWCHEM_FILES/water.nw"; + public static String PHASTA_INPUT1 = getLocalPath() + "/PHASTA_FILES/geom.sms"; + public static String PHASTA_INPUT2 = getLocalPath() + "/PHASTA_FILES/geom.xmt_txt"; + public static String PHASTA_INPUT3 = getLocalPath() + "/PHASTA_FILES/geom.smd"; + public static String PHASTA_INPUT4 = getLocalPath() + "/PHASTA_FILES/solver.inp"; + public static String TRINITY_INPUT1 = getLocalPath() + "/TRINITY_FILES/reads.left.fq"; + public static String TRINITY_INPUT2 = getLocalPath() + "/TRINITY_FILES/reads.right.fq"; + public static String WRF_INPUT1 = getLocalPath() + "/WRF_FILES/namelist.input"; + public static String WRF_INPUT2 = getLocalPath() + "/WRF_FILES/wrfbdy_d01"; + public static String WRF_INPUT3 = getLocalPath() + "/WRF_FILES/wrfinput_d01"; + + public static String getLocalPath() { + try { + return ExpFileReadUtils.readProperty("local.path"); + }catch(Exception e) { + e.printStackTrace(); + throw new RuntimeException(e); + } + } +} + diff --git a/tests/seleniumjava/PHPAiravataTest/src/test/resources/app.catalog.properties b/tests/seleniumjava/PHPAiravataTest/src/test/resources/app.catalog.properties new file mode 100644 index 0000000..77f8357 --- /dev/null +++ b/tests/seleniumjava/PHPAiravataTest/src/test/resources/app.catalog.properties @@ -0,0 +1,8 @@ +#############Properties Required for Executing Test Scripts######################### +# Created by Eroma on 9/16/14. +# Modified by Eroma on 10/27/14. +#################################################################################### + +#'Project Name' & 'Project Description' used in creating, searching for the project. This 'Project' is also referred when creating experiments. +#**********************************************************************************************************************************************# + diff --git a/tests/seleniumjava/PHPAiravataTest/src/test/resources/exp.properties b/tests/seleniumjava/PHPAiravataTest/src/test/resources/exp.properties new file mode 100644 index 0000000..8d40a00 --- /dev/null +++ b/tests/seleniumjava/PHPAiravataTest/src/test/resources/exp.properties @@ -0,0 +1,73 @@ +#############Properties Required for Executing Test Scripts######################### +# Created by Eroma on 9/16/14. +# Modified by Eroma on 10/27/14. +#################################################################################### + +#'Project Name' & 'Project Description' used in creating, searching for the project. This 'Project' is also referred when creating experiments. +#**********************************************************************************************************************************************# +project.name = December/12/2014 +project.description = Selenium_Test_Project + +# Common Part of the Experiment name. Hint: for your ease this part could be your name; unique value to search for +#*****************************************************************************************************************# +experiment.name = SLM- + +# Common path of the local file path where application input files exists +#************************************************************************# +local.path = /Users/airavata/Documents/Application_input_files +# /Users/airavata/Documents/PHP-Gateway-Scripts + +# Clone & Edit Experiments +#*************************# +search.experiment.name = TEST_EXP4 +search.key = Experiment Description +created.time = 2014-12-01 21:32:00 +search.value = 2014 +experiment.status = CREATED +new.experiment.name = TEST_EXP400 +new.project.name = Test Project 1 +# Experiment Sear Keys : Experiment Description, Experiment Name, Application, Creation Time + +# Application Catalog - Add Compute Resource Information +#***************************************************# +# Queue +queue1.name = TEST-NORMAL +queue2.name = TEST-DEFAULT + +# File System +filePath.name = TEST/LOCAL/CURRENT/ + +# Job Submission & Data Movement +securityProtocol.value = GSI +# Other values are - USERNAME_PASSWORD, GSI, KERBEROS, OAUTH + +# Job Submission +resourceJobManagerType.value = SLURM +# Other values are - PBS, UGE, SLURM + + + +# Application Catalog - Add Compute Resource Information +#***************************************************# +# Compute Resource Description +computeResource.ID = TEST_COMP_RES_2014-12-10T16:21:29_ac7a741f-7a75-41e0-94eb-1f6ef9203f40 +# Existing Application Module Name (used in both DeleteAppModule & ModAppModule Test Scripts) +appModuleName = MODIFIED_APP_2014-12-09T14:15:13 +# Modified Application Module Name +# Existing Application Interface Name +appInterface.name=Media1_App_Interface_11/25/2014 +# PGA gateway Base URL Path +#**************************# +base.url = http://dev.test-drive.airavata.org/pga/public/ +# Two Base URLs exists +# Old URL = http://test-drive.airavata.org/PHP-Reference-Gateway/ +# New URL = http://dev.test-drive.airavata.org/pga/public/ +# RC of Relese 0.14 = http://test-drive.airavata.org/pga/public/ + +# PGA gateway Sub URL +#********************# +sub.url = home +# Two Sub URLs exists +# Old URL = index.php +# New URL = home +# RC of Release 0.14 = home \ No newline at end of file diff --git a/tests/seleniumjava/README.txt b/tests/seleniumjava/README.txt new file mode 100644 index 0000000..09a1e7b --- /dev/null +++ b/tests/seleniumjava/README.txt @@ -0,0 +1,44 @@ +########################################################################### +################JAVA TEST SCRIPTS FOR PHP REFERENCE GATEWAY################ +########################################################################### + + + +###############Prerequisites To Run The Selenium Java Scripts############## +1. Firefox V 31.0 or less is required for the scripts. +https://support.mozilla.org/en-US/kb/install-older-version-of-firefox +2. Once Firefox is installed install Selenium IDE +http://www.seleniumhq.org/download/ +3. Copy all PHP-Reference-Gateway application input files from +https://cwiki.apache.org/confluence/display/AIRAVATA/XSEDE14+Gateway+Tutorial+Application+Input+Files+and+Parameters +4. Download the Selenium Java test classes from folder 'tests' in +https://github.com/SciGaP/PHP-Reference-Gateway +########################################################################### + + +###############Environments available for Running the Scripts############## +Selenium test are executed through PHP-Reference-Gateway by giving the URL +Current Production URLs +Base URL: http://test-drive.airavata.org/PHP-Reference-Gateway +Sub URL: index.php +########################################################################### + + +###################Script Alterations & Execution Steps################### +1. Change the config file with values prefered for + i. Project Name + ii. Project Description + iii.Experiment Name Extension +2. In the config.properties file enter + The correct base URL and sub URL of your working PPHP-Reference-Gateway. + Change the path of the input files (Where the files exists in your local machine) for the applications. + The static part of the path is in the config file and the varying part is in each test class. +4. Execution Steps + i. CreateUserLogin.java - If you don't have a user already + ii. In UserLogin class change the username and password to your own username and password + iii.CreateModifySearchProject.java - Create A Project, Modify and Search for the Project + iV. Run Experiment creation scripts at your prefered sequence + V. At the end run the SearchProjectExp.java to view your experiments (For the ease you can create all your experiments under one Project) + VI. UserLogout.java +5. UserLogin is not executable alone +########################################################################### \ No newline at end of file