Merge lp:~coreygoldberg/selenium-simple-test/no-javascript-disable into lp:selenium-simple-test

Proposed by Corey Goldberg
Status: Merged
Approved by: Corey Goldberg
Approved revision: 439
Merged at revision: 433
Proposed branch: lp:~coreygoldberg/selenium-simple-test/no-javascript-disable
Merge into: lp:selenium-simple-test
Diff against target: 330 lines (+11/-81)
16 files modified
docs/changelog.rst (+1/-0)
docs/index.rst (+0/-14)
docs/remote.rst (+0/-1)
src/sst/browsers.py (+1/-4)
src/sst/cases.py (+4/-7)
src/sst/command.py (+0/-4)
src/sst/config.py (+0/-4)
src/sst/context.py (+2/-9)
src/sst/scripts/remote.py (+0/-2)
src/sst/scripts/run.py (+2/-2)
src/sst/scripts/test.py (+1/-1)
src/sst/selftests/context.py (+0/-1)
src/sst/selftests/no_js.py (+0/-17)
src/sst/tests/test_sst_run.py (+0/-1)
src/testproject/templates/nojs.html (+0/-13)
src/testproject/urls.py (+0/-1)
To merge this branch: bzr merge lp:~coreygoldberg/selenium-simple-test/no-javascript-disable
Reviewer Review Type Date Requested Status
Corey Goldberg (community) Approve
Leo Arias (community) code review Approve
Review via email: mp+180139@code.launchpad.net

Commit message

removed the ability to disable javascript

Description of the change

removed the ability to disable javascript.
(including all references in: source code, documentation, tests, and test app).

This was a firefox-only feature.. and starting with Firefox 23, it is no longer available to disable as a profile feature... so removed from SST.

To post a comment you must log in.
437. By Corey Goldberg

fixed comment

438. By Corey Goldberg

fixed header typo

Revision history for this message
Leo Arias (elopio) wrote :

cgoldberg: 239␉- browser_factory=factory(cmd_opts.javascript_disabled),
shouldn't that be just to remove the param?
factory()
elopio, yup.. fixing now
cgoldberg: ok, I'll +1.

review: Approve (code review)
439. By Corey Goldberg

fixed browser factory accidentally deleted

Revision history for this message
Corey Goldberg (coreygoldberg) wrote :

fixed. merging.

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'docs/changelog.rst'
2--- docs/changelog.rst 2013-07-31 15:09:57 +0000
3+++ docs/changelog.rst 2013-08-14 14:16:45 +0000
4@@ -11,6 +11,7 @@
5
6 version **0.2.5** (under development)
7 *************************************
8+* removed 'disable javascript' feature from Firefox
9
10
11 version **0.2.4** (2013 July 30)
12
13=== modified file 'docs/index.rst'
14--- docs/index.rst 2013-07-30 19:57:28 +0000
15+++ docs/index.rst 2013-08-14 14:16:45 +0000
16@@ -127,7 +127,6 @@
17 -d DIR_NAME directory of test case files
18 -r REPORT_FORMAT report type: xml
19 -b BROWSER_TYPE select webdriver (Firefox, Chrome, PhantomJS, etc)
20- -j disable javascript in browser
21 -m SHARED_DIRECTORY directory for shared modules
22 -q output less debugging info during test run
23 -V print version info and exit
24@@ -331,9 +330,6 @@
25
26 from sst import config
27
28- # is javascript disabled?
29- config.javascript_disabled
30-
31 # which browser is being used?
32 config.browser_type
33
34@@ -350,16 +346,6 @@
35 config.cache
36
37
38-------------------------
39- Disabling Javascript
40-------------------------
41-
42-If you need to disable Javascript for an individual test, you can do it by
43-putting the following at the start of the test::
44-
45- JAVASCRIPT_DISABLED = True
46-
47-
48 --------------------------------
49 Development on Ubuntu/Debian
50 --------------------------------
51
52=== modified file 'docs/remote.rst'
53--- docs/remote.rst 2011-12-29 16:49:01 +0000
54+++ docs/remote.rst 2013-08-14 14:16:45 +0000
55@@ -53,7 +53,6 @@
56 -r REPORT_FORMAT results report format (html, xml, console)
57 -b BROWSER_TYPE select webdriver (Firefox, Chrome, InternetExplorer,
58 etc)
59- -j disable javascript in browser
60 -m SHARED_MODULES directory for shared modules
61 -q output less debugging info during test run
62 -s save screenshots on failures
63
64=== modified file 'src/sst/browsers.py'
65--- src/sst/browsers.py 2013-07-05 16:33:37 +0000
66+++ src/sst/browsers.py 2013-08-14 14:16:45 +0000
67@@ -43,9 +43,8 @@
68
69 webdriver_class = None
70
71- def __init__(self, javascript_disabled=False):
72+ def __init__(self):
73 super(BrowserFactory, self).__init__()
74- self.javascript_disabled = javascript_disabled
75
76 def setup_for_test(self, test):
77 """Setup the browser for the given test.
78@@ -203,8 +202,6 @@
79 profile.set_preference(
80 'capability.policy.default.Window.frameElement.get',
81 'allAccess')
82- if test.javascript_disabled or self.javascript_disabled:
83- profile.set_preference('javascript.enabled', False)
84 self.profile = profile
85
86 def browser(self):
87
88=== modified file 'src/sst/cases.py'
89--- src/sst/cases.py 2013-07-05 17:13:50 +0000
90+++ src/sst/cases.py 2013-08-14 14:16:45 +0000
91@@ -46,7 +46,6 @@
92
93 browser_factory = browsers.FirefoxFactory()
94
95- javascript_disabled = False
96 assume_trusted_cert_issuer = False
97
98 wait_timeout = 10
99@@ -178,11 +177,9 @@
100 def setUp(self):
101 self._compile_script()
102 # The script may override some settings. The default value for
103- # JAVASCRIPT_DISABLED and ASSUME_TRUSTED_CERT_ISSUER are False, so if
104- # the user mentions them in his script, it's to turn them on. Also,
105- # getting our hands on the values used in the script is too hackish ;)
106- if 'JAVASCRIPT_DISABLED' in self.code.co_names:
107- self.javascript_disabled = True
108+ # ASSUME_TRUSTED_CERT_ISSUER is False, so if the user mentions it
109+ # in his script, it's to turn them on. Also, getting our hands on
110+ # the values used in the script is too hackish.
111 if 'ASSUME_TRUSTED_CERT_ISSUER' in self.code.co_names:
112 self.assume_trusted_cert_issuer = True
113 super(SSTScriptTestCase, self).setUp()
114@@ -193,7 +190,7 @@
115 previous_context = context.store_context()
116 self.addCleanup(context.restore_context, previous_context)
117 context.populate_context(self.context, self.script_path,
118- self.browser.name, self.javascript_disabled)
119+ self.browser.name)
120
121 def _compile_script(self):
122 self.script_path = os.path.join(self.script_dir, self.script_name)
123
124=== modified file 'src/sst/command.py'
125--- src/sst/command.py 2013-07-05 17:13:50 +0000
126+++ src/sst/command.py 2013-08-14 14:16:45 +0000
127@@ -25,7 +25,6 @@
128 import shutil
129 import traceback
130
131-
132 import sst
133 from sst import (
134 actions,
135@@ -67,9 +66,6 @@
136 default='Firefox',
137 help=('select webdriver (Firefox, Chrome, '
138 'PhantomJS, etc)'))
139- parser.add_option('-j', dest='javascript_disabled',
140- default=False, action='store_true',
141- help='disable javascript in browser')
142 parser.add_option('-m', dest='shared_directory',
143 default=None,
144 help='directory for shared modules')
145
146=== modified file 'src/sst/config.py'
147--- src/sst/config.py 2013-04-23 11:05:53 +0000
148+++ src/sst/config.py 2013-08-14 14:16:45 +0000
149@@ -23,9 +23,6 @@
150
151 from sst import config
152
153- # is javascript disabled?
154- config.javascript_disabled
155-
156 # which browser is being used?
157 config.browser_type
158
159@@ -44,7 +41,6 @@
160
161 browser_type = 'firefox'
162 _current_context = None
163-javascript_disabled = False
164 shared_directory = None
165 results_directory = None
166 flags = []
167
168=== modified file 'src/sst/context.py'
169--- src/sst/context.py 2013-04-11 14:34:47 +0000
170+++ src/sst/context.py 2013-08-14 14:16:45 +0000
171@@ -29,10 +29,7 @@
172 )
173
174
175-def populate_context(
176- context, path, browser_type,
177- javascript_disabled, arguments=None
178-):
179+def populate_context(context, path, browser_type, arguments=None):
180 """Create the execution context for a test"""
181
182 name = os.path.splitext(os.path.split(path)[1])[0]
183@@ -42,7 +39,6 @@
184
185 config._current_context = context
186 config.browser_type = browser_type
187- config.javascript_disabled = javascript_disabled
188 config.__args__ = arguments or {}
189 config.cache.clear()
190
191@@ -93,10 +89,7 @@
192 )
193
194 context = {}
195- populate_context(
196- context, location, config.browser_type,
197- config.javascript_disabled, kwargs
198- )
199+ populate_context(context, location, config.browser_type, kwargs)
200
201 with open(location) as h:
202 exec h.read() in context
203
204=== modified file 'src/sst/scripts/remote.py'
205--- src/sst/scripts/remote.py 2013-06-07 14:36:15 +0000
206+++ src/sst/scripts/remote.py 2013-08-14 14:16:45 +0000
207@@ -21,7 +21,6 @@
208 import os
209 import sys
210
211-
212 import testtools
213
214 testtools.try_import('selenium')
215@@ -44,7 +43,6 @@
216 "browserName": cmd_opts.browser_type.lower(),
217 "platform": cmd_opts.browser_platform.upper(),
218 "version": cmd_opts.browser_version,
219- "javascriptEnabled": not cmd_opts.javascript_disabled,
220 "name": cmd_opts.session_name},
221 cmd_opts.webdriver_remote_url)
222 runtests.runtests(
223
224=== modified file 'src/sst/scripts/run.py'
225--- src/sst/scripts/run.py 2013-07-05 17:13:50 +0000
226+++ src/sst/scripts/run.py 2013-08-14 14:16:45 +0000
227@@ -1,6 +1,6 @@
228 #!/usr/bin/env python
229 #
230-# Copyright (c) 2011-2012 Canonical Ltd.
231+# Copyright (c) 2011,2012,2013 Canonical Ltd.
232 #
233 # This file is part of: SST (selenium-simple-test)
234 # https://launchpad.net/selenium-simple-test
235@@ -54,7 +54,7 @@
236 test_dir=cmd_opts.dir_name,
237 collect_only=cmd_opts.collect_only,
238 report_format=cmd_opts.report_format,
239- browser_factory=factory(cmd_opts.javascript_disabled),
240+ browser_factory=factory(),
241 shared_directory=cmd_opts.shared_directory,
242 screenshots_on=cmd_opts.screenshots_on,
243 concurrency_num=cmd_opts.concurrency,
244
245=== modified file 'src/sst/scripts/test.py'
246--- src/sst/scripts/test.py 2013-07-05 17:13:50 +0000
247+++ src/sst/scripts/test.py 2013-08-14 14:16:45 +0000
248@@ -69,7 +69,7 @@
249 test_dir=test_dir,
250 collect_only=cmd_opts.collect_only,
251 report_format=cmd_opts.report_format,
252- browser_factory=factory(cmd_opts.javascript_disabled),
253+ browser_factory=factory(),
254 shared_directory=shared_directory,
255 screenshots_on=cmd_opts.screenshots_on,
256 concurrency_num=cmd_opts.concurrency,
257
258=== modified file 'src/sst/selftests/context.py'
259--- src/sst/selftests/context.py 2013-05-14 08:14:43 +0000
260+++ src/sst/selftests/context.py 2013-08-14 14:16:45 +0000
261@@ -4,7 +4,6 @@
262 assert locals() == config._current_context
263 assert config.browser_type
264 assert config.__args__ == {}
265-assert not config.javascript_disabled
266 assert __name__ == 'context'
267 assert __file__.endswith('context.py')
268
269
270=== removed file 'src/sst/selftests/no_js.py'
271--- src/sst/selftests/no_js.py 2013-05-07 14:41:34 +0000
272+++ src/sst/selftests/no_js.py 1970-01-01 00:00:00 +0000
273@@ -1,17 +0,0 @@
274-import sst
275-import sst.actions
276-from sst import config
277-
278-# disabling javascript is currently only implemented for Firefox in sst
279-if config.browser_type != 'firefox':
280- sst.actions.skip()
281-
282-JAVASCRIPT_DISABLED = True
283-
284-sst.actions.set_base_url('http://localhost:%s/' % sst.DEVSERVER_PORT)
285-sst.actions.go_to('/nojs/')
286-
287-sst.actions.assert_text('test', "Before JS")
288-
289-from sst import config
290-assert config.javascript_disabled
291
292=== modified file 'src/sst/tests/test_sst_run.py'
293--- src/sst/tests/test_sst_run.py 2013-07-08 07:36:57 +0000
294+++ src/sst/tests/test_sst_run.py 2013-08-14 14:16:45 +0000
295@@ -72,5 +72,4 @@
296 self.assertEqual(config.browser_type, 'firefox')
297 self.assertEqual(config.cache, {})
298 self.assertEqual(config.flags, [])
299- self.assertFalse(config.javascript_disabled)
300 self.assertIs(None, config.results_directory)
301
302=== removed file 'src/testproject/templates/nojs.html'
303--- src/testproject/templates/nojs.html 2011-12-31 04:07:20 +0000
304+++ src/testproject/templates/nojs.html 1970-01-01 00:00:00 +0000
305@@ -1,13 +0,0 @@
306-<html>
307- <head>
308- <title>{{ title }}</title>
309- <link rel="stylesheet" type="text/css" href="./static-files/style.css" />
310- </head>
311- <body>
312- <div id="test">Before JS</div>
313- <script type="text/javascript">
314- var div = document.getElementById('test');
315- div.innerHTML = 'After JS';
316- </script>
317- </body>
318-</html>
319
320=== modified file 'src/testproject/urls.py'
321--- src/testproject/urls.py 2013-07-03 15:22:40 +0000
322+++ src/testproject/urls.py 2013-08-14 14:16:45 +0000
323@@ -16,7 +16,6 @@
324 (r'simple', include('testproject.simple.urls')),
325 (r'begin', 'simple.views.begin'),
326 (r'longscroll', 'simple.views.longscroll'),
327- (r'nojs', 'simple.views.nojs'),
328 (r'html5', 'simple.views.html5'),
329 (r'popup', 'simple.views.popup'),
330 (r'frame_a', 'simple.views.frame_a'),

Subscribers

People subscribed via source and target branches