cuesmash 0.4.0 → 0.4.1

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 9f5afcc77195c37550088258b91cc798effe35cd
4
- data.tar.gz: 82a4396920644a9287d48c21f9fd586f4d3a3bd8
3
+ metadata.gz: 64fb64cfd64a715d20a245bdd11dab76d43a4d80
4
+ data.tar.gz: 4698fac6718292286666145a5d374ad9e3d93c06
5
5
  SHA512:
6
- metadata.gz: d45d408c5e264941d3008790e599cf56cc352bc6c80ca4da8c2cc450289e8aca887362076a64591d3914f757011ce509fe01b35dfc3c180647a977566972b734
7
- data.tar.gz: 77d98e64e724916e0a8098a446d66d78f943aacd4d4230250f659fffaf1a40995d7b931f030a46287ff35cd2c8153733fd0806b019abca9301651c850a58a9d0
6
+ metadata.gz: fda9f12a26e4f467fdc4fee22e384aa67c53e02be418cdb44da9113f0802f030e1388a2783146e7e33e7a5d2b07fe26dcb3eb755bc91967cda780493ff31c2d6
7
+ data.tar.gz: b41ec3fc8e42f9ef94ed99062e1abe6a5e5145e22b31df294fd21ed129acc4bbe1b388024b06a01ed9ad85080a65b5de612581a7558368fd8ea26925ad4dd5d1
data/.cuesmash.yml CHANGED
@@ -24,7 +24,7 @@ default:
24
24
  os: iPhone 6
25
25
  version: 8.3
26
26
  test_timeout: 120
27
- uuid: 'bd79098904d9b93a418ac821db8372ee7374cf82'
27
+ udid: 'bd79098904d9b93a418ac821db8372ee7374cf82'
28
28
 
29
29
  platform: 'iOS'
30
30
  build_configuration: 'Debug'
data/.travis.yml CHANGED
@@ -1,7 +1,8 @@
1
1
  language: ruby
2
2
  rvm:
3
- - 2.1.2
3
+ - 2.2.2
4
4
  script: bundle exec rspec spec
5
5
  notifications:
6
6
  email:
7
7
  - jarod@ustwo.com
8
+ sudo: false
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- cuesmash (0.4.0)
4
+ cuesmash (0.4.1)
5
5
  rest-client (~> 1.7.2)
6
6
  thor (>= 0.19.1)
7
7
  xcpretty (>= 0.1.10)
@@ -36,7 +36,7 @@ GEM
36
36
  rb-inotify (>= 0.9)
37
37
  lumberjack (1.0.9)
38
38
  method_source (0.8.2)
39
- mime-types (2.4.3)
39
+ mime-types (2.6.1)
40
40
  netrc (0.10.3)
41
41
  pry (0.10.1)
42
42
  coderay (~> 1.1.0)
@@ -87,4 +87,4 @@ DEPENDENCIES
87
87
  simplecov (~> 0.10.0)
88
88
 
89
89
  BUNDLED WITH
90
- 1.10.4
90
+ 1.10.5
data/cuesmash.gemspec CHANGED
@@ -4,7 +4,7 @@ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
4
4
 
5
5
  Gem::Specification.new do |spec|
6
6
  spec.name = "cuesmash"
7
- spec.version = "0.4.0"
7
+ spec.version = "0.4.1"
8
8
  spec.authors = ["Alex Fish", "Jarod McBride", "Tiago Castro"]
9
9
  spec.email = ["fish@ustwo.co.uk", "jarod@ustwo.com", "castro@ustwo.com"]
10
10
  spec.description = "Appium project manager"
@@ -14,37 +14,29 @@ module Cuesmash
14
14
  # Public: the output format for the tests
15
15
  attr_accessor :format
16
16
 
17
- # Public: uuid of ios device to run test on.
18
- attr_accessor :ios_uuid
19
-
20
- #
21
- # Create a new instance of AppiumServer
22
- #
23
- def initialize(ios_uuid: nil)
24
- @ios_uuid = ios_uuid
25
- end
26
-
27
17
  #
28
18
  # Run the appium server
29
19
  #
30
20
  def start_server
31
21
  started
32
22
 
33
- command = 'appium --log-level debug '
34
- command << "--udid #{@ios_uuid} --session-override " unless @ios_uuid.nil?
23
+ command = 'appium --log-level debug'
35
24
 
36
25
  @stdin, @stdout, @stderr, @wait_thr = Open3.popen3(command)
37
- Logger.info "Appium running with pid: #{@wait_thr.pid}"
26
+ Logger.info "Appium started with pid: #{@wait_thr.pid}"
38
27
 
39
28
  if Logger.debug?
40
29
  [@stdout, @stderr].each do |stream|
41
30
  Thread.new do
42
31
  until (line = stream.gets).nil?
43
- Logger.debug line
32
+ Logger.debug "[Appium] #{line}"
44
33
  end
45
34
  end
46
35
  end
47
36
  end
37
+ # looks like the we need to wait for the service to start up
38
+ # This isn't good, we should create a check to verify first.
39
+ sleep 3
48
40
  end
49
41
 
50
42
  #
@@ -14,6 +14,7 @@ module Cuesmash
14
14
  attr_accessor :device_name
15
15
  attr_accessor :new_command_timeout
16
16
  attr_accessor :appium_text_for_file
17
+ attr_accessor :udid
17
18
 
18
19
  #
19
20
  # Create a new appium_text instance. These params are based off the appium.txt
@@ -25,12 +26,13 @@ module Cuesmash
25
26
  # @param app [String] path to built .app file
26
27
  #
27
28
  # @return [AppiumText] A appiumtext instance
28
- def initialize(platform_name:, device_name:, platform_version: nil, app:, new_command_timeout: 60)
29
+ def initialize(platform_name:, device_name:, platform_version: nil, app:, new_command_timeout: 60, udid: nil)
29
30
  @platform_name = platform_name
30
31
  @device_name = device_name
31
32
  @platform_version = platform_version
32
33
  @app = app
33
34
  @new_command_timeout = new_command_timeout
35
+ @udid = udid
34
36
  end
35
37
 
36
38
  def execute
@@ -66,6 +68,7 @@ module Cuesmash
66
68
  text << "platformVersion = \"#{platform_version}\"\n" unless platform_version.nil?
67
69
  text << "app = \"#{app}\"\n"
68
70
  text << "newCommandTimeout = \"#{new_command_timeout}\"\n"
71
+ text << "udid = \"#{udid}\"\n" unless udid.nil?
69
72
  Logger.debug "appium.text == #{text}"
70
73
  text
71
74
  end
@@ -37,7 +37,7 @@ module Cuesmash
37
37
  profile:,
38
38
  quiet: false,
39
39
  timeout:,
40
- ios_uuid: nil)
40
+ ios_udid: nil)
41
41
  if debug
42
42
  Logger.level = ::Logger::DEBUG
43
43
  Logger.formatter = proc do |serverity, time, _progname, msg|
@@ -45,18 +45,11 @@ module Cuesmash
45
45
  end
46
46
  end
47
47
 
48
- # Update the plist
49
- # update_plist(scheme, app.app_path)
50
-
51
48
  # Update the appium.txt file
52
- create_appium_txt(app: app.app_path, device_name: device, platform_version: os, timeout: timeout)
49
+ create_appium_txt(app: app.app_path, device_name: device, platform_version: os, timeout: timeout, udid: ios_udid)
53
50
 
54
51
  # start the appium server
55
- if @ios_uuid
56
- app_server = AppiumServer.new(ios_uuid: ios_uuid)
57
- else
58
- app_server = AppiumServer.new
59
- end
52
+ app_server = AppiumServer.new
60
53
  app_server.start_server
61
54
 
62
55
  # Run the tests
@@ -92,12 +85,13 @@ module Cuesmash
92
85
  # @param app [String] path to built .app file
93
86
  # @param timeout [String] time in seconds to set the newCommandTimeout to.
94
87
  #
95
- def self.create_appium_txt(platform_name: 'iOS', device_name:, platform_version:, app:, timeout:)
88
+ def self.create_appium_txt(platform_name: 'iOS', device_name:, platform_version:, app:, timeout:, udid: nil)
96
89
  appium = AppiumText.new(platform_name: platform_name,
97
90
  device_name: device_name,
98
91
  platform_version: platform_version,
99
92
  app: app,
100
- new_command_timeout: timeout)
93
+ new_command_timeout: timeout,
94
+ udid: udid)
101
95
  appium.execute
102
96
  end
103
97
  end # class Command
@@ -42,21 +42,18 @@ module Cuesmash
42
42
 
43
43
  status = nil
44
44
 
45
- Logger.debug "cucumber_command == #{command}"
46
-
47
- Open3.popen3 command do |_stdin, out, err, wait_thr|
48
- [out, err].each do |stream|
45
+ Open3.popen3(command) do |_stdin, stdout, stderr, wait_thr|
46
+ [stdout, stderr].each do |stream|
49
47
  Thread.new do
50
48
  until (line = stream.gets).nil?
51
- Logger.info line
49
+ Logger.info "[Cucumber] #{line}"
52
50
  end
53
51
  end
54
52
  end
55
-
56
53
  wait_thr.join
57
54
  status = wait_thr.value.exitstatus
58
55
  end
59
-
56
+
60
57
  if status != 0
61
58
  Logger.info 'Cucumber failed'
62
59
  status
@@ -27,7 +27,7 @@ module Cuesmash
27
27
  # @param [String] file_name: This usually is the scheme of the xcode project
28
28
  # @param [String] build_configuration: which iOS build configuration to run i.e. Release, Debug
29
29
  # @param [String] app_name: name of the app
30
- # @param [String] device: nil the UUID of the device to run on or nil if running on simulator
30
+ # @param [String] device: nil the UDID of the device to run on or nil if running on simulator
31
31
  #
32
32
  def initialize(file_name:, build_configuration:, app_name:, device: nil)
33
33
  app_name = file_name if app_name.nil?
@@ -67,10 +67,10 @@ module Cuesmash
67
67
  if @config['platform'] == 'iOS'
68
68
  # enumerate over each device / OS combination and run the tests.
69
69
  @config['devices'].each do |device, oses|
70
- oses.each do |os_number, ios_uuid|
71
- setup_ios(device: ios_uuid)
70
+ oses.each do |os_number, ios_udid|
71
+ setup_ios(device: ios_udid)
72
72
  case
73
- when ios_uuid.nil?
73
+ when ios_udid.nil?
74
74
  say "\n============================\ntesting iOS #{os_number} on #{device}", :green
75
75
  Cuesmash::Command.execute(device: device,
76
76
  os: os_number,
@@ -92,7 +92,7 @@ module Cuesmash
92
92
  profile: options[:profile],
93
93
  quiet: options[:quiet],
94
94
  timeout: @config['default']['test_timeout'].to_s,
95
- ios_uuid: @config)
95
+ ios_udid: ios_udid)
96
96
  end # case
97
97
  end # os each
98
98
  end # device each
@@ -164,7 +164,7 @@ module Cuesmash
164
164
  end
165
165
 
166
166
  if @config['platform'] == 'iOS'
167
- setup_ios(device: @config['default']['uuid'])
167
+ setup_ios(device: @config['default']['udid'])
168
168
  elsif @config['platform'] == 'Android'
169
169
  say 'Setting up android'
170
170
  setup_android
@@ -194,7 +194,7 @@ module Cuesmash
194
194
  #
195
195
  # helper method to setup and compile the iOS app
196
196
  #
197
- # @param [string] device: nil <the UUID of the device to run on or nil if running on simulator>
197
+ # @param [string] device: nil <the UDID of the device to run on or nil if running on simulator>
198
198
  #
199
199
  def setup_ios(device: nil)
200
200
  @app = IosApp.new(file_name: options[:scheme].join(' '),
@@ -235,7 +235,8 @@ module Cuesmash
235
235
  device_name: @config['default']['os'],
236
236
  platform_version: @config['default']['version'].to_s,
237
237
  app: @app.app_path,
238
- new_command_timeout: @config['default']['test_timeout'].to_s)
238
+ new_command_timeout: @config['default']['test_timeout'].to_s,
239
+ udid: @config['default']['udid'])
239
240
  appium.execute
240
241
  end # ios_appium_text
241
242
 
@@ -4,10 +4,10 @@ describe Cuesmash::AppiumText do
4
4
 
5
5
  describe "when creating a new instance" do
6
6
  before(:all) do
7
- @appiumtext = Cuesmash::AppiumText.new(platform_name: "iOS", device_name: "iPhone Simulator", platform_version: "7.1", app: "MyApp", new_command_timeout: "90")
7
+ @appiumtext = Cuesmash::AppiumText.new(platform_name: "iOS", device_name: "iPhone Simulator", platform_version: "7.1", app: "MyApp", new_command_timeout: "90", udid: "XXXX")
8
8
  end
9
9
 
10
- expected = "[caps]\nplatformName = \"iOS\"\ndeviceName = \"iPhone Simulator\"\nplatformVersion = \"7.1\"\napp = \"MyApp\"\nnewCommandTimeout = \"90\"\n"
10
+ expected = "[caps]\nplatformName = \"iOS\"\ndeviceName = \"iPhone Simulator\"\nplatformVersion = \"7.1\"\napp = \"MyApp\"\nnewCommandTimeout = \"90\"\nudid = \"XXXX\"\n"
11
11
 
12
12
  it "should have a platform name" do
13
13
  expect(@appiumtext.platform_name).to match("iOS")
@@ -1,105 +1,82 @@
1
1
  require 'spec_helper'
2
2
 
3
3
  describe Cuesmash::Cucumber do
4
-
5
4
  before(:each) do
6
5
  Cuesmash::Cucumber.any_instance.stub(:puts)
7
6
  end
8
7
 
9
- describe "when running the tests" do
10
-
11
- before(:each) do
12
- wait = double
13
- @value = double
14
- wait.stub(:value){@value}
15
- wait.stub(:join)
16
- Open3.stub(:popen3).and_yield(nil, nil, nil, wait)
17
-
18
- @cucumber = Cuesmash::Cucumber.new(nil, nil, nil)
19
- @cucumber.stub(:command)
20
- end
21
-
22
- it "should complete if all is well" do
23
- @value.stub(:exitstatus){0}
24
- @cucumber.should_receive(:completed)
25
- @cucumber.test
26
- end
27
- end
28
-
29
- describe "when generating the command" do
30
-
31
- it "should not add the ios version if missing" do
8
+ describe 'when generating the command' do
9
+ it 'should not add the ios version if missing' do
32
10
  @cucumber = Cuesmash::Cucumber.new(nil, nil, nil)
33
11
  @cucumber.stub(:tag_arguments)
34
12
 
35
- expect(@cucumber.instance_eval{command}).not_to match(/DEVICE_TARGET/)
13
+ expect(@cucumber.instance_eval { command }).not_to match(/DEVICE_TARGET/)
36
14
  end
37
15
 
38
- it "should add the format" do
16
+ it 'should add the format' do
39
17
  @cucumber = Cuesmash::Cucumber.new(nil, nil, nil)
40
- @cucumber.format = "test-format"
18
+ @cucumber.format = 'test-format'
41
19
 
42
- expect(@cucumber.instance_eval{command}).to match(/--format test-format/)
20
+ expect(@cucumber.instance_eval { command }).to match(/--format test-format/)
43
21
  end
44
22
 
45
- it "should not add the format if missing" do
23
+ it 'should not add the format if missing' do
46
24
  @cucumber = Cuesmash::Cucumber.new(nil, nil, nil)
47
25
 
48
- expect(@cucumber.instance_eval{command}).not_to match(/--format/)
26
+ expect(@cucumber.instance_eval { command }).not_to match(/--format/)
49
27
  end
50
28
 
51
- it "should add the output" do
29
+ it 'should add the output' do
52
30
  @cucumber = Cuesmash::Cucumber.new(nil, nil, nil)
53
- @cucumber.output = "test-output"
31
+ @cucumber.output = 'test-output'
54
32
 
55
- expect(@cucumber.instance_eval{command}).to match(/--out test-output/)
33
+ expect(@cucumber.instance_eval { command }).to match(/--out test-output/)
56
34
  end
57
35
 
58
- it "should not add the output if missing" do
36
+ it 'should not add the output if missing' do
59
37
  @cucumber = Cuesmash::Cucumber.new(nil, nil, nil)
60
38
 
61
- expect(@cucumber.instance_eval{command}).not_to match(/--out/)
39
+ expect(@cucumber.instance_eval { command }).not_to match(/--out/)
62
40
  end
63
41
 
64
- it "should add the tags" do
65
- @cucumber = Cuesmash::Cucumber.new(["tag1", "tag2"], nil, nil)
66
- expect(@cucumber.instance_eval{command}).to match(/--tags tag1 --tags tag2/)
42
+ it 'should add the tags' do
43
+ @cucumber = Cuesmash::Cucumber.new(['tag1', 'tag2'], nil, nil)
44
+ expect(@cucumber.instance_eval { command }).to match(/--tags tag1 --tags tag2/)
67
45
  end
68
46
 
69
- it "should not add tags if missing" do
47
+ it 'should not add tags if missing' do
70
48
  @cucumber = Cuesmash::Cucumber.new(nil, nil, nil)
71
- expect(@cucumber.instance_eval{command}).not_to match(/--tags/)
49
+ expect(@cucumber.instance_eval { command }).not_to match(/--tags/)
72
50
  end
73
51
 
74
- it "should add the profile" do
75
- @cucumber = Cuesmash::Cucumber.new(nil, "test", nil)
76
- expect(@cucumber.instance_eval{command}).to match(/--profile test/)
52
+ it 'should add the profile' do
53
+ @cucumber = Cuesmash::Cucumber.new(nil, 'test', nil)
54
+ expect(@cucumber.instance_eval { command }).to match(/--profile test/)
77
55
  end
78
56
 
79
- it "should not add tags if missing" do
57
+ it 'should not add tags if missing' do
80
58
  @cucumber = Cuesmash::Cucumber.new(nil, nil, nil)
81
- expect(@cucumber.instance_eval{command}).not_to match(/--profile/)
59
+ expect(@cucumber.instance_eval { command }).not_to match(/--profile/)
82
60
  end
83
61
 
84
- it "should add the color flag" do
62
+ it 'should add the color flag' do
85
63
  @cucumber = Cuesmash::Cucumber.new(nil, nil, nil)
86
- expect(@cucumber.instance_eval{command}).to match(/-c/)
64
+ expect(@cucumber.instance_eval { command }).to match(/-c/)
87
65
  end
88
66
 
89
- it "should not add quiet if missing" do
67
+ it 'should not add quiet if missing' do
90
68
  @cucumber = Cuesmash::Cucumber.new(nil, nil, nil)
91
- expect(@cucumber.instance_eval{command}).not_to match(/--quiet/)
69
+ expect(@cucumber.instance_eval { command }).not_to match(/--quiet/)
92
70
  end
93
71
 
94
- it "should not add quiet if false" do
72
+ it 'should not add quiet if false' do
95
73
  @cucumber = Cuesmash::Cucumber.new(nil, nil, false)
96
- expect(@cucumber.instance_eval{command}).not_to match(/--quiet/)
74
+ expect(@cucumber.instance_eval { command }).not_to match(/--quiet/)
97
75
  end
98
76
 
99
- it "should add the quiet flag" do
77
+ it 'should add the quiet flag' do
100
78
  @cucumber = Cuesmash::Cucumber.new(nil, nil, true)
101
- expect(@cucumber.instance_eval{command}).to match(/--quiet/)
79
+ expect(@cucumber.instance_eval { command }).to match(/--quiet/)
102
80
  end
103
-
104
81
  end
105
82
  end
data/spec/test.json CHANGED
@@ -1 +1 @@
1
- {"url_preference":"10.1.20.99","port_preference":"4567"}
1
+ {"url_preference":"10.1.19.106","port_preference":"4567"}
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: cuesmash
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.4.0
4
+ version: 0.4.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Alex Fish
@@ -10,7 +10,7 @@ authors:
10
10
  autorequire:
11
11
  bindir: bin
12
12
  cert_chain: []
13
- date: 2015-07-13 00:00:00.000000000 Z
13
+ date: 2015-07-31 00:00:00.000000000 Z
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
16
16
  name: bundler