GitLab is used only for code review, issue tracking and project management. Canonical locations for source code are still https://gitweb.torproject.org/ https://git.torproject.org/ and git-rw.torproject.org.

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

Convert the play_videos test to marionette

parent 4bb2be56
......@@ -364,13 +364,12 @@ our @tests = (
},
{
name => 'play_videos',
type => 'mozmill',
type => 'marionette',
descr => 'Play some videos',
use_net => 1,
mozmill_test => 'test_page',
marionette_test => 'page',
remote => 1,
timeout => 50000,
interval => 100,
},
{
name => 'svg-disable',
......
......@@ -120,8 +120,8 @@ Adding a simple test page
~~~~~~~~~~~~~~~~~~~~~~~~~
If what you want to test is the behavior of some specific page and you
don't need any of the mozmill specific features, you can reuse the
'test_page' mozmill test.
don't need any of the marionette specific features, you can reuse the
'page' marionette test.
To do that, put your page in the directory 'test-data'. The name of the
test will be the name of the page without the '.html' extension.
......@@ -143,12 +143,11 @@ The test definition will look like this:
----
{
name => 'some_name',
type => 'mozmill',
type => 'marionette',
descr => 'Some description',
mozmill_test => 'test_page',
marionette_test => 'page',
remote => 1,
timeout => 50000,
interval => 100,
},
----
......@@ -160,9 +159,6 @@ The 'timeout' value is the time in milliseconds after which the test
should be considered as failed if the 'test_result' element is still
not present.
The 'interval' value is how often we should check if the test_result
element appeared.
Adding a selenium test
~~~~~~~~~~~~~~~~~~~~~~
......
from marionette_driver import By
from marionette_driver.errors import MarionetteException
from firefox_ui_harness import FirefoxTestCase
import testsuite
class Test(FirefoxTestCase):
def setUp(self):
FirefoxTestCase.setUp(self)
ts = testsuite.TestSuite()
self.ts = ts
if ts.t['test']['remote']:
test_data_url = ts.t['options']['test_data_url']
else:
test_data_url = "file://%s" % ts.t['options']['test_data_dir']
self.test_page_url = '%s/%s.html' % (test_data_url, ts.t['test']['name'])
if ts.t['test']['timeout']:
self.timeout = ts.t['test']['timeout']
else:
self.timeout = 50000
def test_page(self):
with self.marionette.using_context('content'):
self.marionette.navigate(self.test_page_url)
self.marionette.set_search_timeout(self.timeout)
elt = self.marionette.find_element('id', 'test_result');
self.assertEqual(elt.text, 'OK')
"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