diff --git a/.gitignore b/.gitignore index ac21e11..602548f 100644 --- a/.gitignore +++ b/.gitignore @@ -3,3 +3,5 @@ .settings/ settings.xml Selenium-RC/" +testbox +tests/results diff --git a/BaseSpec.cfc b/BaseSpec.cfc new file mode 100755 index 0000000..55e0b9e --- /dev/null +++ b/BaseSpec.cfc @@ -0,0 +1,28 @@ +/** +* Base Selenium based testing +* Please make sure you call the `beforeAll()` method with the appropriate `browserURL` and `browser` arguments +* The `beforeAll()` method will place an instance of the CFSelenium CFC in the `variables` scope as `selenium` +*/ +component extends="testbox.system.BaseSpec"{ + +/*********************************** LIFE CYCLE Methods ***********************************/ + + /** + * Please note the two arguments to get a selenium server started + * @browserURL The base URL of the application to test. + * @browser The browser to run the tests, defaults to *firefox + */ + function beforeAll( required browserURL, browser="*firefox" ){ + // create Selenium class + variables.selenium = new cfselenium.Selenium(); + // Start it up. + variables.selenium.start( arguments.browserURL, arguments.browser ); + } + + // executes after all suites+specs in the run() method + function afterAll(){ + variables.selenium.stop(); + variables.selenium.stopServer() + } + +} \ No newline at end of file diff --git a/CFSeleniumTestCase.cfc b/CFSeleniumTestCase.cfc deleted file mode 100755 index e654283..0000000 --- a/CFSeleniumTestCase.cfc +++ /dev/null @@ -1,19 +0,0 @@ - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/CFSeleniumTestCase_Tags.cfc b/CFSeleniumTestCase_Tags.cfc deleted file mode 100644 index 1264112..0000000 --- a/CFSeleniumTestCase_Tags.cfc +++ /dev/null @@ -1,20 +0,0 @@ - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/Selenium-RC/selenium-server-standalone-2.42.2.jar b/Selenium-RC/selenium-server-standalone-2.46.0.jar similarity index 77% rename from Selenium-RC/selenium-server-standalone-2.42.2.jar rename to Selenium-RC/selenium-server-standalone-2.46.0.jar index 31b582d..f470326 100644 Binary files a/Selenium-RC/selenium-server-standalone-2.42.2.jar and b/Selenium-RC/selenium-server-standalone-2.46.0.jar differ diff --git a/box.json b/box.json new file mode 100644 index 0000000..aefcaaf --- /dev/null +++ b/box.json @@ -0,0 +1,84 @@ +{ + "name":"CFSelenium", + "version":"2.0.0", + "author":"Ortus Solutions, Corp", + "homepage":"https://github.com/Ortus-Solutions/CFSelenium", + "documentation":"https://github.com/Ortus-Solutions/CFSelenium/wiki", + "repository":{ + "type":"git", + "url":"https://github.com/Ortus-Solutions/CFSelenium.git" + }, + "bugs":"https://github.com/Ortus-Solutions/CFSelenium/issues", + "slug":"cfselenium", + "shortDescription":"CFSelenium provides a native client library for Selenium-RC", + "description":"CFSelenium is a ColdFusion Component (CFC) which provides a native client library for Selenium-RC. This allows you to write tests, using CFML, which will drive a browser and verify results via Selenium-RC.", + "type":"projects", + "keywords":[ + "cfselenium", + "testing", + "selenium" + ], + "engines":[ + { + "type":"lucee", + "version":">=4.5.x" + }, + { + "type":"adobe", + "version":">=10" + } + ], + "projectURL":"https://github.com/Ortus-Solutions/CFSelenium", + "license":[ + { + "type":"Apache2", + "url":"http://www.apache.org/licenses/LICENSE-2.0" + } + ], + "contributors":[ + + ], + "dependencies":{ + + }, + "devDependencies":{ + "testbox":"2.0.0" + }, + "installPaths":{ + "testbox":"testbox" + }, + "ignore":[ + "**/.*", + "test", + "tests" + ], + "testbox":{ + "runner":[ + { + "default":"" + } + ], + "labels":[ + + ], + "reporter":"", + "reporterResults":"", + "bundles":[ + "" + ], + "directory":{ + "mapping":"", + "recurse":true + }, + "watchers":[ + + ], + "notify":{ + "emails":[ + + ], + "growl":"", + "url":"" + } + } +} \ No newline at end of file diff --git a/readme.html b/readme.html new file mode 100644 index 0000000..6e11e99 --- /dev/null +++ b/readme.html @@ -0,0 +1,1080 @@ +readme

CFSelenium - A Native CFML (ColdFusion) Client Library for Selenium-RC

+
+

This project was forked from Bob Silverberg’s project: http://github.com/bobsilverberg/CFSelenium

+
+

What is CFSelenium?

+

CFSelenium is a ColdFusion Component (CFC) which provides a native client library for Selenium-RC. This allows you to write tests, using CFML, which will drive a browser and verify results via Selenium-RC.

+

Requirements

+
    +
  1. ColdFusion 9+ or Lucee 4.5+
  2. +
  3. The Selenium-RC Server jar, the latest version of which is included in the distribution
  4. +
+

Installation

+

CFSelenium can be installed via CommandBox by typing:

+
box install cfselenium
+
+ +

Note: Optionally if you would like to integreate with TestBox you will have to create a mapping to the cfselenium installed folder as /cfselenium.

+

Usage

+

Optionally, start the Selenium-RC server. Selenium.cfc will automatically start the Selenium-RC server for you in the background if it isn’t already started. To start it manually, the command is similar to this:

+
java -jar selenium-server-standalone-2.46.0.jar
+
+ +

Create an instance of selenium.cfc.

+
selenium = new Selenium();
+
+ +

You can also pass the host and port into the constructor, which default to localhost and 4444:

+
selenium = new selenium("localhost", 4444);
+
+

To start up a browser, call selenium.start() passing in the starting url and, optionally, a browser command telling it which browser to start (the default is *firefox):

+
selenium.start("http://github.com/");
+
+

To start a different browser (e.g., Google Chrome), pass in the browser command too:

+
selenium.start("http://github.com/","*googlechrome");
+
+

Call methods on the selenium object to drive the browser and check values. For example:

+
selenium.open("/bobsilverberg/CFSelenium");
+assertEquals("bobsilverberg/CFSelenium - GitHub", selenium.getTitle());
+selenium.click("link=readme.md");
+selenium.waitForPageToLoad("30000");
+assertEquals("readme.md at master from bobsilverberg's CFSelenium - GitHub", selenium.getTitle());
+selenium.click("raw-url");
+selenium.waitForPageToLoad("30000");
+assertEquals("", selenium.getTitle());
+assertTrue(selenium.isTextPresent("[CFSelenium]"));
+
+

You can shut down the browser using the stop() method:

+
selenium.stop();
+
+

A Base Test Case for MXUnit

+

Also included in the distribution is a base test case for MXUnit, called CFSeleniumTestCase.cfc. This is designed to instantiate the selenium.cfc for you and start up a browser session once, before all of your tests run, and shut down the browser after all the tests have completed. To use this base test case, simply extend it in your own test case:

+
component extends="CFSelenium.CFSeleniumTestCase"
+
+

You will then want to place a beforeTests() method in your test case which sets the browserUrl and the calls the base test case’s beforeTests() method:

+
public void function beforeTests(){
+    browserURL = "http://github.com/";
+    super.beforeTests();
+}
+
+

A Selenium-IDE Formatter Too

+

Also included in the distribution is a Firefox extension which will add a formatter to Selenium-IDE which will allow you to export tests in CFSelenium / MXUnit format. The plugin can be found in the formats folder.

+

Support

+

The script-based version of CFSelenium is maintained by Bob Silverberg and the tag-based version is maintained by Brian Swartzfager. Thanks also to Marc Esher for the logic which starts and stops the Selenium-RC server automatically.

+

Please use the main repo’s issue tracker to report bugs and request enhancements.

\ No newline at end of file diff --git a/readme.md b/readme.md index 10d0496..4b64de2 100644 --- a/readme.md +++ b/readme.md @@ -1,72 +1,157 @@ -[CFSelenium](http://github.com/bobsilverberg/CFSelenium) - A Native CFML (ColdFusion) Client Library for Selenium-RC -============================================================================================================= +# CFSelenium - A Native CFML (ColdFusion) Client Library for Selenium-RC -### What is CFSelenium? ### +> This project was forked from Bob Silverberg's project: http://github.com/bobsilverberg/CFSelenium + +## What is CFSelenium? CFSelenium is a ColdFusion Component (CFC) which provides a native client library for Selenium-RC. This allows you to write tests, using CFML, which will drive a browser and verify results via Selenium-RC. -### Requirements ### +### Requirements + +1. [ColdFusion 10+](http://www.coldfusion.com) or [Lucee 4.5+](http://lucee.org) +2. The [Selenium-RC Server jar](http://www.seleniumhq.org/download/), the latest version of which is included in the distribution +3. [TestBox](http://www.ortussolutions.com/products/testbox) for Behavior Driven Development and contributing to our test suite. + +### Support + +* Please use the main repo's [issue tracker](https://github.com/Ortus-Solutions/CFSelenium/issues) to report bugs and request enhancements. +* You can also use the **TestBox** help group for help: https://groups.google.com/forum/#!forum/coldbox + +## Installation + +CFSelenium can be installed via [CommandBox](http://www.ortussolutions.com/products/commandbox) by typing: + +```bash +box install cfselenium +``` + +This will create the following structure under a `cfselenium` folder: + +* **formats** : Browser Extensions +* **Selenium-RC** : The Selenium Standalone Java Server +* **BaseSpec.cfc** : The TestBox base specification to use for Selenium driven specs +* **Selenium.cfc** : This nice project CFC +* **Server.cfc** : The driver CFC for the embedded server + +**Note:** Optionally if you would like to integrate with [TestBox](http://www.ortussolutions.com/products/testbox) you will have to create a mapping to the `cfselenium` installed folder as `/cfselenium`. + +### Contributing + +If you want to contribute to this project, please make sure you clone it from here: https://github.com/Ortus-Solutions/CFSelenium/. You will need [CommandBox](http://www.ortussolutions.com/products/commandbox) in order to do development, so once installed and cloned, just type: + +```bash +box install && box server start +``` -1. [ColdFusion 7+](http://www.coldfusion.com) - ColdFusion 9+ is required for the script-based cfc. You can use the tag-based cfc, selenium_tags on CF 7 and 8. -2. The [Selenium-RC Server jar](http://code.google.com/p/selenium/downloads/list), the latest version of which is included in the distribution +In the root of the clone and all the required dependencies will be installed and you can contribute to the project. An embedded server will also be started so you can execute the tests and develop. -### Usage ### +## Usage -Optionally, start the Selenium-RC server. Selenium.cfc will automatically start the Selenium-RC server for you in the background if it isn't already started (note this does not work on CF7). To start it manually, the command is similar to this: +Optionally, start the Selenium-RC server. `Selenium.cfc` will automatically start the Selenium-RC server for you in the background if it isn't already started. To start it manually, the command is similar to this: - java -jar selenium-server-standalone-2.42.2.jar +```bash +java -jar selenium-server-standalone-2.46.0.jar +``` Create an instance of selenium.cfc. - selenium = new selenium(); +```js +selenium = new Selenium(); +``` -You can also pass the host and port into the constructor, which default to localhost and 4444: +You can also pass the **host** and **port** into the constructor, which default to `localhost` and `4444`: - selenium = new selenium("localhost", 4444); +```js +selenium = new Selenium( "localhost", 4444 ); +``` -To start up a browser, call selenium.start() passing in the starting url and, optionally, a browser command telling it which browser to start (the default is *firefox): +To start up a browser, call `selenium.start()` passing in the starting URL and, optionally, a browser command telling it which browser to start (the default is `*firefox`): - selenium.start("http://github.com/"); +``` +selenium.start( "http://github.com/" ); +``` To start a different browser (e.g., Google Chrome), pass in the browser command too: - selenium.start("http://github.com/","*googlechrome"); +``` +selenium.start( "http://github.com/", "*googlechrome" ); +``` -Call methods on the selenium object to drive the browser and check values. For example: +Call methods on the selenium object to drive the browser and check values. Most likely you will be using [TestBox](http://www.ortussolutions.com/products/testbox) for driving expectations on these values: - selenium.open("/bobsilverberg/CFSelenium"); - assertEquals("bobsilverberg/CFSelenium - GitHub", selenium.getTitle()); - selenium.click("link=readme.md"); - selenium.waitForPageToLoad("30000"); - assertEquals("readme.md at master from bobsilverberg's CFSelenium - GitHub", selenium.getTitle()); - selenium.click("raw-url"); - selenium.waitForPageToLoad("30000"); - assertEquals("", selenium.getTitle()); - assertTrue(selenium.isTextPresent("[CFSelenium]")); +```js +// all your suites go here. +describe( "CFSelenium", function(){ -You can shut down the browser using the stop() method: + it( "can open an external readme", function(){ + selenium.open("/Ortus-Solutions/CFSelenium"); - selenium.stop(); + expect( selenium.getTitle() ).toInclude( "CFSelenium" ); + }); -### A Base Test Case for MXUnit ### + it( "can navigate and verify", function(){ + selenium.click( "link=readme.md" ); + selenium.waitForPageToLoad( "30000" ); + sleep( 1000 ); -Also included in the distribution is a base test case for MXUnit, called CFSeleniumTestCase.cfc. This is designed to instantiate the selenium.cfc for you and start up a browser session once, before all of your tests run, and shut down the browser after all the tests have completed. To use this base test case, simply extend it in your own test case: + expect( selenium.getTitle() ).toInclude( "readme.md" ); - component extends="CFSelenium.CFSeleniumTestCase" + selenium.click( "raw-url" ); + selenium.waitForPageToLoad( "30000" ); -You will then want to place a beforeTests() method in your test case which sets the browserUrl and the calls the base test case's beforeTests() method: + expect( selenium.getTitle() ).toBeEmpty(); + expect( selenium.isTextPresent("[CFSelenium]") ).toBeTrue(); - public void function beforeTests(){ - browserURL = "http://github.com/"; - super.beforeTests(); - } + }); -### A Selenium-IDE Formatter Too ### +}); +``` + +You can shut down the browser using the `stop()`` method: + +```js +selenium.stop(); +``` + +## TestBox Integration + +CFSelenium integrates with [TestBox](http://www.ortussolutions.com/products/testbox) via the `BaseSpec.cfc` that can be found in the root of the project. Every Spec that you create in which you want to enable CFSelenium for will inherit from this spec, which in turn inherits from the TestBox `BaseSpec` as well. + +``` +component extends="cfselenium.BaseSpec"{} +``` -Also included in the distribution is a Firefox extension which will add a formatter to Selenium-IDE which will allow you to export tests in CFSelenium / MXUnit format. The plugin can be found in the _formats_ folder. +Then you will have access to our life-cycle methods of `beforeAll` and `afterAll`. The `beforeAll()` method takes in two arguments in order to setup the Selenium connection. The `afterAll()` method can be omitted in your concrete spec and it stops the Selenium connection. -### Support ### +### BeforeAll() -The script-based version of CFSelenium is maintained by [Bob Silverberg](https://github.com/bobsilverberg) and the tag-based version is maintained by [Brian Swartzfager](https://github.com/bcswartz). Thanks also to [Marc Esher](https://github.com/marcesher) for the logic which starts and stops the Selenium-RC server automatically. +```js +/** +* Please note the two arguments to get a selenium server started +* @browserURL The base URL of the application to test. +* @browser The browser to run the tests, defaults to *firefox +*/ +function beforeAll( required browserURL, browser="*firefox" ){} +``` + +You can then use it in your specs: + +```js +/** +* Readme Spec +*/ +component extends="cfselenium.BaseSpec"{ + +/*********************************** LIFE CYCLE Methods ***********************************/ + + // executes before all suites+specs in the run() method + function beforeAll(){ + super.beforeAll( "http://github.com/", "*firefox" ); + } + +} +``` + +### A Selenium-IDE Formatter Too ### -Please use the main repo's [issue tracker](https://github.com/bobsilverberg/CFSelenium/issues) to report bugs and request enhancements. \ No newline at end of file +Also included in the distribution is a Firefox extension which will add a formatter to Selenium-IDE which will allow you to export tests in CFSelenium / MXUnit format. The plugin can be found in the _formats_ folder. \ No newline at end of file diff --git a/selenium_tags.cfc b/selenium_tags.cfc deleted file mode 100644 index 49abf5f..0000000 --- a/selenium_tags.cfc +++ /dev/null @@ -1,1710 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/test/cf7_cf8/readmeTest_cf7.cfm b/test/cf7_cf8/readmeTest_cf7.cfm deleted file mode 100644 index b7a7edc..0000000 --- a/test/cf7_cf8/readmeTest_cf7.cfm +++ /dev/null @@ -1,103 +0,0 @@ - - -

readmeTest for CFSelenium on ColdFusion 7

- - - - - - - - - - - - -

- Expected page title: #expected#
- Actual page title: #actual#
- - Passed - - Failed - -

- - - -

Loading readme.md...

- - - - - - - - - - - - -

- Expected page title: #expected#
- Actual page title: #actual#
- - Passed - - Failed - -

- - - -

Clicking on "raw-url"...

- - - - - - - - - - - - - - - - - -

- Expected page title: #expected#
- Actual page title: #actual#
- - Passed - - Failed - -

- - - - -

- Looking for text: [CFSelenium]
- Text found?: #actual#
- - Passed - - Failed - -

- -

DONE

- - - - -
diff --git a/test/cf7_cf8/readmeTest_cf8.cfc b/test/cf7_cf8/readmeTest_cf8.cfc deleted file mode 100644 index 5d62d67..0000000 --- a/test/cf7_cf8/readmeTest_cf8.cfc +++ /dev/null @@ -1,22 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - diff --git a/test/cf7_cf8/seleniumTest_cf7.cfm b/test/cf7_cf8/seleniumTest_cf7.cfm deleted file mode 100644 index 24b75ee..0000000 --- a/test/cf7_cf8/seleniumTest_cf7.cfm +++ /dev/null @@ -1,103 +0,0 @@ - - -

seleniumTest for CFSelenium on ColdFusion 7

- - - -

Instantiating selenium...

- - - - - - - -

- Expected Selenium sessionId length: #expected#
- Actual Selenium sessionId length: #actual#
- - Passed - - Failed - -

- -

Starting selenium...

- - - - - - - -

- Expected Selenium sessionId length: Not #failureCondition#
- Actual Selenium sessionId length: #actual#
- - Passed - - Failed - -

- -

Testing parsing of comma-separated values...

- - - - - - - - - - -

- Expected output (array):
- - - Actual output (array):
- - - - Failed - - - - - - - - - Passed - - Failed - - -

- -

Stopping selenium...

- - - - - -

- Expected Selenium sessionId length: #expected#
- Actual Selenium sessionId length: #actual#
- - Passed - - Failed - -

- - - -

DONE

- -
diff --git a/test/cf7_cf8/seleniumTest_cf8.cfc b/test/cf7_cf8/seleniumTest_cf8.cfc deleted file mode 100644 index 5783cfc..0000000 --- a/test/cf7_cf8/seleniumTest_cf8.cfc +++ /dev/null @@ -1,39 +0,0 @@ - - - - - - - - - - - - - - - - - - // the asserts for this are in setUp and tearDown - - - - - - - - - - - - - - - - - - - - - diff --git a/test/cf7_cf8/waitForTest_cf7.cfm b/test/cf7_cf8/waitForTest_cf7.cfm deleted file mode 100644 index 17a0a9f..0000000 --- a/test/cf7_cf8/waitForTest_cf7.cfm +++ /dev/null @@ -1,258 +0,0 @@ - - -

waitForTest for CFSelenium on ColdFusion 7

- - - -

Instantiating selenium...

- - - - - - - - -

Checking if "alwaysPresentAndVisible" exists on the page (should find it)...

- - - - - - - -

- Expected Selenium result: #expected#
- Actual Selenium result: #actual#
- - Passed - - Failed - -

- -

Will look for "neverPresent" on the page (should NOT find it and throw an error after 5 seconds)...

- - - - - - - - - - -

- Expected Selenium error type: #expected#
- Actual Selenium type #actual#
- - Passed - - Failed - -

- -

Will look for "presentAfterAPause", which at first will not be found...

- - - - -

- Expected Selenium result: #expected#
- Actual Selenium result: #actual#
- - Passed - - Failed - -

- -

Will now create "presentAfterAPause" via Javascript and check again...

- - - - - - -

- Expected Selenium result: #expected#
- Actual Selenium result: #actual#
- - Passed - - Failed - -

- - -

Checking if "alwaysPresentAndVisible" is visible on the page (should find it)...

- - - - - - - -

- Expected Selenium result: #expected#
- Actual Selenium result: #actual#
- - Passed - - Failed - -

- -

Will look for "neverVisible" on the page (should NOT see it and throw an error after 5 seconds)...

- - - - - - - - - - -

- Expected Selenium error type: #expected#
- Actual Selenium type #actual#
- - Passed - - Failed - -

- -

Will look for "becomesVisible", which at first will not be found...

- - - - -

- Expected Selenium result: #expected#
- Actual Selenium result: #actual#
- - Passed - - Failed - -

- -

Will now make "becomesVisible" visible via Javascript and check again...

- - - - - - -

- Expected Selenium result: #expected#
- Actual Selenium result: #actual#
- - Passed - - Failed - -

- - -

Testing that "neverVisible" is not visible on the page...

- - - - - - - -

- Expected Selenium result: #expected#
- Actual Selenium result: #actual#
- - Passed - - Failed - -

- - - -

Will test that "alwaysPresentAndVisible" is NOT visible (which is not true and will throw an error after 5 seconds)...

- - - - - - - - - - -

- Expected Selenium error type: #expected#
- Actual Selenium type #actual#
- - Passed - - Failed - -

- -

Will look for "becomesInvisible", which at first will be visible...

- - - - -

- Expected Selenium result: #expected#
- Actual Selenium result: #actual#
- - Passed - - Failed - -

- -

Will now make "becomesInvisible" invisible via Javascript and check again...

- - - - - - -

- Expected Selenium result: #expected#
- Actual Selenium result: #actual#
- - Passed - - Failed - -

- -

Stopping selenium...

- - - - - -

- Expected Selenium sessionId length: #expected#
- Actual Selenium sessionId length: #actual#
- - Passed - - Failed - -

- - - -

DONE

- -
diff --git a/test/cf7_cf8/waitForTest_cf8.cfc b/test/cf7_cf8/waitForTest_cf8.cfc deleted file mode 100644 index 075f12e..0000000 --- a/test/cf7_cf8/waitForTest_cf8.cfc +++ /dev/null @@ -1,65 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/test/cf9/RemoteFacade.cfc b/test/cf9/RemoteFacade.cfc deleted file mode 100644 index 45cd164..0000000 --- a/test/cf9/RemoteFacade.cfc +++ /dev/null @@ -1,3 +0,0 @@ - - - \ No newline at end of file diff --git a/test/cf9/readmeTest.cfc b/test/cf9/readmeTest.cfc deleted file mode 100644 index e5f7008..0000000 --- a/test/cf9/readmeTest.cfc +++ /dev/null @@ -1,23 +0,0 @@ -component extends="cfselenium.CFSeleniumTestCase" { - - function beforeTests(){ - browserURL = "http://github.com/"; - super.beforeTests(); - } - - function testForReadmePage() { - selenium.open("/teamcfadvance/CFSelenium"); - assertTrue(selenium.getTitle() contains "teamcfadvance/cfselenium"); - selenium.click("link=readme.md"); - selenium.waitForPageToLoad("30000"); - sleep(1000); - assertTrue(selenium.getTitle() contains "readme.md"); - selenium.click("raw-url"); - selenium.waitForPageToLoad("30000"); - assertEquals("", selenium.getTitle()); - assertTrue(selenium.isTextPresent("[CFSelenium]")); - } - - -} - diff --git a/test/cf9/run.cfm b/test/cf9/run.cfm deleted file mode 100644 index 0944fb6..0000000 --- a/test/cf9/run.cfm +++ /dev/null @@ -1,44 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - #results.getResultsOutput(url.output)# - - -
- -
-
- -
- - \ No newline at end of file diff --git a/test/cf9/seleniumStartupTest.cfc b/test/cf9/seleniumStartupTest.cfc deleted file mode 100644 index 5fc3430..0000000 --- a/test/cf9/seleniumStartupTest.cfc +++ /dev/null @@ -1,25 +0,0 @@ -component extends="cfselenium.CFSeleniumTestCase" { - - function beforeTests() { - selenium = createObject("component", "cfselenium.selenium").init(); - browserUrl = "http://wiki.mxunit.org/"; - } - - function tearDown() { - selenium.stop(); - } - - function shouldBeAbleToStartFirefox() { - selenium.start(browserUrl,"*firefox"); - } - - function shouldBeAbleToStartSafari() { - selenium.start(browserUrl,"*safari"); - } - - function shouldBeAbleToStartGoogleChrome() { - selenium.start(browserUrl,"*googlechrome"); - } - -} - diff --git a/test/cf9/seleniumStartup_WindowsVMTest.cfc b/test/cf9/seleniumStartup_WindowsVMTest.cfc deleted file mode 100644 index 35a5b27..0000000 --- a/test/cf9/seleniumStartup_WindowsVMTest.cfc +++ /dev/null @@ -1,24 +0,0 @@ -component extends="cfselenium.CFSeleniumTestCase" { - - function beforeTests() { - hostname = "192.168.56.101"; - selenium = createobject("component","cfselenium.selenium").init(hostname, 4444); - browserUrl = "http://wiki.mxunit.org/"; - } - - function shouldBeAbleToStartIEOnWindowsVM() { - assertTrue(len(selenium.getSessionId()) eq 0); - selenium.start(browserUrl, "*iexplore"); - assertFalse(len(selenium.getSessionId()) eq 0); - } - - /* problem starting FF on Windows VM - function shouldBeAbleToStartFirefoxWindowsVM() { - assertTrue(len(selenium.getSessionId()) eq 0); - selenium.start(browserUrl, "*firefox"); - assertFalse(len(selenium.getSessionId()) eq 0); - } - */ - -} - diff --git a/test/cf9/seleniumTest.cfc b/test/cf9/seleniumTest.cfc deleted file mode 100644 index 60f0317..0000000 --- a/test/cf9/seleniumTest.cfc +++ /dev/null @@ -1,31 +0,0 @@ -component extends="cfselenium.CFSeleniumTestCase" { - - public void function beforeTests() { - browserUrl = "http://wiki.mxunit.org/"; - browserCommand = "*firefox"; - selenium = createobject("component","CFSelenium.selenium").init("localhost", 4444); - assertEquals(0, len(selenium.getSessionId())); - selenium.start(browserUrl,browserCommand); - assertFalse(len(selenium.getSessionId()) eq 0); - } - - function tearDown() { - selenium.stop(); - assertEquals(0, len(selenium.getSessionId())); - } - - function shouldBeAbleToStartAndStopABrowser() { - // the asserts for this are in setUp and tearDown - } - - function parseCSVShouldWork() { - - input = "veni\, vidi\, vici,c:\\foo\\bar,c:\\I came\, I \\saw\\\, I conquered"; - expected = ["veni, vidi, vici", "c:\foo\bar", "c:\i came, i \saw\, i conquered"]; - debug(selenium.parseCSV(input)); - assertEquals(expected,selenium.parseCSV(input)); - - } - -} - diff --git a/tests/Application.cfc b/tests/Application.cfc new file mode 100644 index 0000000..5b38c30 --- /dev/null +++ b/tests/Application.cfc @@ -0,0 +1,25 @@ +/** +* Copyright Since 2005 Ortus Solutions, Corp +* www.coldbox.org | www.luismajano.com | www.ortussolutions.com | www.gocontentbox.org +************************************************************************************** +*/ +component{ + this.name = "A TestBox Runner Suite For CFSelenium " & hash( getCurrentTemplatePath() ); + // any other application.cfc stuff goes below: + this.sessionManagement = true; + + // any mappings go here, we create one that points to the root called test. + this.mappings[ "/tests" ] = getDirectoryFromPath( getCurrentTemplatePath() ); + + // Map back to its root + rootPath = REReplaceNoCase( this.mappings[ "/tests" ], "tests(\\|/)", "" ); + this.mappings[ "/cfselenium" ] = rootPath; + + // any orm definitions go here. + + // request start + public boolean function onRequestStart( String targetPage ){ + + return true; + } +} \ No newline at end of file diff --git a/test/fixture/waitForFixture.htm b/tests/resources/waitForFixture.htm similarity index 100% rename from test/fixture/waitForFixture.htm rename to tests/resources/waitForFixture.htm diff --git a/tests/runner.cfm b/tests/runner.cfm new file mode 100644 index 0000000..f5ec955 --- /dev/null +++ b/tests/runner.cfm @@ -0,0 +1,13 @@ + + + + + + + + + + + + + \ No newline at end of file diff --git a/tests/specs/ReadmeTest.cfc b/tests/specs/ReadmeTest.cfc new file mode 100644 index 0000000..ade8986 --- /dev/null +++ b/tests/specs/ReadmeTest.cfc @@ -0,0 +1,43 @@ +/** +* Readme Spec +*/ +component extends="cfselenium.BaseSpec"{ + +/*********************************** LIFE CYCLE Methods ***********************************/ + + // executes before all suites+specs in the run() method + function beforeAll(){ + super.beforeAll( "http://github.com/", "*firefox" ); + } + +/*********************************** BDD SUITES ***********************************/ + + function run( testResults, testBox ){ + // all your suites go here. + describe( "CFSelenium", function(){ + + it( "can open an external readme", function(){ + selenium.open("/Ortus-Solutions/CFSelenium"); + + expect( selenium.getTitle() ).toInclude( "CFSelenium" ); + }); + + it( "can navigate and verify", function(){ + selenium.click( "link=readme.md" ); + selenium.waitForPageToLoad( "30000" ); + sleep( 1000 ); + + expect( selenium.getTitle() ).toInclude( "readme.md" ); + + selenium.click( "raw-url" ); + selenium.waitForPageToLoad( "30000" ); + + expect( selenium.getTitle() ).toBeEmpty(); + expect( selenium.isTextPresent("[CFSelenium]") ).toBeTrue(); + + }); + + }); + } + +} \ No newline at end of file diff --git a/tests/specs/SeleniumTest.cfc b/tests/specs/SeleniumTest.cfc new file mode 100644 index 0000000..c9a9f4c --- /dev/null +++ b/tests/specs/SeleniumTest.cfc @@ -0,0 +1,46 @@ +/** +* Readme Spec +*/ +component extends="cfselenium.BaseSpec"{ + +/*********************************** LIFE CYCLE Methods ***********************************/ + + // executes before all suites+specs in the run() method + function beforeAll(){ + testURL = "http://www.ortussolutions.com/products/testbox/"; + selenium = new cfselenium.Selenium(); + } + +/*********************************** BDD SUITES ***********************************/ + + function run( testResults, testBox ){ + // all your suites go here. + describe( "CFSelenium", function(){ + + it( "can start a session", function(){ + expect( selenium.getSessionID() ).toBeEmpty(); + + selenium.start( testURL ); + + expect( selenium.getSessionID() ).notToBeEmpty(); + + }); + + it( "can stop a session", function(){ + selenium.stop(); + expect( selenium.getSessionID() ).toBeEmpty(); + }); + + it( "can parse CSV input", function(){ + var input = "veni\, vidi\, vici,c:\\foo\\bar,c:\\I came\, I \\saw\\\, I conquered"; + var expected = ["veni, vidi, vici", "c:\foo\bar", "c:\i came, i \saw\, i conquered"]; + var results = selenium.parseCSV( input ); + + debug( results ); + + expect( results ).toBe( expected ); + }); + }); + } + +} diff --git a/tests/specs/StartupTests.cfc b/tests/specs/StartupTests.cfc new file mode 100644 index 0000000..bf6f49d --- /dev/null +++ b/tests/specs/StartupTests.cfc @@ -0,0 +1,45 @@ +/** +* Readme Spec +*/ +component extends="cfselenium.BaseSpec"{ + +/*********************************** LIFE CYCLE Methods ***********************************/ + + // executes before all suites+specs in the run() method + function beforeAll(){ + testURL = "http://www.ortussolutions.com/products/testbox/"; + selenium = new cfselenium.Selenium(); + } + +/*********************************** BDD SUITES ***********************************/ + + function run( testResults, testBox ){ + // all your suites go here. + describe( "CFSelenium", function(){ + + afterEach(function( currentSpec ){ + selenium.stop(); + }); + + it( "can start FireFox", function(){ + selenium.start( testURL, "*firefox" ); + }); + + it( "can start Chrome", function(){ + selenium.start( testURL, "*googlechrome" ); + }); + + it( + title="can start IE", + body=function(){ + selenium.start( testURL, "*iexplore" ); + }, + skip=function(){ + return ( findNoCase( "windows", server.os.name ) ? false : true ); + } + ); + + }); + } + +} \ No newline at end of file diff --git a/test/cf9/waitForTest.cfc b/tests/specs/WaitForTest.cfc similarity index 100% rename from test/cf9/waitForTest.cfc rename to tests/specs/WaitForTest.cfc diff --git a/tests/test.xml b/tests/test.xml new file mode 100644 index 0000000..cfeaa2f --- /dev/null +++ b/tests/test.xml @@ -0,0 +1,137 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Tests ran at ${start.TODAY} + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +