mediawiki_selenium 1.0.0.pre.2 → 1.0.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.rubocop.yml +23 -1
- data/.ruby-gemset +1 -0
- data/.ruby-version +1 -0
- data/Gemfile +1 -4
- data/UPGRADE.md +1 -1
- data/bin/mediawiki-selenium-init +1 -1
- data/lib/mediawiki_selenium/browser_factory/base.rb +8 -8
- data/lib/mediawiki_selenium/browser_factory/chrome.rb +1 -1
- data/lib/mediawiki_selenium/browser_factory/firefox.rb +4 -4
- data/lib/mediawiki_selenium/browser_factory/phantomjs.rb +2 -2
- data/lib/mediawiki_selenium/browser_factory.rb +5 -5
- data/lib/mediawiki_selenium/environment.rb +15 -14
- data/lib/mediawiki_selenium/initializer.rb +4 -4
- data/lib/mediawiki_selenium/page_factory.rb +1 -1
- data/lib/mediawiki_selenium/remote_browser_factory.rb +12 -8
- data/lib/mediawiki_selenium/step_definitions/login_steps.rb +0 -11
- data/lib/mediawiki_selenium/step_definitions/navigation_steps.rb +0 -11
- data/lib/mediawiki_selenium/step_definitions/preferences_steps.rb +0 -11
- data/lib/mediawiki_selenium/step_definitions/resource_loader_steps.rb +0 -11
- data/lib/mediawiki_selenium/step_definitions/upload_file_steps.rb +3 -3
- data/lib/mediawiki_selenium/step_definitions.rb +5 -5
- data/lib/mediawiki_selenium/support/env.rb +5 -16
- data/lib/mediawiki_selenium/support/hooks.rb +15 -26
- data/lib/mediawiki_selenium/support/modules/api_helper.rb +5 -7
- data/lib/mediawiki_selenium/support/pages/api_page.rb +6 -6
- data/lib/mediawiki_selenium/support/pages/login_page.rb +13 -12
- data/lib/mediawiki_selenium/support/pages/random_page.rb +2 -2
- data/lib/mediawiki_selenium/support/pages/reset_preferences_page.rb +3 -3
- data/lib/mediawiki_selenium/support/pages.rb +4 -4
- data/lib/mediawiki_selenium/support/sauce.rb +14 -18
- data/lib/mediawiki_selenium/support.rb +4 -4
- data/lib/mediawiki_selenium/version.rb +1 -12
- data/lib/mediawiki_selenium/warnings_formatter.rb +15 -15
- data/lib/mediawiki_selenium.rb +8 -19
- data/mediawiki_selenium.gemspec +35 -28
- data/spec/api_helper_spec.rb +25 -25
- data/spec/browser_factory/base_spec.rb +50 -46
- data/spec/browser_factory/chrome_spec.rb +11 -11
- data/spec/browser_factory/firefox_spec.rb +17 -17
- data/spec/browser_factory/phantomjs_spec.rb +11 -11
- data/spec/environment_spec.rb +194 -159
- data/spec/page_factory_spec.rb +12 -12
- data/spec/remote_browser_factory_spec.rb +15 -15
- data/spec/spec_helper.rb +2 -2
- data/templates/tests/browser/features/support/env.rb +3 -3
- metadata +9 -9
- data/.rubocop_todo.yml +0 -160
@@ -1,11 +1,11 @@
|
|
1
|
-
require
|
1
|
+
require 'spec_helper'
|
2
2
|
|
3
3
|
module MediawikiSelenium::BrowserFactory
|
4
4
|
describe Chrome do
|
5
5
|
let(:factory_class) { Chrome }
|
6
6
|
let(:factory) { factory_class.new(:chrome) }
|
7
7
|
|
8
|
-
describe
|
8
|
+
describe '.default_bindings' do
|
9
9
|
subject { factory_class.default_bindings }
|
10
10
|
|
11
11
|
it { is_expected.to include(:browser_language) }
|
@@ -13,22 +13,22 @@ module MediawikiSelenium::BrowserFactory
|
|
13
13
|
it { is_expected.to include(:browser_user_agent) }
|
14
14
|
end
|
15
15
|
|
16
|
-
describe
|
16
|
+
describe '#browser_options' do
|
17
17
|
subject { factory.browser_options(config) }
|
18
18
|
|
19
|
-
context
|
20
|
-
let(:config) { { browser_language:
|
19
|
+
context 'given a custom browser_language' do
|
20
|
+
let(:config) { { browser_language: 'eo' } }
|
21
21
|
|
22
|
-
it
|
23
|
-
expect(subject[:prefs]).to include(
|
22
|
+
it 'sets the intl.accept_languages preference to the given language' do
|
23
|
+
expect(subject[:prefs]).to include('intl.accept_languages' => 'eo')
|
24
24
|
end
|
25
25
|
end
|
26
26
|
|
27
|
-
context
|
28
|
-
let(:config) { { browser_user_agent:
|
27
|
+
context 'given a custom browser_user_agent' do
|
28
|
+
let(:config) { { browser_user_agent: 'FooBot' } }
|
29
29
|
|
30
|
-
it
|
31
|
-
expect(subject[:args]).to include(
|
30
|
+
it 'includes it as --user-agent in the chrome arguments' do
|
31
|
+
expect(subject[:args]).to include('--user-agent=FooBot')
|
32
32
|
end
|
33
33
|
end
|
34
34
|
end
|
@@ -1,11 +1,11 @@
|
|
1
|
-
require
|
1
|
+
require 'spec_helper'
|
2
2
|
|
3
3
|
module MediawikiSelenium::BrowserFactory
|
4
4
|
describe Firefox do
|
5
5
|
let(:factory_class) { Firefox }
|
6
6
|
let(:factory) { factory_class.new(:firefox) }
|
7
7
|
|
8
|
-
describe
|
8
|
+
describe '.default_bindings' do
|
9
9
|
subject { factory_class.default_bindings }
|
10
10
|
|
11
11
|
it { is_expected.to include(:browser_language) }
|
@@ -13,7 +13,7 @@ module MediawikiSelenium::BrowserFactory
|
|
13
13
|
it { is_expected.to include(:browser_user_agent) }
|
14
14
|
end
|
15
15
|
|
16
|
-
describe
|
16
|
+
describe '#browser_options' do
|
17
17
|
subject { factory.browser_options(config) }
|
18
18
|
|
19
19
|
let(:profile) { double(Selenium::WebDriver::Firefox::Profile) }
|
@@ -22,36 +22,36 @@ module MediawikiSelenium::BrowserFactory
|
|
22
22
|
expect(Selenium::WebDriver::Firefox::Profile).to receive(:new).and_return(profile)
|
23
23
|
end
|
24
24
|
|
25
|
-
context
|
26
|
-
let(:config) { { browser_timeout:
|
25
|
+
context 'given a custom browser_timeout' do
|
26
|
+
let(:config) { { browser_timeout: '30' } }
|
27
27
|
|
28
|
-
it
|
29
|
-
expect(profile).to receive(:[]=).with(
|
28
|
+
it 'sets dom.max_script_run_time to the given number' do
|
29
|
+
expect(profile).to receive(:[]=).with('dom.max_script_run_time', 30)
|
30
30
|
allow(profile).to receive(:[]=)
|
31
31
|
subject
|
32
32
|
end
|
33
33
|
|
34
|
-
it
|
35
|
-
expect(profile).to receive(:[]=).with(
|
34
|
+
it 'sets dom.max_chrome_script_run_time to the given number' do
|
35
|
+
expect(profile).to receive(:[]=).with('dom.max_chrome_script_run_time', 30)
|
36
36
|
allow(profile).to receive(:[]=)
|
37
37
|
subject
|
38
38
|
end
|
39
39
|
end
|
40
40
|
|
41
|
-
context
|
42
|
-
let(:config) { { browser_language:
|
41
|
+
context 'given a custom browser_language' do
|
42
|
+
let(:config) { { browser_language: 'eo' } }
|
43
43
|
|
44
|
-
it
|
45
|
-
expect(profile).to receive(:[]=).with(
|
44
|
+
it 'sets intl.accept_languages to the given language' do
|
45
|
+
expect(profile).to receive(:[]=).with('intl.accept_languages', 'eo')
|
46
46
|
subject
|
47
47
|
end
|
48
48
|
end
|
49
49
|
|
50
|
-
context
|
51
|
-
let(:config) { { browser_user_agent:
|
50
|
+
context 'given a custom browser_user_agent' do
|
51
|
+
let(:config) { { browser_user_agent: 'FooBot' } }
|
52
52
|
|
53
|
-
it
|
54
|
-
expect(profile).to receive(:[]=).with(
|
53
|
+
it 'sets general.useragent.override to the given string' do
|
54
|
+
expect(profile).to receive(:[]=).with('general.useragent.override', 'FooBot')
|
55
55
|
subject
|
56
56
|
end
|
57
57
|
end
|
@@ -1,11 +1,11 @@
|
|
1
|
-
require
|
1
|
+
require 'spec_helper'
|
2
2
|
|
3
3
|
module MediawikiSelenium::BrowserFactory
|
4
4
|
describe Phantomjs do
|
5
5
|
let(:factory_class) { Phantomjs }
|
6
6
|
let(:factory) { factory_class.new(:phantomjs) }
|
7
7
|
|
8
|
-
describe
|
8
|
+
describe '.default_bindings' do
|
9
9
|
subject { factory_class.default_bindings }
|
10
10
|
|
11
11
|
it { is_expected.to include(:browser_language) }
|
@@ -13,24 +13,24 @@ module MediawikiSelenium::BrowserFactory
|
|
13
13
|
it { is_expected.to include(:browser_user_agent) }
|
14
14
|
end
|
15
15
|
|
16
|
-
describe
|
16
|
+
describe '#browser_options' do
|
17
17
|
subject { factory.browser_options(config) }
|
18
18
|
|
19
|
-
context
|
20
|
-
let(:config) { { browser_language:
|
19
|
+
context 'given a custom browser_language' do
|
20
|
+
let(:config) { { browser_language: 'eo' } }
|
21
21
|
|
22
|
-
it
|
22
|
+
it 'sets phantomjs.page.customHeaders.Accept-Language to the given language' do
|
23
23
|
capabilities = subject[:desired_capabilities]
|
24
|
-
expect(capabilities[
|
24
|
+
expect(capabilities['phantomjs.page.customHeaders.Accept-Language']).to eq('eo')
|
25
25
|
end
|
26
26
|
end
|
27
27
|
|
28
|
-
context
|
29
|
-
let(:config) { { browser_user_agent:
|
28
|
+
context 'given a custom browser_user_agent' do
|
29
|
+
let(:config) { { browser_user_agent: 'FooBot' } }
|
30
30
|
|
31
|
-
it
|
31
|
+
it 'sets phantomjs.page.settings.userAgent to the given string' do
|
32
32
|
capabilities = subject[:desired_capabilities]
|
33
|
-
expect(capabilities[
|
33
|
+
expect(capabilities['phantomjs.page.settings.userAgent']).to eq('FooBot')
|
34
34
|
end
|
35
35
|
end
|
36
36
|
end
|