Unverified Commit d51e13fa authored by boklm's avatar boklm
Browse files

Add mozmill-tests/tbb-tests/test_page.js

This mozmill test can be used to test a page. It uses infos from the
test and options to find which page to load.

The test page should set a test_result element on the page with OK if
the test was successful, or an error otherwise.

The following test options are used:

- the name of the test is the name of the page that will be loaded (with
  .html appended)

- if remote is set to true, it is loaded remotely, using the
  test_data_url option, otherwise it is loaded from the local test-data
  directory.

- timeout is the time in milliseconds to wait for the test_result
  element to appear. The default is 50000.

- interval is how often we should check if the test_result element
  appeared. The default is 100.
parent 4ad90e46
......@@ -43,6 +43,8 @@ my %default_options = (
'email-subject' => '[test result: [% success ? "ok" : "failed" %]] [% options.name %]',
'mozmill-dir' => 'c:\tbbtestsuite\mozmill-env',
'http-proxy-port' => '8888',
test_data_url => 'http://93.95.228.161/test-data',
test_data_dir => "$FindBin::Bin/test-data",
);
......
"use strict";
var {expect} = require("../mozilla-mozmill-tests/lib/assertions");
var testsuite = require("../lib/testsuite");
var setupModule = function(aModule) {
aModule.controller = mozmill.getBrowserController();
}
var testPage = function() {
var test_data_url = testsuite.test.remote ? testsuite.options.test_data_url
: ("file://" + testsuite.options.test_data_dir);
var test_page_url = test_data_url + "/" + testsuite.test.name + ".html";
var timeout = testsuite.test.timeout ? testsuite.test.timeout : 50000;
var interval = testsuite.test.interval ? testsuite.test.interval : 100;
controller.open(test_page_url);
controller.waitForPageLoad();
var result = new elementslib.ID(controller.window.document, "test_result");
result.waitForElement(timeout, interval);
var result_text = result.getNode().innerHTML;
expect.equal(result_text, "OK", result_text);
}
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment