iCuke 0.4.9 → 0.4.10

Sign up to get free protection for your applications and to get access to all the features.
data/History.txt CHANGED
@@ -1,3 +1,9 @@
1
+ == 0.4.10 (2010-04-23)
2
+
3
+ == Features
4
+ * Add "within" support to "should see" steps
5
+ * Print full UI hierarchy to allow for more powerful tests
6
+
1
7
  == 0.4.8 (2010-04-22)
2
8
 
3
9
  === Stability
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.4.9
1
+ 0.4.10
data/ext/iCuke/Viewer.m CHANGED
@@ -22,27 +22,29 @@ static Viewer *sharedViewer = nil;
22
22
 
23
23
  -(void)appendOpenToXml:(NSMutableString*)xml {
24
24
  [xml appendFormat: @"<%@", NSStringFromClass([self class])];
25
- [self appendTraitsToXml: xml];
26
- if ([[self accessibilityLabel] length] > 0) {
27
- NSString *escaped_label = [self accessibilityLabel];
28
- escaped_label = [escaped_label stringByReplacingOccurrencesOfString: @"&" withString: @"&amp;"];
29
- escaped_label = [escaped_label stringByReplacingOccurrencesOfString: @"'" withString: @"&quot;"];
30
- escaped_label = [escaped_label stringByReplacingOccurrencesOfString: @"\\" withString: @"&#39;"];
31
- escaped_label = [escaped_label stringByReplacingOccurrencesOfString: @">" withString: @"&gt;"];
32
- escaped_label = [escaped_label stringByReplacingOccurrencesOfString: @"<" withString: @"&lt;"];
33
- [xml appendFormat: @"label=\"%@\" ", escaped_label];
34
- }
35
- if ([[self accessibilityHint] length] > 0) {
36
- [xml appendFormat: @"hint=\"%@\" ", [self accessibilityHint]];
37
- }
38
- if ([[self accessibilityValue] length] > 0) {
39
- NSString *escaped_value = [self accessibilityValue];
40
- escaped_value = [escaped_value stringByReplacingOccurrencesOfString: @"&" withString: @"&amp;"];
41
- escaped_value = [escaped_value stringByReplacingOccurrencesOfString: @"'" withString: @"&quot;"];
42
- escaped_value = [escaped_value stringByReplacingOccurrencesOfString: @"\\" withString: @"&#39;"];
43
- escaped_value = [escaped_value stringByReplacingOccurrencesOfString: @">" withString: @"&gt;"];
44
- escaped_value = [escaped_value stringByReplacingOccurrencesOfString: @"<" withString: @"&lt;"];
45
- [xml appendFormat: @"value=\"%@\" ", escaped_value];
25
+ if ([self isAccessibilityElement]) {
26
+ [self appendTraitsToXml: xml];
27
+ if ([[self accessibilityLabel] length] > 0) {
28
+ NSString *escaped_label = [self accessibilityLabel];
29
+ escaped_label = [escaped_label stringByReplacingOccurrencesOfString: @"&" withString: @"&amp;"];
30
+ escaped_label = [escaped_label stringByReplacingOccurrencesOfString: @"'" withString: @"&quot;"];
31
+ escaped_label = [escaped_label stringByReplacingOccurrencesOfString: @"\\" withString: @"&#39;"];
32
+ escaped_label = [escaped_label stringByReplacingOccurrencesOfString: @">" withString: @"&gt;"];
33
+ escaped_label = [escaped_label stringByReplacingOccurrencesOfString: @"<" withString: @"&lt;"];
34
+ [xml appendFormat: @"label=\"%@\" ", escaped_label];
35
+ }
36
+ if ([[self accessibilityHint] length] > 0) {
37
+ [xml appendFormat: @"hint=\"%@\" ", [self accessibilityHint]];
38
+ }
39
+ if ([[self accessibilityValue] length] > 0) {
40
+ NSString *escaped_value = [self accessibilityValue];
41
+ escaped_value = [escaped_value stringByReplacingOccurrencesOfString: @"&" withString: @"&amp;"];
42
+ escaped_value = [escaped_value stringByReplacingOccurrencesOfString: @"'" withString: @"&quot;"];
43
+ escaped_value = [escaped_value stringByReplacingOccurrencesOfString: @"\\" withString: @"&#39;"];
44
+ escaped_value = [escaped_value stringByReplacingOccurrencesOfString: @">" withString: @"&gt;"];
45
+ escaped_value = [escaped_value stringByReplacingOccurrencesOfString: @"<" withString: @"&lt;"];
46
+ [xml appendFormat: @"value=\"%@\" ", escaped_value];
47
+ }
46
48
  }
47
49
  [xml appendString: @">"];
48
50
  }
@@ -123,8 +125,9 @@ static Viewer *sharedViewer = nil;
123
125
  @implementation UIView (Viewer)
124
126
 
125
127
  -(void)appendToXml:(NSMutableString *)xml {
128
+ [self appendOpenToXml: xml];
129
+
126
130
  if ([self isAccessibilityElement]) {
127
- [self appendOpenToXml: xml];
128
131
  [self appendFrameToXml: xml];
129
132
  }
130
133
 
@@ -133,10 +136,7 @@ static Viewer *sharedViewer = nil;
133
136
  }
134
137
 
135
138
  [self appendChildrenToXml: xml];
136
-
137
- if ([self isAccessibilityElement]) {
138
- [self appendCloseToXml: xml];
139
- }
139
+ [self appendCloseToXml: xml];
140
140
  }
141
141
 
142
142
  @end
Binary file
data/iCuke.gemspec CHANGED
@@ -5,11 +5,11 @@
5
5
 
6
6
  Gem::Specification.new do |s|
7
7
  s.name = %q{iCuke}
8
- s.version = "0.4.9"
8
+ s.version = "0.4.10"
9
9
 
10
10
  s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
11
11
  s.authors = ["Rob Holland"]
12
- s.date = %q{2010-04-22}
12
+ s.date = %q{2010-04-23}
13
13
  s.description = %q{Cucumber support for iPhone applications}
14
14
  s.email = %q{rob@the-it-refinery.co.uk}
15
15
  s.extensions = ["ext/iCuke/Rakefile"]
@@ -32,8 +32,8 @@ class ICukeWorld
32
32
  @simulator.record
33
33
  end
34
34
 
35
- def can_see?(text)
36
- page.xpath(%Q{//*[contains(., "#{text}") or contains(@label, "#{text}") or contains(@value, "#{text}")]}).any?
35
+ def can_see?(text, scope = '')
36
+ page.xpath(%Q{#{scope}//*[contains(., "#{text}") or contains(@label, "#{text}") or contains(@value, "#{text}")]}).any?
37
37
  end
38
38
 
39
39
  def onscreen?(x, y)
@@ -178,12 +178,12 @@ Given /^(?:"([^\"]*)" from )?"([^\"]*)" is loaded in the simulator(?: using sdk
178
178
  :env => { 'DYLD_INSERT_LIBRARIES' => LIBICUKE }
179
179
  end
180
180
 
181
- Then /^I should see "([^\"]*)"$/ do |text|
182
- raise %Q{Content "#{text}" not found in: #{response}} unless can_see?(text)
181
+ Then /^I should see "([^\"]*)"(?: within "([^\"]*)")?$/ do |text, scope|
182
+ raise %Q{Content "#{text}" not found in: #{response}} unless can_see?(text, scope)
183
183
  end
184
184
 
185
- Then /^I should not see "([^\"]*)"$/ do |text|
186
- raise %Q{Content "#{text}" was found but was not expected in: #{response}} if can_see?(text)
185
+ Then /^I should not see "([^\"]*)"(?: within "([^\"]*)")?$/ do |text, scope|
186
+ raise %Q{Content "#{text}" was found but was not expected in: #{response}} if can_see?(text, scope)
187
187
  end
188
188
 
189
189
  When /^I tap "([^\"]*)"$/ do |label|
metadata CHANGED
@@ -5,8 +5,8 @@ version: !ruby/object:Gem::Version
5
5
  segments:
6
6
  - 0
7
7
  - 4
8
- - 9
9
- version: 0.4.9
8
+ - 10
9
+ version: 0.4.10
10
10
  platform: ruby
11
11
  authors:
12
12
  - Rob Holland
@@ -14,7 +14,7 @@ autorequire:
14
14
  bindir: bin
15
15
  cert_chain: []
16
16
 
17
- date: 2010-04-22 00:00:00 +01:00
17
+ date: 2010-04-23 00:00:00 +01:00
18
18
  default_executable:
19
19
  dependencies:
20
20
  - !ruby/object:Gem::Dependency