From 576b7a8d7ac8a9ba78e236e5057c83ffdb3b7a56 Mon Sep 17 00:00:00 2001 From: Natasa Kapravelou Date: Wed, 23 Feb 2011 17:43:23 +0200 Subject: [PATCH 1/1] Removed newly created by unnecessary class. Selenese test Case seems to work. Some new tries on expanding a folder have been made. The '+' sign is located but somehow the click() is not allowed -- still work in progress. --- .../client/selenium/ide/tests/IDERightClick.java | 17 ++-- .../ebs/gss/client/selenium/tests/FolderUtils.java | 19 ++--- .../client/selenium/tests/GeneralPurposeUtils.java | 68 ++++++++++++++- .../ebs/gss/client/selenium/tests/SetUpUtils.java | 89 -------------------- .../client/selenium/tests/TestFolderBasics.java | 38 ++++++--- 5 files changed, 113 insertions(+), 118 deletions(-) delete mode 100644 test/gr/ebs/gss/client/selenium/tests/SetUpUtils.java diff --git a/test/gr/ebs/gss/client/selenium/ide/tests/IDERightClick.java b/test/gr/ebs/gss/client/selenium/ide/tests/IDERightClick.java index 3217f47..611a4be 100644 --- a/test/gr/ebs/gss/client/selenium/ide/tests/IDERightClick.java +++ b/test/gr/ebs/gss/client/selenium/ide/tests/IDERightClick.java @@ -32,11 +32,16 @@ import org.junit.Test; public class IDERightClick extends SeleneseTestCase{ + /** + * TIP: Start the Selenium RC serve using + * in the dependencies directory + * java -jar selenium-server-standalone-2.0b1.jar + */ @Before public void setUp() throws Exception { - selenium = new DefaultSelenium("localhost", 4444, "*firefox", "http://127.0.0.1:8080/pithos/login?next=http://127.0.0.1:8080/pithos/"); - setUp("http://127.0.0.1:8080/pithos/login?next=http://127.0.0.1:8080/pithos/", "*firefox"); + selenium = new DefaultSelenium("localhost", 4444, "*chrome", "http://127.0.0.1:8080/pithos/login?next=http://127.0.0.1:8080/pithos/"); +// setUp("http://127.0.0.1:8080/pithos/login?next=http://127.0.0.1:8080/pithos/", "*firefox"); selenium.start(); } @@ -48,9 +53,11 @@ public class IDERightClick extends SeleneseTestCase{ @Test public void testRestoreTrash() throws Exception { - selenium.open("/pithos/#Files"); - selenium.click("lakis@ebs.gr"); - selenium.contextMenuAt("Trash", ""); +// selenium.open("/pithos/#Files"); + selenium.open("http://127.0.0.1:8080/pithos/login?next=http://127.0.0.1:8080/pithos/"); + selenium.waitForPageToLoad("300000"); + selenium.click("lakis@ebs.gr"); + selenium.contextMenuAt("Trash", ""); selenium.click("folderContextMenu.restore"); } diff --git a/test/gr/ebs/gss/client/selenium/tests/FolderUtils.java b/test/gr/ebs/gss/client/selenium/tests/FolderUtils.java index 103bfa8..02bbcf8 100644 --- a/test/gr/ebs/gss/client/selenium/tests/FolderUtils.java +++ b/test/gr/ebs/gss/client/selenium/tests/FolderUtils.java @@ -25,17 +25,14 @@ import org.openqa.selenium.WebElement; public class FolderUtils extends GeneralPurposeUtils{ - public void expandTree(){ -// ERROR: Compound class names are not supported. Consider searching for one class name and filtering the results. -// action.click(By.className("GK31MSKBDF GK31MSKBLF")); -// action.click(By.xpath("//span[@id='Trash']/../../..")); -// action.click(By.xpath("//div[@id='']/img")); -// action.click(By.xpath("//span[@id='Trash']/..")); -// action.click(By.xpath("ancestor:://span[@id='Trash']"));// Error not legal expression -// action.click(By.xpath("//div[@class='GK31MSKBCF GK31MSKBKF gwtQuery-draggable gwtQuery-droppable']")); - action.click(By.xpath("/html/body/table/tbody/tr[4]/td/div/div/div/div/div/div/div/div[2]/div/div")); - //selenium.click("//*/img[contains(@src,'telpfeil.gif')]"); -// return action.clickAndSendText(By.xpath("//span[@id='Trash']/..")); + public String expandTree(){ + WebElement element = driver.findElement(By.xpath("//span[@id='lakis@ebs.gr.hasta luego']/../../div[1]")); + String res = element.getAttribute("style"); + return res; + } + + public void expandFolder(){ + driver.findElement(By.xpath("//span[@id='lakis@ebs.gr.hasta luego']/../../div[1]")).click(); } diff --git a/test/gr/ebs/gss/client/selenium/tests/GeneralPurposeUtils.java b/test/gr/ebs/gss/client/selenium/tests/GeneralPurposeUtils.java index 93cd877..c814122 100644 --- a/test/gr/ebs/gss/client/selenium/tests/GeneralPurposeUtils.java +++ b/test/gr/ebs/gss/client/selenium/tests/GeneralPurposeUtils.java @@ -18,11 +18,73 @@ */ package gr.ebs.gss.client.selenium.tests; +import java.util.Set; + +import org.junit.After; +import org.junit.Before; import org.openqa.selenium.By; +import org.openqa.selenium.WebDriver; +import org.openqa.selenium.firefox.FirefoxDriver; + +public class GeneralPurposeUtils { + + public ActionUtils action; + + public WebDriver driver; + + public String url = "http://127.0.0.1:8080/pithos/login?next=http://127.0.0.1:8080/pithos/"; + + public String fileName = "darth_vader.jpg"; + + public String groupName = "Wookiees"; + + public String userName = "lakis@ebs.gr"; + + public String addUserName = "past@ebs.gr"; + + public String folderName = "Alderaan"; + + public String folderDestination = "Naboo"; + + public String newFolderName = "Mustafar"; + + /** + * FirefoxProfile profile = new FirefoxProfile(); + * + */ + + @Before + public void setUp() throws Exception { + + /** + * set up for using firefox add on in WebDriver + * driver = new FirefoxDriver(profile); + * profile.addExtension("",""); + */ + + driver = new FirefoxDriver(); + + action = new ActionUtils(driver); + + action.getUrl(url); + + // Necessary delay in order all dom elements to be created + Thread.sleep(3000); + } -public class GeneralPurposeUtils extends SetUpUtils{ + /** + * @throws java.lang.Exception + */ + @After + public void tearDown() throws Exception { + action.quit(); + } + + public Set getWindowHandles(){ + return driver.getWindowHandles(); + } /** * Click the top e.g file menu, edit menu etc @@ -66,6 +128,10 @@ public class GeneralPurposeUtils extends SetUpUtils{ action.click(By.id(aUserName+ "." + aFolderName)); } + public void selectSubFolder(String aFolderName, String aSubFolderName){ + action.click(By.id(aFolderName+ "." + aSubFolderName)); + } + /** * Select the Trash folder */ diff --git a/test/gr/ebs/gss/client/selenium/tests/SetUpUtils.java b/test/gr/ebs/gss/client/selenium/tests/SetUpUtils.java deleted file mode 100644 index 5620daf..0000000 --- a/test/gr/ebs/gss/client/selenium/tests/SetUpUtils.java +++ /dev/null @@ -1,89 +0,0 @@ -/* - * Copyright 2011 Electronic Business Systems Ltd. - * - * This file is part of GSS. - * - * GSS is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * GSS is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with GSS. If not, see . - */ -package gr.ebs.gss.client.selenium.tests; - - -import java.util.Set; - -import org.junit.After; -import org.junit.Before; -import org.openqa.selenium.WebDriver; -import org.openqa.selenium.firefox.FirefoxDriver; - - - -public class SetUpUtils { - - public ActionUtils action; - - public WebDriver driver; - - public String url = "http://127.0.0.1:8080/pithos/login?next=http://127.0.0.1:8080/pithos/"; - - public String fileName = "darth_vader.jpg"; - - public String groupName = "Wookiees"; - - public String userName = "lakis@ebs.gr"; - - public String addUserName = "past@ebs.gr"; - - public String folderName = "Alderaan"; - - public String folderDestination = "Naboo"; - - public String newFolderName = "Mustafar"; - - /** - * FirefoxProfile profile = new FirefoxProfile(); - * - */ - - @Before - public void setUp() throws Exception { - - /** - * set up for using firefox add on in WebDriver - * driver = new FirefoxDriver(profile); - * profile.addExtension("",""); - */ - - driver = new FirefoxDriver(); - - action = new ActionUtils(driver); - - action.getUrl(url); - - // Necessary delay in order all dom elements to be created - Thread.sleep(3000); - } - - /** - * @throws java.lang.Exception - */ - @After - public void tearDown() throws Exception { - action.quit(); - } - - public Set getWindowHandles(){ - return driver.getWindowHandles(); - } - -} diff --git a/test/gr/ebs/gss/client/selenium/tests/TestFolderBasics.java b/test/gr/ebs/gss/client/selenium/tests/TestFolderBasics.java index e378f94..b602eb4 100644 --- a/test/gr/ebs/gss/client/selenium/tests/TestFolderBasics.java +++ b/test/gr/ebs/gss/client/selenium/tests/TestFolderBasics.java @@ -85,18 +85,32 @@ public class TestFolderBasics extends FolderUtils{ } -// /** -// * Method that tries to expand the '+' symbol -// * in order to reveal folder's containing folders -// * @throws InterruptedException -// */ -// @Test -// public void testExpand() throws InterruptedException{ -//// selectTrash(); -// expandTree(); -// Thread.sleep(3000); -// -// } + /** + * Method that tries to expand the '+' symbol + * in order to reveal folder's containing folders + * @throws InterruptedException + */ + @Test + public void testExpand() throws InterruptedException{ + expandFolder(); + System.out.println("ssss"); + Thread.sleep(2000); + selectSubFolder("hasta luego", "abburido"); + Thread.sleep(1000); + selectTopMenu("file"); + Thread.sleep(1000); + selectAnOptionInTopMenu("file", "newFolder"); + + Thread.sleep(1000); + + typeInFolderPropertiesDialog("textBox.name", "feliz"); + Thread.sleep(1000); + //Submit + selectElementFromFolderPropertiesDialog("button.ok"); + + Thread.sleep(4000); + + } // @Test public void testCutFolder(){ -- 1.7.10.4