forked from mozilla/pytest-mozwebqa
-
Notifications
You must be signed in to change notification settings - Fork 0
/
test_rc_client.py
50 lines (39 loc) · 1.65 KB
/
test_rc_client.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
#!/usr/bin/env python
# This Source Code Form is subject to the terms of the Mozilla Public
# License, v. 2.0. If a copy of the MPL was not distributed with this
# file, You can obtain one at http://mozilla.org/MPL/2.0/.
import os
import pytest
import json
from webserver import SimpleWebServer
def setup_module(module):
webserver = SimpleWebServer()
webserver.start()
TestRCClient.webserver = webserver
def teardown_module(module):
TestRCClient.webserver.stop()
@pytest.mark.skip_selenium
@pytest.mark.nondestructive
class TestRCClient:
def testStartRCClientUsingEnvironment(self, testdir):
file_test = testdir.makepyfile("""
import pytest
@pytest.mark.nondestructive
def test_selenium(mozwebqa):
mozwebqa.selenium.open('/')
assert mozwebqa.selenium.get_text('css=h1') == 'Success!'
""")
reprec = testdir.inline_run('--baseurl=http://localhost:%s' % self.webserver.port, '--api=rc', '--browser=*firefox', file_test)
passed, skipped, failed = reprec.listoutcomes()
assert len(passed) == 1
def testStartRCClientUsingBrowser(self, testdir):
file_test = testdir.makepyfile("""
import pytest
@pytest.mark.nondestructive
def test_selenium(mozwebqa):
mozwebqa.selenium.open('/')
assert mozwebqa.selenium.get_text('css=h1') == 'Success!'
""")
reprec = testdir.inline_run('--baseurl=http://localhost:%s' % self.webserver.port, '--api=rc', '--browser=*firefox', file_test)
passed, skipped, failed = reprec.listoutcomes()
assert len(passed) == 1