forked from EFForg/https-everywhere
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtest_popup.py
More file actions
51 lines (41 loc) · 1.66 KB
/
test_popup.py
File metadata and controls
51 lines (41 loc) · 1.66 KB
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
51
import unittest
from util import ExtensionTestCase
class TestPopup(ExtensionTestCase):
def test_rule_shown(self):
raise unittest.SkipTest('broken since #17010')
url = 'http://freerangekitten.com'
with self.load_popup_for(url):
el = self.query_selector('#StableRules > div > label > span')
self.assertTrue(el.text.lower() in url)
def test_disable_enable(self):
selector = '#onoffswitch'
var_name = 'background.state.isExtensionEnabled'
# disable https everywhere
with self.load_popup_for():
el = self.query_selector(selector)
self.assertTrue(el.is_selected())
el.click() # disable
with self.load_popup_for():
el = self.query_selector(selector)
self.assertFalse(el.is_selected())
el.click()
with self.load_popup_for():
el = self.query_selector(selector)
self.assertTrue(el.is_selected())
def test_http_nowhere(self):
selector = '#http-nowhere-checkbox'
var_name = 'background.state.httpNowhereOn'
# check default state and enable
with self.load_popup_for():
el = self.query_selector(selector)
self.assertFalse(el.is_selected())
el.click()
# check it is enabled, and disable
with self.load_popup_for():
el = self.query_selector(selector)
self.assertTrue(el.is_selected())
el.click() # disable
# check disabled
with self.load_popup_for():
el = self.query_selector(selector)
self.assertFalse(el.is_selected()) # default state