Added: ofbiz/trunk/framework/testtools/src/org/ofbiz/testtools/seleniumxml/SeleniumXml.java
URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/testtools/src/org/ofbiz/testtools/seleniumxml/SeleniumXml.java?rev=804074&view=auto ============================================================================== --- ofbiz/trunk/framework/testtools/src/org/ofbiz/testtools/seleniumxml/SeleniumXml.java (added) +++ ofbiz/trunk/framework/testtools/src/org/ofbiz/testtools/seleniumxml/SeleniumXml.java Fri Aug 14 04:22:27 2009 @@ -0,0 +1,736 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +package org.ofbiz.testtools.seleniumxml; + +import java.io.File; +import java.io.FileInputStream; +import java.io.IOException; +import java.io.InputStream; +import java.net.MalformedURLException; +import java.util.HashMap; +import java.util.List; +import java.util.ArrayList; +import java.util.Map; +import java.util.Properties; +import java.util.regex.Matcher; +import java.util.regex.Pattern; +import java.lang.reflect.*; + +import junit.framework.Assert; + +import org.apache.commons.lang.RandomStringUtils; +import org.apache.log4j.Level; +import org.apache.log4j.Logger; +import org.apache.log4j.BasicConfigurator; +import org.jdom.Document; +import org.jdom.Element; +import org.jdom.JDOMException; +import org.jdom.input.SAXBuilder; + +import org.ofbiz.testtools.seleniumxml.util.TestUtils; + +import com.thoughtworks.selenium.DefaultSelenium; +//import com.thoughtworks.selenium.SeleniumException; + + +public class SeleniumXml { + + public static final String PROPS_NAME = "selenium.config"; + Logger logger = Logger.getLogger(SeleniumXml.class.getName()); + + public static final int MAX_STR_LENGTH = 15; + static String testPath; + private Map <String, Object> map; + private Document doc; + private DefaultSelenium sel; + private static Properties props; + private String testSourcePath; + private String username; + private String password; + + public static void main(String[] args) throws JDOMException, IOException{ + if(args.length == 0) { + System.out.println("Please include a path for the selenium XML test file."); + } else { + SeleniumXml sel = new SeleniumXml(); + for (String arg: args) { + if (arg.startsWith("-username")) { + sel.username = arg.substring(10); + } else if (arg.startsWith("-password")) { + sel.password = arg.substring(10); + } else { + sel.testSourcePath = arg; + } + } + sel.runTest(args[0]); + } + } + + public SeleniumXml() throws IOException { + this.map = new HashMap<String, Object>(); + if (props == null) { + props = new Properties(); + initConfig(); + } + logger.setLevel(Level.DEBUG); + } + + private static void initConfig() throws IOException { + try { + String configFile = System.getProperty(PROPS_NAME); + if (configFile == null) { + String errMsg = "The Java environment (-Dxxx=yyy) variable with name " + PROPS_NAME + " is not set, cannot resolve location."; + throw new MalformedURLException(errMsg); + } + BasicConfigurator.configure(); + InputStream in = new FileInputStream(configFile); + props.load(in); + in.close(); + + + } catch (IOException e) { + e.printStackTrace(); + throw e; + } + } + + /** + * Constructor to preset with an existing Map of parameters. Intended to be used + * for nested Selenium tests. + * @param map + */ + public SeleniumXml(SeleniumXml selenium) { + this.sel = selenium.getSelenium(); + this.map = selenium.getParameterMap(); + } + + public DefaultSelenium getSelenium() { + return this.sel; + } + public Map <String, Object> getParameterMap() { + return this.map; + } + public void runTest(String fileName) throws JDOMException, IOException { + readFile(fileName); + setupSelenium(); + runCommands(); + } + + public void runCommands(){ + Element root = this.doc.getRootElement(); + List<Element> nodes = root.getChildren(); + runCommands(nodes); + } + + public void runCommands(List<Element> nodes){ + + for(Element elem: nodes) { + if("type" == elem.getName()) { + typeCmd(elem); + + } else if("clickAt" == elem.getName()) { + clickAt(elem); + } else if("waitForValue" == elem.getName()) { + waitForValue(elem); + } else if("waitForCondition" == elem.getName()) { + waitForCondition(elem); + } else if("loadData" == elem.getName()) { + loadData(elem); + } else if("loadData" == elem.getName()) { + loadData(elem); + } else if("jythonRunner" == elem.getName()) { + jythonRunner(elem); + } else if("groovyRunner" == elem.getName()) { + groovyRunner(elem); + } else if("dataLoop" == elem.getName()) { + dataLoop(elem); + } else if("remoteRequest" == elem.getName()) { + remoteRequest(elem); + } else if("selectPopup" == elem.getName()) { + selectPopup(elem); + } else if("getAllWindowIds" == elem.getName()) { + getAllWindowIds(elem); + } else if("captureTextInPage" == elem.getName()) { + captureTextInPageCmd(elem); + } else if("getSelectedLabel" == elem.getName()) { + getSelectedLabel(elem); + } else if("getSelectedValue" == elem.getName()) { + getSelectedValue(elem); + } else if("getSelectedId" == elem.getName()) { + getSelectedId(elem); + } else if("testcase" == elem.getName()) { + testcase(elem); + } else if("assertContains" == elem.getName()) { + assertContains(elem); + } else if("getHtmlSource" == elem.getName()) { + getHtmlSource(elem); + } else if("getBodyText" == elem.getName()) { + getBodyText(elem); + } else if("setup" == elem.getName()) { + continue; //setup is handled previously + } else if("print" == elem.getName()) { + printCmd(elem); + } else if("waitForPageToLoad" == elem.getName()) { + waitForPageToLoadCmd(elem); + } else if("getSelectedIds" == elem.getName()) { + getSelectedIdsCmd(elem); + } else if("copy" == elem.getName()) { + copyCmd(elem); + } else if("append" == elem.getName()) { + appendCmd(elem); + } else if("open" == elem.getName()) { + openCmd(elem); + } else if("click" == elem.getName()) { + clickCmd(elem); + } else if("select" == elem.getName()) { + selectCmd(elem); + } else if("uniqueId" == elem.getName()) { + uniqueIdCmd(elem); + } else if("randomAlphaString" == elem.getName()) { + randomAlphaStringCmd(elem); + } else if("randomString" == elem.getName()) { + randomStringCmd(elem); + } else if("setSpeed" == elem.getName()) { + setSpeed(elem); + } else { + //logger.error("Unknown SeleniumXml command found:"+elem.getName()); + //Use reflection with parameters using the naming convention param1, param2, and any return results stored + //in map using "out" + logger.info("Undefined command calling by reflection for command: " + elem.getName()); + callByReflection(elem); + } + } + + } + + private void callByReflection(Element elem) { + + String methodName = elem.getName(); + //Support two parameters for all selenium RC calls + String param1 = elem.getAttributeValue("param1"); + String param2 = elem.getAttributeValue("param2"); + + Class[] paramTypes = null; + Object[] args = null; + if( (param1 != null) && (param2 != null) ) { + paramTypes = new Class[] {String.class, String.class}; + args = new Object[] {param1, param2}; + } else if (param1 != null) { + paramTypes = new Class[] {String.class}; + args = new Object[] {param1}; + } else { + paramTypes = new Class[] {}; + args = new Object[] {}; + } + + //Capture the output name for "get" methods + String out = elem.getAttributeValue("out"); + + Method m; + try { + m = (Method) this.sel.getClass().getDeclaredMethod(methodName, paramTypes); + Object results = m.invoke(this.sel, args); + + //Add output parameter to common map + if( (out != null) && (results != null)) { + addParam(out, results); + } + } catch (Exception e) { + // TODO Auto-generated catch block + logger.error("Exception occurred when Unknown SeleniumXml command found:"+elem.getName()); + e.printStackTrace(); + } + + + } + + public void waitForValue(Element elem) { + + String locator = elem.getAttributeValue("locator"); + String timeout = elem.getAttributeValue("timeout"); + String outParam = elem.getAttributeValue("out"); + + int maxTime = Integer.parseInt(timeout); + int maxSeconds = maxTime/1000; + logger.debug("waitForValue: locator=" + locator + " timeout=" + timeout); + //this.sel.waitForCondition(script, timeout); + String foundValue = null; + for(int second=0;; second++) { + if(second >= maxSeconds) { +// throw new SeleniumException("waitForValue exceeded timeout: " + maxTime); + } + try{ + //getValue throws an exception if it can't find locator + // - sleep for 1 sec and try again + // - otherwise break as we found the value + foundValue = sel.getValue(locator); + if(outParam != null) { + this.addParam(outParam, foundValue); + } + break; // + } catch(Exception e) { + //wait for 1 second and then resume + try { + Thread.sleep(1000); + } catch (InterruptedException threadE) { + // TODO Auto-generated catch block + threadE.printStackTrace(); + + } + } + } + } + + public void waitForCondition(Element elem) { + + String script = elem.getAttributeValue("script"); + String timeout = elem.getAttributeValue("timeout"); + + logger.debug("waitForCondition: script=" + script + " timeout=" + timeout); + this.sel.waitForCondition(script, timeout); + } + + public void loadData(Element elem) { + + String file = elem.getAttributeValue("file"); + String iterations = elem.getAttributeValue("iterations"); + List children = elem.getChildren(); + + DataLoader loader = new DataLoader(file, iterations, this, children); + loader.runTest(); + } + + public void groovyRunner(Element elem) { + + String urlName = elem.getAttributeValue("srcUrl"); + GroovyRunner runner = new GroovyRunner(urlName, this); + runner.runTest(); + } + + public void jythonRunner(Element elem) { + + String urlName = elem.getAttributeValue("srcUrl"); + JythonRunner runner = new JythonRunner(urlName, this); + runner.runTest(); + } + + public void dataLoop(Element elem) { + + String dataListName = elem.getAttributeValue("dataListName"); + List children = elem.getChildren(); + + DataLoop looper = new DataLoop(dataListName, this, children); + looper.runTest(); + } + + public void remoteRequest(Element elem) { + + String requestUrl = elem.getAttributeValue("url"); + String host = elem.getAttributeValue("host"); + if (host == null || host.length() == 0) { + host = props.getProperty("startUrl"); + } + String responseHandlerMode = elem.getAttributeValue("responseHandlerMode"); + List <Element> children = elem.getChildren(); + + RemoteRequest loader = new RemoteRequest( this, children, requestUrl, host, responseHandlerMode); + loader.runTest(); + } + + public String getParamValue(String key) { + return (String) this.map.get(key); + } + + public Object getParamValue(Object key) { + return this.map.get(key); + } + + public void addParam(String name, String value) { + //logger.info("addParam: name=" + name + " value="+value); + this.map.put(name, value); + } + + public void addParam(String name, Object value) { + //logger.info("addParam: name=" + name + " value="+value); + this.map.put(name, value); + } + + private void assertContains(Element elem) { + String src = replaceParam(elem.getAttributeValue("src")); + String test = replaceParam(elem.getAttributeValue("test")); + int indxSearch = src.indexOf(test); + if(indxSearch == -1) { + logger.info("assertContains didn't find " + test + " in the src"); + } else { + logger.info("assertContains found " + test + " in the src"); + } + Assert.assertTrue(indxSearch != -1); + //String text = this.sel.getHtmlSource(); + } + + private void selectPopup(Element elem) { + String locator = elem.getAttributeValue("locator"); +// String winId = elem.getAttributeValue("windowId"); + String timeout = elem.getAttributeValue("timeout"); + + //this.sel.waitForPopUp(winId, timeout); + this.sel.click(locator); + + String[] winNames = this.sel.getAllWindowNames(); + this.sel.selectWindow("name=" + winNames[1]); + } + + private void getAllWindowIds(Element elem) { + String[] winIds = this.sel.getAllWindowIds(); + for(int i=0; i<winIds.length; i++) { + logger.info("WindowId: " + winIds[i]); + } + String[] winNames = this.sel.getAllWindowNames(); + for(int i=0; i<winIds.length; i++) { + logger.info("WindowName: " + winNames[i]); + } + + //this.sel.selectWindow("name=" + winNames[1]); + //System.out.println("Did we select WindowName: " + winNames[1]); + } + + private void getWindowPopup(Element elem) { + + } + /** + * Gets the hidden value of a list box + * @param elem + */ + private void getSelectedValue(Element elem) { + String locator = elem.getAttributeValue("locator"); + String out = elem.getAttributeValue("out"); + String text = this.sel.getSelectedValue(locator); + logger.info("getSelectedValue: locator=" + locator + " text="+text); + addParam(out, text); + } + + /** + * Gets the visible (displayed) value of a list box + * @param elem + */ + private void getSelectedLabel(Element elem) { + String locator = elem.getAttributeValue("locator"); + String out = elem.getAttributeValue("out"); + String text = this.sel.getSelectedLabel(locator); + logger.info("getSelectedValue: locator=" + locator + " text="+text); + addParam(out, text); + } + private void getSelectedId(Element elem) { + String locator = elem.getAttributeValue("locator"); + String out = elem.getAttributeValue("out"); + String text = this.sel.getSelectedId(locator); + addParam(out, text); + } + private void getHtmlSource(Element elem) { + String paramName = elem.getAttributeValue("out"); + String text = this.sel.getHtmlSource(); + //logger.info("getHtmlsource: paramName=" + paramName + " text=" + text); + addParam(paramName, text); + } + + private void getBodyText(Element elem) { + String paramName = elem.getAttributeValue("out"); + String text = this.sel.getBodyText(); + //logger.info("getBodyText: paramName=" + paramName + " text=" + text); + addParam(paramName, text); + } + private void testcase(Element elem) { + System.err.println("New testcase: " + elem.getAttributeValue("file")); + String testFile = elem.getAttributeValue("file"); + SeleniumXml newTest = new SeleniumXml(this); + try { + newTest.runTest(testFile); + } catch (Exception e) { + e.printStackTrace(); + Assert.fail("Testcase error for file: " + testFile); + } + } + private void clickAt(Element elem) { + logger.debug("clickAt: " + replaceParam(elem.getAttributeValue("locator"))); + String locator = elem.getAttributeValue("locator"); + String coordString = elem.getAttributeValue("coordString"); + this.sel.clickAt(locator, coordString); + } + /** + * @param elem takes a Selenium String locator. See Javadocs for more information. Here are some + * example locators: + * id="buttonId" - the easiest + * css=input[type='submit'] - uses css selector notation + * xpath= <TBD> + * dom= <TBD> + */ + private void clickCmd(Element elem) { + String locator = this.replaceParam(elem.getAttributeValue("locator")); + logger.info("clickCmd: " + locator); + this.sel.click(locator); + } + private void typeCmd(Element elem) { + String name = elem.getAttributeValue("name"); + String value = replaceParam(elem.getAttributeValue("value")); + logger.info("typeCmd: id=" + name + " value=" + value); + this.sel.type(name, value); + } + /* + * setSpeed delays the time for the next selenium command to execute + */ + private void setSpeed(Element elem) { + logger.info("setSpeed: " + elem.getAttributeValue("value")); + this.sel.setSpeed(elem.getAttributeValue("value")); + } + /* + * waitForPageToLoadCmd is the max timeout selenium will wait for a page to load. + * Commands are executed immediately after the page loads therefore if the pages are + * fast the test will go through the pages very quickly. Use setSpeed if you want to + * see the pages executed slower. + */ + private void waitForPageToLoadCmd(Element elem) { + logger.info("waitForPageToLoadCmd: " + elem.getAttributeValue("value")); + this.sel.waitForPageToLoad(elem.getAttributeValue("value")); + } + private void openCmd(Element elem) { + String cmd = replaceParam(elem.getAttributeValue("value")); + logger.info("openCmd: " + cmd); + this.sel.open(cmd); + //this.sel.windowMaximize(); + } + private void uniqueIdCmd(Element elem) { + String paramName = elem.getAttributeValue("out"); + String paramValue = RandomStringUtils.randomAlphanumeric(MAX_STR_LENGTH).toUpperCase(); + logger.info("uniqueIdCmd: parameter=" + paramName + " value=" + paramValue); + addParam(paramName, paramValue); + } + + /* + * captureText command captures the current HTML page and runs a regex to + * get the specified string. + * + * For example: if the following string existed in a web page + * + * "xx <tag a=b> yy </tag> zz" + * + * + * And you wanted to capture the value in the of the XML (yy). You would do the following; + * Use regxp: "<(\\S+?).*?>(.*?)</\\1>"; //The \\1 reuses group 1 + * + * <captureText regex="<(\\S+?).*?>(.*?)</\\1>" group="2" results="xmlValue" /> + * + * The command will find the <tag>.. and group 2 contains the 'yy' value. + * + * Note: if 'group' is null it will default to the entire regex group. + */ + private void captureTextInPageCmd(Element elem) { + + String regex = elem.getAttributeValue("regex"); + String group = elem.getAttributeValue("group"); + String results = elem.getAttributeValue("results"); + Pattern pattern = Pattern.compile(regex); + + String targetString = this.sel.getHtmlSource(); + + // Create the 'target' string we wish to interrogate. + // Get a Matcher based on the target string. + Matcher matcher = pattern.matcher(targetString); + + // Find all the matches. + if (matcher.find()) { + String resultsValue = null; + if(group != null) { + resultsValue = matcher.group(Integer.parseInt(group)); + } else { + resultsValue = matcher.group(); + } + logger.info("Found match for " + resultsValue); + logger.debug("Using regex " + regex); + logger.debug("Copy results to " + results); + addParam(results, resultsValue); + } else { + logger.info("Didn't find results with regex: " + regex); + + //TODO: temporary to capture the missed string + /*try { + FileWriter out = new FileWriter("c:/dev/erep/output/failure.txt"); + BufferedWriter buffWriter = new BufferedWriter(out); + buffWriter.write(targetString); + out.flush(); + out.close(); + } catch (IOException e) { + System.err.println(e); + } */ + } + } + + private void randomAlphaStringCmd(Element elem) { + int nSize = 0; + int nPrefixSize = 0; + String paramName = elem.getAttributeValue("out"); + String size = elem.getAttributeValue("size"); + if(size != null) { + nSize = Integer.parseInt(size); + } + String prefix = elem.getAttributeValue("prefix"); + if(prefix != null) { + nPrefixSize = prefix.length(); + } + + String paramValue = null; + if(prefix != null) { + paramValue = prefix + RandomStringUtils.randomAlphabetic(nSize - nPrefixSize); + } else { + paramValue = RandomStringUtils.randomAlphabetic(nSize); + } + //String paramValue = TestUtils.createRandomString(prefix, Integer.parseInt(size)); + logger.info("randomStringAlphaCmd: paramName=" + paramName + " paramValue=" + paramValue); + addParam(paramName, paramValue); + } + private void randomStringCmd(Element elem) { + String paramName = elem.getAttributeValue("out"); + String size = elem.getAttributeValue("size"); + String prefix = elem.getAttributeValue("prefix"); + String paramValue = TestUtils.createRandomString(prefix, Integer.parseInt(size)); + logger.info("randomStringCmd: paramName=" + paramName + " paramValue=" + paramValue); + addParam(paramName, paramValue); + } + private void getSelectedIdsCmd(Element elem) { + logger.info("getSelectdIdsCmd: " + elem.getAttributeValue("value")); + this.sel.getSelectedIds(elem.getAttributeValue("value")); + } + private void selectCmd(Element elem) { + String selectLocator = elem.getAttributeValue("locator"); + String optionLocator = elem.getAttributeValue("option"); + logger.info("selectCmd: selectLocator=" + selectLocator + " optionLocator=" + optionLocator); + this.sel.select(selectLocator, optionLocator); + } + private void printCmd(Element elem) { + String value = replaceParam(elem.getAttributeValue("value")); + logger.info("Print: " + value); + } + private void copyCmd(Element elem) { + String toStr = replaceParam(elem.getAttributeValue("to")); + String fromStr = replaceParam(elem.getAttributeValue("from")); + logger.info("copyCmd: to=" + toStr + " from=" + fromStr); + addParam(toStr, fromStr); + } + private void appendCmd(Element elem) { + logger.info("appendCmd: src1=" + elem.getAttributeValue("src1") + " src2=" + elem.getAttributeValue("src2")); + String newStr = replaceParam(elem.getAttributeValue("src1")) + replaceParam(elem.getAttributeValue("src2")); + addParam(elem.getAttributeValue("out"), newStr); + } + + public String replaceParam(String value) { + StringBuffer buf = new StringBuffer(); + int end = 0; + int start = 0; + String replacedVal = null; + String remainingStr = value; + while (isParam(remainingStr)) { + start = remainingStr.indexOf("${"); + buf.append(remainingStr.substring(end, start)); + end = remainingStr.indexOf("}"); + String paramName = remainingStr.substring(start + 2, end); + replacedVal = getParamValue(paramName); + if (replacedVal == null) { + replacedVal = ""; + } + buf.append(replacedVal); + remainingStr = remainingStr.substring(end + 1); + end = 0; + } + buf.append(remainingStr.substring(end)); + return buf.toString(); + } + + private boolean isParam(String value ) { + + if( (value.indexOf("${") != -1) && + (value.indexOf("}", 1) != -1) ) { + return true; + } + return false; + } + + //TODO read properties file to setup selenium + private void setupSelenium() { + + //return if Selenium has already been setup + //e.g. nested selenium test cases. + if(this.sel != null) return; + + String serverHost = null; + String serverPort = null; + String browser = null; + String startUrl = null; + + //First initialize with property values + if(props != null ) { //Get setup params from property value + + serverHost = props.getProperty("serverHost", "localhost"); + serverPort = props.getProperty("proxyPort", "4444"); + browser = props.getProperty("browser", "*firefox"); + startUrl = props.getProperty("startUrl", "http://localhost:8080"); + } + + //Second over ride properties if defined in the "setup" element + Element elem = this.doc.getRootElement().getChild("setup"); + if (elem != null) { + + //Override properties if specified + if( elem.getAttributeValue("serverHost") != null ) { + serverHost = elem.getAttributeValue("serverHost"); + } + if( elem.getAttributeValue("serverPort") != null ) { + serverPort = elem.getAttributeValue("serverPort"); + } + if( elem.getAttributeValue("browser") != null ) { + browser = elem.getAttributeValue("browser"); + } + if( elem.getAttributeValue("startUrl") != null ) { + startUrl = elem.getAttributeValue("startUrl"); + } + } + logger.info("setup: serverHost=" + serverHost); + logger.info("setup: serverPort=" + serverPort); + logger.info("setup: browser=" + browser); + logger.info("setup: startUrl=" + startUrl); + this.sel = new DefaultSelenium(serverHost, Integer.parseInt(serverPort), browser, startUrl); + this.sel.start(); + } + private void readFile(String fileName) throws JDOMException, IOException { + File xmlFile = new File(fileName); + SAXBuilder builder = new SAXBuilder(); + this.doc = builder.build(xmlFile); + } + + public String getUserName() { + return this.username; + } + + public String getPassword() { + return this.password; + } + + public Map <String, ? extends Object> getMap() { + return this.map; + } +} + Propchange: ofbiz/trunk/framework/testtools/src/org/ofbiz/testtools/seleniumxml/SeleniumXml.java ------------------------------------------------------------------------------ svn:eol-style = native Propchange: ofbiz/trunk/framework/testtools/src/org/ofbiz/testtools/seleniumxml/SeleniumXml.java ------------------------------------------------------------------------------ svn:keywords = "Date Rev Author URL Id" Propchange: ofbiz/trunk/framework/testtools/src/org/ofbiz/testtools/seleniumxml/SeleniumXml.java ------------------------------------------------------------------------------ svn:mime-type = text/plain Added: ofbiz/trunk/framework/testtools/src/org/ofbiz/testtools/seleniumxml/util/TestUtils.java URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/testtools/src/org/ofbiz/testtools/seleniumxml/util/TestUtils.java?rev=804074&view=auto ============================================================================== --- ofbiz/trunk/framework/testtools/src/org/ofbiz/testtools/seleniumxml/util/TestUtils.java (added) +++ ofbiz/trunk/framework/testtools/src/org/ofbiz/testtools/seleniumxml/util/TestUtils.java Fri Aug 14 04:22:27 2009 @@ -0,0 +1,96 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +package org.ofbiz.testtools.seleniumxml.util; + +import java.io.BufferedReader; +import java.io.IOException; +import java.io.InputStream; +import java.io.InputStreamReader; +import java.net.URL; +import java.util.Random; + +public class TestUtils { + + static char[] charMap = {'A', 'B', 'C','D','E','F','G','H','I','J','K','L','M','N','O','P', + 'Q','R','S','T','U','V','X','Y','Z', + 'a','b','c','d','e','f','g','h','i','j','k','l','m','n','o','p','q','r', + 's','t','u','v','w','x','y','z', + '0','1','2','3','4','5','6','7','8','9'}; + + static public String createUniqueString() { + long time = System.currentTimeMillis(); + + return String.valueOf(time); + } + + static public String createRandomString(int size) { + + return createRandomString(null, size); + } + + static public String createRandomString(String prefix, String size) { + return createRandomString(prefix, Integer.valueOf(size).intValue()); + } + + static public String createRandomString(String prefix, int size) { + StringBuffer buff = new StringBuffer(size); + int startIndx = 0; + + if(prefix != null) { + buff.append(prefix); + startIndx = prefix.length(); + } + + Random rad = new Random(); + for(int i=startIndx; i<size; i++ ) { + buff.append(charMap[rad.nextInt(charMap.length)]); + } + return buff.toString(); + } + + public static String readUrlText(String urlString) throws IOException { + URL url = new URL(urlString); + InputStream stream = url.openStream(); + + StringBuilder buf = new StringBuilder(); + BufferedReader in = null; + try { + in = new BufferedReader(new InputStreamReader(stream)); + + String str; + while ((str = in.readLine()) != null) { + buf.append(str); + buf.append(System.getProperty("line.separator")); + } + } catch (IOException e) { + System.out.println("Error reading text from URL [" + url + "]: " + e.toString()); + throw e; + } finally { + if (in != null) { + try { + in.close(); + } catch (IOException e) { + System.out.println("Error closing after reading text from URL [" + url + "]: " + e.toString()); + } + } + } + + return buf.toString(); + } +} Propchange: ofbiz/trunk/framework/testtools/src/org/ofbiz/testtools/seleniumxml/util/TestUtils.java ------------------------------------------------------------------------------ svn:eol-style = native Propchange: ofbiz/trunk/framework/testtools/src/org/ofbiz/testtools/seleniumxml/util/TestUtils.java ------------------------------------------------------------------------------ svn:keywords = "Date Rev Author URL Id" Propchange: ofbiz/trunk/framework/testtools/src/org/ofbiz/testtools/seleniumxml/util/TestUtils.java ------------------------------------------------------------------------------ svn:mime-type = text/plain Added: ofbiz/trunk/framework/testtools/testdef/seleniumxml/example/example_ajax.xml URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/testtools/testdef/seleniumxml/example/example_ajax.xml?rev=804074&view=auto ============================================================================== --- ofbiz/trunk/framework/testtools/testdef/seleniumxml/example/example_ajax.xml (added) +++ ofbiz/trunk/framework/testtools/testdef/seleniumxml/example/example_ajax.xml Fri Aug 14 04:22:27 2009 @@ -0,0 +1,35 @@ +<testcase> + <open value="/example/control/updateExampleFeature" /> + <click locator="link=Logout" /> + <waitForPageToLoad value="10000" /> + <type name="PASSWORD" value="ofbiz" /> + <click locator="//input[@value='Login']" /> + <waitForPageToLoad value="10000" /> + <click locator="link=Ajax Examples" /> + <waitForPageToLoad value="10000" /> + <type name="exampleName" value="AJAX example name" /> + <type name="description" value="AJAX description" /> + <type name="longDescription" value="This is a long description" /> + <type name="comments" value="this is a comment" /> + <type name="exampleSize" value="10" /> + <click locator="//img[@alt='View Calendar']" /> + <click locator="//tr[5]/td[2]/div" /> + <click locator="link=OK" /> + <click locator="//div[@id='_G266__body']/table/tbody/tr[9]/td[2]/a/img" /> + <click locator="link=Now" /> + <click locator="link=OK" /> + <select locator="anotherText" option="label=Explicit Option" /> + <click locator="submitButton" /> + <click locator="link=10000" /> + <waitForPageToLoad value="10000" /> + <type name="longDescription" value="This is a long description - this is a big update" /> + <click locator="submitButton" /> + <waitForPageToLoad value="10000" /> + <click locator="link=Ajax Examples" /> + <waitForPageToLoad value="10000" /> + <click locator="link=10000" /> + <waitForPageToLoad value="10000" /> + <click locator="link=Printer Friendly" /> + <waitForPageToLoad value="10000" /> + <brett_cmd param1="1" param2="1" /> +</testcase> Propchange: ofbiz/trunk/framework/testtools/testdef/seleniumxml/example/example_ajax.xml ------------------------------------------------------------------------------ svn:keywords = "Date Rev Author URL Id" Propchange: ofbiz/trunk/framework/testtools/testdef/seleniumxml/example/example_ajax.xml ------------------------------------------------------------------------------ svn:mime-type = text/xml Added: ofbiz/trunk/framework/testtools/testdef/seleniumxml/example/example_login.xml URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/testtools/testdef/seleniumxml/example/example_login.xml?rev=804074&view=auto ============================================================================== --- ofbiz/trunk/framework/testtools/testdef/seleniumxml/example/example_login.xml (added) +++ ofbiz/trunk/framework/testtools/testdef/seleniumxml/example/example_login.xml Fri Aug 14 04:22:27 2009 @@ -0,0 +1,13 @@ +<?xml version="1.0"?> +<testcase> + <open value="/example/control/logout" /> + <waitForPageToLoad value="10000" /> + <type name="USERNAME" value="admin" /> + <type name="PASSWORD" value="ofbiz" /> + <click locator="//input[@value='Login']" /> + <waitForPageToLoad value="10000" /> + <getBodyText out="bodyText"/> + <getHtmlSource out="htmlSource"/> + <assertContains src="${htmlSource}" test="Welcome" /> +</testcase> + Propchange: ofbiz/trunk/framework/testtools/testdef/seleniumxml/example/example_login.xml ------------------------------------------------------------------------------ svn:eol-style = native Propchange: ofbiz/trunk/framework/testtools/testdef/seleniumxml/example/example_login.xml ------------------------------------------------------------------------------ svn:keywords = "Date Rev Author URL Id" Propchange: ofbiz/trunk/framework/testtools/testdef/seleniumxml/example/example_login.xml ------------------------------------------------------------------------------ svn:mime-type = text/xml Added: ofbiz/trunk/framework/testtools/testdef/seleniumxml/example/example_new.xml URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/testtools/testdef/seleniumxml/example/example_new.xml?rev=804074&view=auto ============================================================================== --- ofbiz/trunk/framework/testtools/testdef/seleniumxml/example/example_new.xml (added) +++ ofbiz/trunk/framework/testtools/testdef/seleniumxml/example/example_new.xml Fri Aug 14 04:22:27 2009 @@ -0,0 +1,30 @@ +<testcase> + <randomString size="20" out="exampleName" /> + <randomString size="250" out="description" /> + <randomString size="500" out="longDesc" /> + <randomString size="250" out="comments" /> + + <click locator="link=New Example" /> + <waitForPageToLoad value="10000" /> + <select locator="statusId" option="label=Defined" /> + <type name="exampleName" value="${exampleName}" /> + <type name="description" value="${description}" /> + <type name="longDescription" value="${longDesc}" /> + <type name="comments" value="${comments}" /> + <type name="exampleSize" value="10" /> + <click locator="//img[@alt='View Calendar']" /> + <click locator="link=Now" /> + <click locator="link=OK" /> + <select locator="anotherText" option="label=Good" /> + <click locator="submitButton" /> + <waitForPageToLoad value="10000" /> + <click locator="link=Items" /> + <waitForPageToLoad value="10000" /> + <type name="description" value="Item 1" /> + <type name="amount" value="100" /> + <select locator="amountUomId" option="label=Weight: Stone (st)" /> + <click locator="submitButton" /> + <waitForPageToLoad value="10000" /> + <!-- click locator="link=New Example" /> + <waitForPageToLoad value="10000" / --> +</testcase> \ No newline at end of file Propchange: ofbiz/trunk/framework/testtools/testdef/seleniumxml/example/example_new.xml ------------------------------------------------------------------------------ svn:eol-style = native Propchange: ofbiz/trunk/framework/testtools/testdef/seleniumxml/example/example_new.xml ------------------------------------------------------------------------------ svn:keywords = "Date Rev Author URL Id" Propchange: ofbiz/trunk/framework/testtools/testdef/seleniumxml/example/example_new.xml ------------------------------------------------------------------------------ svn:mime-type = text/xml Added: ofbiz/trunk/framework/testtools/testdef/seleniumxml/example/example_search.xml URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/testtools/testdef/seleniumxml/example/example_search.xml?rev=804074&view=auto ============================================================================== --- ofbiz/trunk/framework/testtools/testdef/seleniumxml/example/example_search.xml (added) +++ ofbiz/trunk/framework/testtools/testdef/seleniumxml/example/example_search.xml Fri Aug 14 04:22:27 2009 @@ -0,0 +1,10 @@ +<testcase> + <click locator="link=Example" /> + <waitForPageToLoad value="10000" /> + <click locator="searchButton" /> + <waitForPageToLoad value="10000" /> + <click locator="link=Last" /> + <waitForPageToLoad value="10000" /> + <getHtmlSource out="searchResults"/> + <assertContains src="${searchResults}" test="${exampleName}" /> +</testcase> \ No newline at end of file Propchange: ofbiz/trunk/framework/testtools/testdef/seleniumxml/example/example_search.xml ------------------------------------------------------------------------------ svn:eol-style = native Propchange: ofbiz/trunk/framework/testtools/testdef/seleniumxml/example/example_search.xml ------------------------------------------------------------------------------ svn:keywords = "Date Rev Author URL Id" Propchange: ofbiz/trunk/framework/testtools/testdef/seleniumxml/example/example_search.xml ------------------------------------------------------------------------------ svn:mime-type = text/xml Added: ofbiz/trunk/framework/testtools/testdef/seleniumxml/example/example_testsuite.xml URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/testtools/testdef/seleniumxml/example/example_testsuite.xml?rev=804074&view=auto ============================================================================== --- ofbiz/trunk/framework/testtools/testdef/seleniumxml/example/example_testsuite.xml (added) +++ ofbiz/trunk/framework/testtools/testdef/seleniumxml/example/example_testsuite.xml Fri Aug 14 04:22:27 2009 @@ -0,0 +1,8 @@ +<?xml version="1.0"?> +<testcase> + <setSpeed value="500" /> + <testcase file="testdef/seleniumxml/example/example_login.xml"/> + <testcase file="testdef/seleniumxml/example/example_new.xml"/> + <testcase file="testdef/seleniumxml/example/example_search.xml"/> +</testcase> + Propchange: ofbiz/trunk/framework/testtools/testdef/seleniumxml/example/example_testsuite.xml ------------------------------------------------------------------------------ svn:eol-style = native Propchange: ofbiz/trunk/framework/testtools/testdef/seleniumxml/example/example_testsuite.xml ------------------------------------------------------------------------------ svn:keywords = "Date Rev Author URL Id" Propchange: ofbiz/trunk/framework/testtools/testdef/seleniumxml/example/example_testsuite.xml ------------------------------------------------------------------------------ svn:mime-type = text/xml Added: ofbiz/trunk/framework/testtools/testdef/seleniumxml/example/recorded/AjaxExample.html URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/testtools/testdef/seleniumxml/example/recorded/AjaxExample.html?rev=804074&view=auto ============================================================================== --- ofbiz/trunk/framework/testtools/testdef/seleniumxml/example/recorded/AjaxExample.html (added) +++ ofbiz/trunk/framework/testtools/testdef/seleniumxml/example/recorded/AjaxExample.html Fri Aug 14 04:22:27 2009 @@ -0,0 +1,137 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> +<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en"> +<head profile="http://selenium-ide.openqa.org/profiles/test-case"> +<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /> +<link rel="selenium.base" href="" /> +<title>AjaxExample</title> +</head> +<body> +<table cellpadding="1" cellspacing="1" border="1"> +<thead> +<tr><td rowspan="1" colspan="3">AjaxExample</td></tr> +</thead><tbody> +<tr> + <td>open</td> + <td>/example/control/updateExampleFeature</td> + <td></td> +</tr> +<tr> + <td>clickAndWait</td> + <td>link=Logout</td> + <td></td> +</tr> +<tr> + <td>type</td> + <td>PASSWORD</td> + <td>ofbiz</td> +</tr> +<tr> + <td>clickAndWait</td> + <td>//input[@value='Login']</td> + <td></td> +</tr> +<tr> + <td>clickAndWait</td> + <td>link=Ajax Examples</td> + <td></td> +</tr> +<tr> + <td>type</td> + <td>exampleName</td> + <td>AJAX example name</td> +</tr> +<tr> + <td>type</td> + <td>description</td> + <td>AJAX description</td> +</tr> +<tr> + <td>type</td> + <td>longDescription</td> + <td>This is a long description</td> +</tr> +<tr> + <td>type</td> + <td>comments</td> + <td>this is a comment</td> +</tr> +<tr> + <td>type</td> + <td>exampleSize</td> + <td>10</td> +</tr> +<tr> + <td>click</td> + <td>//img[@alt='View Calendar']</td> + <td></td> +</tr> +<tr> + <td>click</td> + <td>//tr[5]/td[2]/div</td> + <td></td> +</tr> +<tr> + <td>click</td> + <td>link=OK</td> + <td></td> +</tr> +<tr> + <td>click</td> + <td>//div[@id='_G266__body']/table/tbody/tr[9]/td[2]/a/img</td> + <td></td> +</tr> +<tr> + <td>click</td> + <td>link=Now</td> + <td></td> +</tr> +<tr> + <td>click</td> + <td>link=OK</td> + <td></td> +</tr> +<tr> + <td>select</td> + <td>anotherText</td> + <td>label=Explicit Option</td> +</tr> +<tr> + <td>click</td> + <td>submitButton</td> + <td></td> +</tr> +<tr> + <td>clickAndWait</td> + <td>link=10000</td> + <td></td> +</tr> +<tr> + <td>type</td> + <td>longDescription</td> + <td>This is a long description - this is a big update</td> +</tr> +<tr> + <td>clickAndWait</td> + <td>submitButton</td> + <td></td> +</tr> +<tr> + <td>clickAndWait</td> + <td>link=Ajax Examples</td> + <td></td> +</tr> +<tr> + <td>clickAndWait</td> + <td>link=10000</td> + <td></td> +</tr> +<tr> + <td>clickAndWait</td> + <td>link=Printer Friendly</td> + <td></td> +</tr> + +</tbody></table> +</body> +</html> Propchange: ofbiz/trunk/framework/testtools/testdef/seleniumxml/example/recorded/AjaxExample.html ------------------------------------------------------------------------------ svn:eol-style = native Propchange: ofbiz/trunk/framework/testtools/testdef/seleniumxml/example/recorded/AjaxExample.html ------------------------------------------------------------------------------ svn:keywords = "Date Rev Author URL Id" Propchange: ofbiz/trunk/framework/testtools/testdef/seleniumxml/example/recorded/AjaxExample.html ------------------------------------------------------------------------------ svn:mime-type = text/html Added: ofbiz/trunk/framework/testtools/testdef/seleniumxml/example/recorded/AjaxExample.xml URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/testtools/testdef/seleniumxml/example/recorded/AjaxExample.xml?rev=804074&view=auto ============================================================================== --- ofbiz/trunk/framework/testtools/testdef/seleniumxml/example/recorded/AjaxExample.xml (added) +++ ofbiz/trunk/framework/testtools/testdef/seleniumxml/example/recorded/AjaxExample.xml Fri Aug 14 04:22:27 2009 @@ -0,0 +1,35 @@ +<testcase> + <open value="/example/control/updateExampleFeature" /> + <click locator="link=Logout" /> + <waitForPageToLoad value="10000" /> + <type name="PASSWORD" value="ofbiz" /> + <click locator="//input[@value='Login']" /> + <waitForPageToLoad value="10000" /> + <click locator="link=Ajax Examples" /> + <waitForPageToLoad value="10000" /> + <type name="exampleName" value="AJAX example name" /> + <type name="description" value="AJAX description" /> + <type name="longDescription" value="This is a long description" /> + <type name="comments" value="this is a comment" /> + <type name="exampleSize" value="10" /> + <click locator="//img[@alt='View Calendar']" /> + <click locator="//tr[5]/td[2]/div" /> + <click locator="link=OK" /> + <click locator="//div[@id='_G266__body']/table/tbody/tr[9]/td[2]/a/img" /> + <click locator="link=Now" /> + <click locator="link=OK" /> + <select locator="anotherText" option="label=Explicit Option" /> + <click locator="submitButton" /> + <click locator="link=10000" /> + <waitForPageToLoad value="10000" /> + <type name="longDescription" value="This is a long description - this is a big update" /> + <click locator="submitButton" /> + <waitForPageToLoad value="10000" /> + <click locator="link=Ajax Examples" /> + <waitForPageToLoad value="10000" /> + <click locator="link=10000" /> + <waitForPageToLoad value="10000" /> + <click locator="link=Printer Friendly" /> + <waitForPageToLoad value="10000" /> + <brett_cmd param1="1" param2="1" /> +</testcase> Propchange: ofbiz/trunk/framework/testtools/testdef/seleniumxml/example/recorded/AjaxExample.xml ------------------------------------------------------------------------------ svn:keywords = "Date Rev Author URL Id" Propchange: ofbiz/trunk/framework/testtools/testdef/seleniumxml/example/recorded/AjaxExample.xml ------------------------------------------------------------------------------ svn:mime-type = text/xml Added: ofbiz/trunk/framework/testtools/testdef/seleniumxml/example/recorded/NewExample.html URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/testtools/testdef/seleniumxml/example/recorded/NewExample.html?rev=804074&view=auto ============================================================================== --- ofbiz/trunk/framework/testtools/testdef/seleniumxml/example/recorded/NewExample.html (added) +++ ofbiz/trunk/framework/testtools/testdef/seleniumxml/example/recorded/NewExample.html Fri Aug 14 04:22:27 2009 @@ -0,0 +1,147 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> +<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en"> +<head profile="http://selenium-ide.openqa.org/profiles/test-case"> +<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /> +<link rel="selenium.base" href="" /> +<title>NewExample</title> +</head> +<body> +<table cellpadding="1" cellspacing="1" border="1"> +<thead> +<tr><td rowspan="1" colspan="3">NewExample</td></tr> +</thead><tbody> +<tr> + <td>open</td> + <td>/example/control/FindExample?portalPageId=Example</td> + <td></td> +</tr> +<tr> + <td>clickAndWait</td> + <td>link=Logout</td> + <td></td> +</tr> +<tr> + <td>type</td> + <td>PASSWORD</td> + <td>ofbiz</td> +</tr> +<tr> + <td>clickAndWait</td> + <td>//input[@value='Login']</td> + <td></td> +</tr> +<tr> + <td>clickAndWait</td> + <td>link=New Example</td> + <td></td> +</tr> +<tr> + <td>select</td> + <td>statusId</td> + <td>label=Defined</td> +</tr> +<tr> + <td>type</td> + <td>exampleName</td> + <td>New Example 1</td> +</tr> +<tr> + <td>type</td> + <td>description</td> + <td>This is a description</td> +</tr> +<tr> + <td>type</td> + <td>longDescription</td> + <td>Long description goes here</td> +</tr> +<tr> + <td>type</td> + <td>comments</td> + <td>comments go here</td> +</tr> +<tr> + <td>type</td> + <td>exampleSize</td> + <td>10</td> +</tr> +<tr> + <td>click</td> + <td>//img[@alt='View Calendar']</td> + <td></td> +</tr> +<tr> + <td>click</td> + <td>//tr[2]/td[5]/div</td> + <td></td> +</tr> +<tr> + <td>click</td> + <td>//tr[2]/td[5]/div</td> + <td></td> +</tr> +<tr> + <td>click</td> + <td>//div[@id='_G152__body']/table/tbody/tr[9]/td[2]/a/img</td> + <td></td> +</tr> +<tr> + <td>click</td> + <td>//tr[3]/td[2]/div</td> + <td></td> +</tr> +<tr> + <td>click</td> + <td>//tr[3]/td[2]/div</td> + <td></td> +</tr> +<tr> + <td>click</td> + <td>link=OK</td> + <td></td> +</tr> +<tr> + <td>select</td> + <td>anotherText</td> + <td>label=Good</td> +</tr> +<tr> + <td>clickAndWait</td> + <td>submitButton</td> + <td></td> +</tr> +<tr> + <td>clickAndWait</td> + <td>link=Items</td> + <td></td> +</tr> +<tr> + <td>type</td> + <td>description</td> + <td>Item 1</td> +</tr> +<tr> + <td>type</td> + <td>amount</td> + <td>100</td> +</tr> +<tr> + <td>select</td> + <td>amountUomId</td> + <td>label=Weight: Stone (st)</td> +</tr> +<tr> + <td>clickAndWait</td> + <td>submitButton</td> + <td></td> +</tr> +<tr> + <td>clickAndWait</td> + <td>link=New Example</td> + <td></td> +</tr> + +</tbody></table> +</body> +</html> Propchange: ofbiz/trunk/framework/testtools/testdef/seleniumxml/example/recorded/NewExample.html ------------------------------------------------------------------------------ svn:eol-style = native Propchange: ofbiz/trunk/framework/testtools/testdef/seleniumxml/example/recorded/NewExample.html ------------------------------------------------------------------------------ svn:keywords = "Date Rev Author URL Id" Propchange: ofbiz/trunk/framework/testtools/testdef/seleniumxml/example/recorded/NewExample.html ------------------------------------------------------------------------------ svn:mime-type = text/html Added: ofbiz/trunk/framework/testtools/testdef/seleniumxml/example/recorded/NewExample.xml URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/testtools/testdef/seleniumxml/example/recorded/NewExample.xml?rev=804074&view=auto ============================================================================== --- ofbiz/trunk/framework/testtools/testdef/seleniumxml/example/recorded/NewExample.xml (added) +++ ofbiz/trunk/framework/testtools/testdef/seleniumxml/example/recorded/NewExample.xml Fri Aug 14 04:22:27 2009 @@ -0,0 +1,35 @@ +<testcase> + <open value="/example/control/FindExample?portalPageId=Example" /> + <click locator="link=Logout" /> + <waitForPageToLoad value="10000" /> + <type name="PASSWORD" value="ofbiz" /> + <click locator="//input[@value='Login']" /> + <waitForPageToLoad value="10000" /> + <click locator="link=New Example" /> + <waitForPageToLoad value="10000" /> + <select locator="statusId" option="label=Defined" /> + <type name="exampleName" value="New Example 1" /> + <type name="description" value="This is a description" /> + <type name="longDescription" value="Long description goes here" /> + <type name="comments" value="comments go here" /> + <type name="exampleSize" value="10" /> + <click locator="//img[@alt='View Calendar']" /> + <click locator="//tr[2]/td[5]/div" /> + <click locator="//tr[2]/td[5]/div" /> + <click locator="//div[@id='_G152__body']/table/tbody/tr[9]/td[2]/a/img" /> + <click locator="//tr[3]/td[2]/div" /> + <click locator="//tr[3]/td[2]/div" /> + <click locator="link=OK" /> + <select locator="anotherText" option="label=Good" /> + <click locator="submitButton" /> + <waitForPageToLoad value="10000" /> + <click locator="link=Items" /> + <waitForPageToLoad value="10000" /> + <type name="description" value="Item 1" /> + <type name="amount" value="100" /> + <select locator="amountUomId" option="label=Weight: Stone (st)" /> + <click locator="submitButton" /> + <waitForPageToLoad value="10000" /> + <click locator="link=New Example" /> + <waitForPageToLoad value="10000" /> +</testcase> Propchange: ofbiz/trunk/framework/testtools/testdef/seleniumxml/example/recorded/NewExample.xml ------------------------------------------------------------------------------ svn:keywords = "Date Rev Author URL Id" Propchange: ofbiz/trunk/framework/testtools/testdef/seleniumxml/example/recorded/NewExample.xml ------------------------------------------------------------------------------ svn:mime-type = text/xml Added: ofbiz/trunk/framework/testtools/testdef/seleniumxml/example/recorded/NewFeature.html URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/testtools/testdef/seleniumxml/example/recorded/NewFeature.html?rev=804074&view=auto ============================================================================== --- ofbiz/trunk/framework/testtools/testdef/seleniumxml/example/recorded/NewFeature.html (added) +++ ofbiz/trunk/framework/testtools/testdef/seleniumxml/example/recorded/NewFeature.html Fri Aug 14 04:22:27 2009 @@ -0,0 +1,102 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> +<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en"> +<head profile="http://selenium-ide.openqa.org/profiles/test-case"> +<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /> +<link rel="selenium.base" href="" /> +<title>NewFeature</title> +</head> +<body> +<table cellpadding="1" cellspacing="1" border="1"> +<thead> +<tr><td rowspan="1" colspan="3">NewFeature</td></tr> +</thead><tbody> +<tr> + <td>open</td> + <td>/example/control/EditExample</td> + <td></td> +</tr> +<tr> + <td>clickAndWait</td> + <td>link=Logout</td> + <td></td> +</tr> +<tr> + <td>type</td> + <td>PASSWORD</td> + <td>ofbiz</td> +</tr> +<tr> + <td>clickAndWait</td> + <td>//input[@value='Login']</td> + <td></td> +</tr> +<tr> + <td>clickAndWait</td> + <td>link=Feature</td> + <td></td> +</tr> +<tr> + <td>clickAndWait</td> + <td>searchButton</td> + <td></td> +</tr> +<tr> + <td>clickAndWait</td> + <td>link=New Example Feature</td> + <td></td> +</tr> +<tr> + <td>type</td> + <td>description</td> + <td>New Feature 1000</td> +</tr> +<tr> + <td>clickAndWait</td> + <td>submitButton</td> + <td></td> +</tr> +<tr> + <td>clickAndWait</td> + <td>link=Examples</td> + <td></td> +</tr> +<tr> + <td>clickAndWait</td> + <td>//a[contains(@href, '/example/control/EditExampleFeature?exampleFeatureId=10000')]</td> + <td></td> +</tr> +<tr> + <td>clickAndWait</td> + <td>link=Feature</td> + <td></td> +</tr> +<tr> + <td>type</td> + <td>description</td> + <td>New Feature</td> +</tr> +<tr> + <td>clickAndWait</td> + <td>searchButton</td> + <td></td> +</tr> +<tr> + <td>clickAndWait</td> + <td>link=10000</td> + <td></td> +</tr> +<tr> + <td>type</td> + <td>description</td> + <td>New Feature 1000 - updated</td> +</tr> +<tr> + <td>clickAndWait</td> + <td>submitButton</td> + <td></td> +</tr> + +</tbody></table> +</body> +</html> Propchange: ofbiz/trunk/framework/testtools/testdef/seleniumxml/example/recorded/NewFeature.html ------------------------------------------------------------------------------ svn:eol-style = native Propchange: ofbiz/trunk/framework/testtools/testdef/seleniumxml/example/recorded/NewFeature.html ------------------------------------------------------------------------------ svn:keywords = "Date Rev Author URL Id" Propchange: ofbiz/trunk/framework/testtools/testdef/seleniumxml/example/recorded/NewFeature.html ------------------------------------------------------------------------------ svn:mime-type = text/html Added: ofbiz/trunk/framework/testtools/testdef/seleniumxml/example/recorded/NewFeature.xml URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/testtools/testdef/seleniumxml/example/recorded/NewFeature.xml?rev=804074&view=auto ============================================================================== --- ofbiz/trunk/framework/testtools/testdef/seleniumxml/example/recorded/NewFeature.xml (added) +++ ofbiz/trunk/framework/testtools/testdef/seleniumxml/example/recorded/NewFeature.xml Fri Aug 14 04:22:27 2009 @@ -0,0 +1,31 @@ +<testcase> + <open value="/example/control/EditExample" /> + <click locator="link=Logout" /> + <waitForPageToLoad value="10000" /> + <type name="PASSWORD" value="ofbiz" /> + <click locator="//input[@value='Login']" /> + <waitForPageToLoad value="10000" /> + <click locator="link=Feature" /> + <waitForPageToLoad value="10000" /> + <click locator="searchButton" /> + <waitForPageToLoad value="10000" /> + <click locator="link=New Example Feature" /> + <waitForPageToLoad value="10000" /> + <type name="description" value="New Feature 1000" /> + <click locator="submitButton" /> + <waitForPageToLoad value="10000" /> + <click locator="link=Examples" /> + <waitForPageToLoad value="10000" /> + <click locator="//a[contains(@href, '/example/control/EditExampleFeature?exampleFeatureId=10000')]" /> + <waitForPageToLoad value="10000" /> + <click locator="link=Feature" /> + <waitForPageToLoad value="10000" /> + <type name="description" value="New Feature" /> + <click locator="searchButton" /> + <waitForPageToLoad value="10000" /> + <click locator="link=10000" /> + <waitForPageToLoad value="10000" /> + <type name="description" value="New Feature 1000 - updated" /> + <click locator="submitButton" /> + <waitForPageToLoad value="10000" /> +</testcase> Propchange: ofbiz/trunk/framework/testtools/testdef/seleniumxml/example/recorded/NewFeature.xml ------------------------------------------------------------------------------ svn:keywords = "Date Rev Author URL Id" Propchange: ofbiz/trunk/framework/testtools/testdef/seleniumxml/example/recorded/NewFeature.xml ------------------------------------------------------------------------------ svn:mime-type = text/xml Modified: ofbiz/trunk/framework/webapp/config/url.properties URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/webapp/config/url.properties?rev=804074&r1=804073&r2=804074&view=diff ============================================================================== --- ofbiz/trunk/framework/webapp/config/url.properties (original) +++ ofbiz/trunk/framework/webapp/config/url.properties Fri Aug 14 04:22:27 2009 @@ -21,7 +21,7 @@ #### # HTTPS Port (Secure port) -port.https.enabled=Y +port.https.enabled=N port.https=8443 force.https.host= |
Free forum by Nabble | Edit this page |