mixpaneltesting 0.1.1 → 0.1.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/lib/mixpaneltesting/docker.rb +1 -2
- data/lib/mixpaneltesting/rspec_context.rb +102 -0
- data/lib/mixpaneltesting/version.rb +1 -1
- metadata +6 -5
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 0254f63cb492832e7b24f883dec010ed7220b935
|
4
|
+
data.tar.gz: 2c62e90cffdb92dc1ab37f83cef85d872619a412
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: a37159b027ec43c252015afd4ca38e007273b5b41dbc4f82213bdb1e8451be6465ca13e3bf1c419a42c48e3805b67b25a6c717efb6729ebd2b107e2f88a920f8
|
7
|
+
data.tar.gz: b012720a1914ea09d4179e0cde747fa60997e499096f6c107bd7d01e20959dfc81e186bb310d5fa1c945a8ef8ccf1e4f04c0c609d81d5a6a7d9e28a962bd65e4
|
@@ -0,0 +1,102 @@
|
|
1
|
+
require 'rspec'
|
2
|
+
require 'rspec/expectations'
|
3
|
+
|
4
|
+
|
5
|
+
RSpec.configure do |config|
|
6
|
+
|
7
|
+
[
|
8
|
+
:mixpanelsettings,
|
9
|
+
:mixpanelfilesettings,
|
10
|
+
:docker,
|
11
|
+
:selenium,
|
12
|
+
:mixpanel,
|
13
|
+
:localsite,
|
14
|
+
:appurl
|
15
|
+
].each do |item|
|
16
|
+
config.add_setting item
|
17
|
+
end
|
18
|
+
|
19
|
+
config.before(:suite) do
|
20
|
+
# Crazy yaml/erb/file reader
|
21
|
+
log = Logger.new(STDOUT)
|
22
|
+
settings = MixpanelTesting::Settings.load_settings(
|
23
|
+
RSpec.configuration.mixpanelfilesettings
|
24
|
+
)
|
25
|
+
|
26
|
+
if settings['execute_mode'] == 'docker'
|
27
|
+
docker = MixpanelTesting::DockerProvider.new(
|
28
|
+
settings['docker']['browser'],
|
29
|
+
settings['docker']['selenium_version'] || '2.46.0',
|
30
|
+
settings['docker']['debug'] || false
|
31
|
+
)
|
32
|
+
docker.start
|
33
|
+
end
|
34
|
+
|
35
|
+
appurl = settings['app']['url']
|
36
|
+
log.info "LOCAL URL #{appurl}"
|
37
|
+
if settings['app']['run_local']
|
38
|
+
localsite = MixpanelTesting::LocalSiteProvider.new(
|
39
|
+
settings['app']['run_local'], appurl)
|
40
|
+
localsite.start
|
41
|
+
log.info "site started"
|
42
|
+
end
|
43
|
+
|
44
|
+
RSpec.configuration.mixpanelsettings = settings
|
45
|
+
RSpec.configuration.docker = docker
|
46
|
+
RSpec.configuration.localsite = localsite
|
47
|
+
RSpec.configuration.appurl = appurl
|
48
|
+
end
|
49
|
+
|
50
|
+
config.before(:example) do
|
51
|
+
puts "selenium connection"
|
52
|
+
if RSpec.configuration.docker
|
53
|
+
selenium_browser = (
|
54
|
+
RSpec.configuration.mixpanelsettings['docker']['browser'] == 'firefox' ?
|
55
|
+
:firefox : :chrome
|
56
|
+
)
|
57
|
+
selenium = MixpanelTesting::SeleniumProvider.new(
|
58
|
+
RSpec.configuration.docker.selenium_uri, selenium_browser
|
59
|
+
)
|
60
|
+
else
|
61
|
+
selector = (RSpec.configuration.mixpanelsettings['execute_mode'] ==
|
62
|
+
'browserstack' ?
|
63
|
+
'browserstack' : 'selenium')
|
64
|
+
selenium_settings = RSpec.configuration.mixpanelsettings[selector]
|
65
|
+
puts selenium_settings
|
66
|
+
selenium = MixpanelTesting::SeleniumProvider.new(
|
67
|
+
selenium_settings['selenium_uri'],
|
68
|
+
selenium_settings['capabilities'])
|
69
|
+
end
|
70
|
+
|
71
|
+
selenium.connect!
|
72
|
+
selenium.start_session RSpec.configuration.appurl
|
73
|
+
mixpanel = MixpanelTesting::MixpanelProvider.new selenium.session_id
|
74
|
+
|
75
|
+
RSpec.configuration.selenium = selenium
|
76
|
+
RSpec.configuration.mixpanel = mixpanel
|
77
|
+
end
|
78
|
+
|
79
|
+
config.after(:example) do
|
80
|
+
# We don't need this using selenium session cache per example
|
81
|
+
# RSpec.configuration.selenium.end_session
|
82
|
+
RSpec.configuration.selenium.quit
|
83
|
+
end
|
84
|
+
|
85
|
+
config.after(:suite) do
|
86
|
+
RSpec.configuration.docker.kill unless RSpec.configuration.docker.nil?
|
87
|
+
RSpec.configuration.localsite.kill unless RSpec.configuration.localsite.nil?
|
88
|
+
end
|
89
|
+
|
90
|
+
end
|
91
|
+
|
92
|
+
RSpec.shared_context "mixpaneltesting" do
|
93
|
+
before(:each) do
|
94
|
+
@log = Logger.new(STDOUT)
|
95
|
+
@selenium = RSpec.configuration.selenium
|
96
|
+
@docker = RSpec.configuration.docker
|
97
|
+
@localsite = RSpec.configuration.localsite
|
98
|
+
@appurl = RSpec.configuration.appurl
|
99
|
+
@mixpanel = RSpec.configuration.mixpanel
|
100
|
+
@mixpanelsettings = RSpec.configuration.mixpanelsettings
|
101
|
+
end
|
102
|
+
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: mixpaneltesting
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Antonio Perez-Aranda Alcaide
|
@@ -16,28 +16,28 @@ dependencies:
|
|
16
16
|
requirements:
|
17
17
|
- - ">="
|
18
18
|
- !ruby/object:Gem::Version
|
19
|
-
version:
|
19
|
+
version: 2.39.0
|
20
20
|
type: :runtime
|
21
21
|
prerelease: false
|
22
22
|
version_requirements: !ruby/object:Gem::Requirement
|
23
23
|
requirements:
|
24
24
|
- - ">="
|
25
25
|
- !ruby/object:Gem::Version
|
26
|
-
version:
|
26
|
+
version: 2.39.0
|
27
27
|
- !ruby/object:Gem::Dependency
|
28
28
|
name: mixpanel_client
|
29
29
|
requirement: !ruby/object:Gem::Requirement
|
30
30
|
requirements:
|
31
31
|
- - ">="
|
32
32
|
- !ruby/object:Gem::Version
|
33
|
-
version:
|
33
|
+
version: '0'
|
34
34
|
type: :runtime
|
35
35
|
prerelease: false
|
36
36
|
version_requirements: !ruby/object:Gem::Requirement
|
37
37
|
requirements:
|
38
38
|
- - ">="
|
39
39
|
- !ruby/object:Gem::Version
|
40
|
-
version:
|
40
|
+
version: '0'
|
41
41
|
- !ruby/object:Gem::Dependency
|
42
42
|
name: docker-api
|
43
43
|
requirement: !ruby/object:Gem::Requirement
|
@@ -78,6 +78,7 @@ files:
|
|
78
78
|
- lib/mixpaneltesting/docker.rb
|
79
79
|
- lib/mixpaneltesting/localsite.rb
|
80
80
|
- lib/mixpaneltesting/mixpanel.rb
|
81
|
+
- lib/mixpaneltesting/rspec_context.rb
|
81
82
|
- lib/mixpaneltesting/selenium.rb
|
82
83
|
- lib/mixpaneltesting/version.rb
|
83
84
|
homepage: http://rubygems.org/gems/mixpaneltesting
|