rufus 0.5 → 0.6

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.
Files changed (35) hide show
  1. checksums.yaml +8 -8
  2. data/RufusApp/RufusApp.xcodeproj/project.pbxproj +41 -3
  3. data/RufusApp/RufusApp/RUViewController.h +4 -1
  4. data/RufusApp/RufusApp/RUViewController.m +13 -0
  5. data/RufusApp/RufusApp/ScrollChildViewController.h +18 -0
  6. data/RufusApp/RufusApp/ScrollChildViewController.m +24 -0
  7. data/RufusApp/RufusApp/ScrollChildViewController.xib +30 -0
  8. data/RufusApp/RufusApp/ScrollPageViewController.h +13 -0
  9. data/RufusApp/RufusApp/ScrollPageViewController.m +91 -0
  10. data/RufusApp/RufusApp/ScrollPageViewController.xib +20 -0
  11. data/RufusApp/RufusApp/TablePageViewController.h +23 -0
  12. data/RufusApp/RufusApp/TablePageViewController.m +108 -0
  13. data/RufusApp/RufusApp/TablePageViewController.xib +75 -0
  14. data/RufusApp/RufusApp/en.lproj/RUViewController.xib +24 -0
  15. data/features/rufus.feature +12 -0
  16. data/features/scroll.feature +10 -0
  17. data/features/step_definitions/rufus_steps.rb +15 -0
  18. data/features/step_definitions/scroll_steps.rb +6 -0
  19. data/features/step_definitions/table_steps.rb +14 -0
  20. data/features/support/routes.rb +8 -0
  21. data/features/support/screens/home_page.rb +2 -0
  22. data/features/support/screens/scroll_page.rb +11 -0
  23. data/features/support/screens/table_page.rb +14 -0
  24. data/features/table.feature +13 -0
  25. data/features/view.feature +1 -1
  26. data/lib/rufus.rb +21 -0
  27. data/lib/rufus/accessors/accessors.rb +6 -0
  28. data/lib/rufus/accessors/table.rb +49 -0
  29. data/lib/rufus/driver.rb +11 -0
  30. data/rakefile +4 -1
  31. data/rufus.gemspec +1 -1
  32. data/spec/drivers_specs/driver_spec.rb +52 -0
  33. data/spec/rufus_spec.rb +8 -0
  34. data/spec/table_spec.rb +34 -0
  35. metadata +19 -2
checksums.yaml CHANGED
@@ -1,15 +1,15 @@
1
1
  ---
2
2
  !binary "U0hBMQ==":
3
3
  metadata.gz: !binary |-
4
- ZGE1MmQwYzQ3YzA1YTFjZDQzYmJkMzI5OTdlYWJiZTA0MjMxNmEwMw==
4
+ OTRkZjc4ZWVmOGQ0ZTAxMDI2NWJmZWQ4NzY0MzQyYTQ2ZDNjM2IzYw==
5
5
  data.tar.gz: !binary |-
6
- ZDk3OGRlZDVkYjdlOTQ0MTEzNzcyZTYyZjcxOWViOTdkYmNhOTEzNQ==
6
+ MmU5YjNmNmQ1OTdmNjBlN2NkZTY5MGUxNzBhYTdkODZhNjNhYzAyOA==
7
7
  SHA512:
8
8
  metadata.gz: !binary |-
9
- ZWZiZTJkZTBjMzJhMDA0OTAxNWE0NjQyYzlhM2Y3ZDYzMTQ0MmQ1NmE3ZTFl
10
- ZmFhNDQwZDE1YWM5N2I3Mjc2ODBmYjdjMTNjMDY3MDIwNmE0YWYwMjc0ZTA5
11
- MWJlZmIwYzIyZTIwMzk1YjUzYjVmMzZmMjE1YjdjOTE3NWUzNzU=
9
+ ZWEzOTc5ZGJkZjU0ZDY1YzgxZjUxYmI4ZDE1NTc5NzNiMDhmODgzMTNmMTAz
10
+ OWM0Y2Y5MGE1ZmJmYzNmOWVmZjExZjYwMGVlNmEyMzk0OGJiZmMyYzVlZDNm
11
+ MjNmOTI2ODZjNTQ4MTM0YzMzNWY1NTQ5OGE4Yjc3MjQwOTAxMGE=
12
12
  data.tar.gz: !binary |-
13
- NDNjNGRlYjY1ODAwYThkNTQ0ZTQyMmM1ZmVhNDAxMWM4Yjg1MDgzZGMzYjk0
14
- MDllYzJkMzY5Y2FiYzViZWUzNjdhYjIyN2FiZDkzYmMyMTA5ZGQ5MWI0YjBi
15
- MDljYzViMTcyYTA0ZjE2NTQ0YTExNWEwNzQzYWIwZTNhNmJlNTc=
13
+ YzQxMTg5MWVhMDNmN2FhZjNlYjgzZjRkOGQ1MjY5MDJlOThmZGIyMTllYTU1
14
+ YjJmYTU4ZjU5NGU5YTUxYjU5NzlmMGE0YmYwZGIwZGZiNjNlYWJiMzNiYjY4
15
+ NmRkMjUwNDk3MDQxNDQxOGY0ZWJlMGE2ZTJhMjYxNzU0YmJhN2I=
@@ -7,6 +7,12 @@
7
7
  objects = {
8
8
 
9
9
  /* Begin PBXBuildFile section */
10
+ B855BA3D1810E9F000B33F42 /* ScrollChildViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = B855BA3B1810E9F000B33F42 /* ScrollChildViewController.m */; };
11
+ B855BA3E1810E9F000B33F42 /* ScrollChildViewController.xib in Resources */ = {isa = PBXBuildFile; fileRef = B855BA3C1810E9F000B33F42 /* ScrollChildViewController.xib */; };
12
+ B869CCEE1814292E00093724 /* ScrollPageViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = B869CCEC1814292E00093724 /* ScrollPageViewController.m */; };
13
+ B869CCEF1814292E00093724 /* ScrollPageViewController.xib in Resources */ = {isa = PBXBuildFile; fileRef = B869CCED1814292E00093724 /* ScrollPageViewController.xib */; };
14
+ B869CCF31814B62800093724 /* TablePageViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = B869CCF11814B62800093724 /* TablePageViewController.m */; };
15
+ B869CCF41814B62800093724 /* TablePageViewController.xib in Resources */ = {isa = PBXBuildFile; fileRef = B869CCF21814B62800093724 /* TablePageViewController.xib */; };
10
16
  B88C11DE17BD550E00A62E9D /* UIKit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = B88C11DD17BD550E00A62E9D /* UIKit.framework */; };
11
17
  B88C11E017BD550E00A62E9D /* Foundation.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = B88C11DF17BD550E00A62E9D /* Foundation.framework */; };
12
18
  B88C11E217BD550E00A62E9D /* CoreGraphics.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = B88C11E117BD550E00A62E9D /* CoreGraphics.framework */; };
@@ -44,6 +50,15 @@
44
50
  /* End PBXContainerItemProxy section */
45
51
 
46
52
  /* Begin PBXFileReference section */
53
+ B855BA3A1810E9F000B33F42 /* ScrollChildViewController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ScrollChildViewController.h; sourceTree = "<group>"; };
54
+ B855BA3B1810E9F000B33F42 /* ScrollChildViewController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = ScrollChildViewController.m; sourceTree = "<group>"; };
55
+ B855BA3C1810E9F000B33F42 /* ScrollChildViewController.xib */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = file.xib; path = ScrollChildViewController.xib; sourceTree = "<group>"; };
56
+ B869CCEB1814292E00093724 /* ScrollPageViewController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ScrollPageViewController.h; sourceTree = "<group>"; };
57
+ B869CCEC1814292E00093724 /* ScrollPageViewController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = ScrollPageViewController.m; sourceTree = "<group>"; };
58
+ B869CCED1814292E00093724 /* ScrollPageViewController.xib */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = file.xib; path = ScrollPageViewController.xib; sourceTree = "<group>"; };
59
+ B869CCF01814B62800093724 /* TablePageViewController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = TablePageViewController.h; sourceTree = "<group>"; };
60
+ B869CCF11814B62800093724 /* TablePageViewController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = TablePageViewController.m; sourceTree = "<group>"; };
61
+ B869CCF21814B62800093724 /* TablePageViewController.xib */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = file.xib; path = TablePageViewController.xib; sourceTree = "<group>"; };
47
62
  B88C11DA17BD550E00A62E9D /* RufusApp.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = RufusApp.app; sourceTree = BUILT_PRODUCTS_DIR; };
48
63
  B88C11DD17BD550E00A62E9D /* UIKit.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = UIKit.framework; path = System/Library/Frameworks/UIKit.framework; sourceTree = SDKROOT; };
49
64
  B88C11DF17BD550E00A62E9D /* Foundation.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Foundation.framework; path = System/Library/Frameworks/Foundation.framework; sourceTree = SDKROOT; };
@@ -140,9 +155,6 @@
140
155
  B8F2F16D18026FA00037AD69 /* PageObjectControllers */,
141
156
  B88C11EC17BD550E00A62E9D /* RUAppDelegate.h */,
142
157
  B88C11ED17BD550E00A62E9D /* RUAppDelegate.m */,
143
- B88C11F517BD550E00A62E9D /* RUViewController.h */,
144
- B88C11F617BD550E00A62E9D /* RUViewController.m */,
145
- B88C11F817BD550E00A62E9D /* RUViewController.xib */,
146
158
  B88C11E417BD550E00A62E9D /* Supporting Files */,
147
159
  );
148
160
  path = RufusApp;
@@ -181,6 +193,18 @@
181
193
  name = "Supporting Files";
182
194
  sourceTree = "<group>";
183
195
  };
196
+ B8B8FA9A1810FF1B00E3BCA3 /* OtherViewControllers */ = {
197
+ isa = PBXGroup;
198
+ children = (
199
+ B88C11F517BD550E00A62E9D /* RUViewController.h */,
200
+ B88C11F617BD550E00A62E9D /* RUViewController.m */,
201
+ B88C11F817BD550E00A62E9D /* RUViewController.xib */,
202
+ B855BA3A1810E9F000B33F42 /* ScrollChildViewController.h */,
203
+ B855BA3B1810E9F000B33F42 /* ScrollChildViewController.m */,
204
+ );
205
+ name = OtherViewControllers;
206
+ sourceTree = "<group>";
207
+ };
184
208
  B8F2F16D18026FA00037AD69 /* PageObjectControllers */ = {
185
209
  isa = PBXGroup;
186
210
  children = (
@@ -196,6 +220,14 @@
196
220
  B88C121817BD55BB00A62E9D /* RufusPageViewController.h */,
197
221
  B88C121917BD55BB00A62E9D /* RufusPageViewController.m */,
198
222
  B88C121A17BD55BB00A62E9D /* RufusPageViewController.xib */,
223
+ B855BA3C1810E9F000B33F42 /* ScrollChildViewController.xib */,
224
+ B869CCEB1814292E00093724 /* ScrollPageViewController.h */,
225
+ B869CCEC1814292E00093724 /* ScrollPageViewController.m */,
226
+ B869CCED1814292E00093724 /* ScrollPageViewController.xib */,
227
+ B8B8FA9A1810FF1B00E3BCA3 /* OtherViewControllers */,
228
+ B869CCF01814B62800093724 /* TablePageViewController.h */,
229
+ B869CCF11814B62800093724 /* TablePageViewController.m */,
230
+ B869CCF21814B62800093724 /* TablePageViewController.xib */,
199
231
  );
200
232
  name = PageObjectControllers;
201
233
  sourceTree = "<group>";
@@ -272,12 +304,15 @@
272
304
  isa = PBXResourcesBuildPhase;
273
305
  buildActionMask = 2147483647;
274
306
  files = (
307
+ B855BA3E1810E9F000B33F42 /* ScrollChildViewController.xib in Resources */,
275
308
  B88C11E817BD550E00A62E9D /* InfoPlist.strings in Resources */,
276
309
  B88C11F017BD550E00A62E9D /* Default.png in Resources */,
277
310
  B88C11F217BD550E00A62E9D /* Default@2x.png in Resources */,
311
+ B869CCF41814B62800093724 /* TablePageViewController.xib in Resources */,
278
312
  B88C11F417BD550E00A62E9D /* Default-568h@2x.png in Resources */,
279
313
  B88C11FA17BD550E00A62E9D /* RUViewController.xib in Resources */,
280
314
  B8F2F172180270290037AD69 /* EnabledPageViewController.xib in Resources */,
315
+ B869CCEF1814292E00093724 /* ScrollPageViewController.xib in Resources */,
281
316
  B8F2F1771802703D0037AD69 /* DisplayedPageViewController.xib in Resources */,
282
317
  B8F2F16C180255FE0037AD69 /* ExistsPageViewController.xib in Resources */,
283
318
  B88C121C17BD55BB00A62E9D /* RufusPageViewController.xib in Resources */,
@@ -315,9 +350,12 @@
315
350
  isa = PBXSourcesBuildPhase;
316
351
  buildActionMask = 2147483647;
317
352
  files = (
353
+ B855BA3D1810E9F000B33F42 /* ScrollChildViewController.m in Sources */,
318
354
  B88C11EA17BD550E00A62E9D /* main.m in Sources */,
355
+ B869CCF31814B62800093724 /* TablePageViewController.m in Sources */,
319
356
  B88C11EE17BD550E00A62E9D /* RUAppDelegate.m in Sources */,
320
357
  B88C11F717BD550E00A62E9D /* RUViewController.m in Sources */,
358
+ B869CCEE1814292E00093724 /* ScrollPageViewController.m in Sources */,
321
359
  B88C121B17BD55BB00A62E9D /* RufusPageViewController.m in Sources */,
322
360
  B8F2F16B180255FE0037AD69 /* ExistsPageViewController.m in Sources */,
323
361
  B8F2F171180270290037AD69 /* EnabledPageViewController.m in Sources */,
@@ -15,12 +15,15 @@
15
15
  @property (weak, nonatomic) IBOutlet UIButton *showAlertButton;
16
16
  @property (weak, nonatomic) IBOutlet UIButton *rufusButton;
17
17
  @property (weak, nonatomic) IBOutlet UIButton *enabledPageButton;
18
+ @property (weak, nonatomic) IBOutlet UIButton *scrollPageButton;
19
+ @property (weak, nonatomic) IBOutlet UIButton *tablePageButton;
18
20
 
19
21
  - (IBAction)toEnabledPage:(id)sender;
20
22
  - (IBAction)toRufusPage:(id)sender;
21
23
  - (IBAction)showAlert:(id)sender;
22
24
  - (IBAction)toExistsPage:(id)sender;
23
25
  - (IBAction)toDisplayedPage:(id)sender;
24
-
26
+ - (IBAction)toSwipePage:(id)sender;
27
+ - (IBAction)toTablePage:(id)sender;
25
28
 
26
29
  @end
@@ -11,6 +11,9 @@
11
11
  #import "ExistsPageViewController.h"
12
12
  #import "DisplayedPageViewController.h"
13
13
  #import "EnabledPageViewController.h"
14
+ #import "ScrollPageViewController.h"
15
+ #import "TablePageViewController.h"
16
+
14
17
 
15
18
  @interface RUViewController ()
16
19
 
@@ -59,6 +62,16 @@
59
62
  [[self navigationController] pushViewController:displayedPageViewController animated:YES];
60
63
  }
61
64
 
65
+ - (IBAction)toSwipePage:(id)sender {
66
+ ScrollPageViewController *scrollPageViewController = [[ScrollPageViewController alloc] init];
67
+ [[self navigationController] pushViewController:scrollPageViewController animated:YES];
68
+ }
69
+
70
+ - (IBAction)toTablePage:(id)sender {
71
+ TablePageViewController *tablePageViewController = [[TablePageViewController alloc] init];
72
+ [[self navigationController] pushViewController:tablePageViewController animated:YES];
73
+ }
74
+
62
75
  -(void)alertView:(UIAlertView *)alertView clickedButtonAtIndex:(NSInteger)buttonIndex
63
76
  {
64
77
  if (buttonIndex == [alertView cancelButtonIndex])
@@ -0,0 +1,18 @@
1
+ //
2
+ // ScrollPageViewController.h
3
+ // RufusApp
4
+ //
5
+ // Created by Jeremy Stewart on 10/18/13.
6
+ // Copyright (c) 2013 Northwoods. All rights reserved.
7
+ //
8
+
9
+ #import <UIKit/UIKit.h>
10
+
11
+ @interface ScrollChildViewController : UIViewController
12
+
13
+ @property (assign, nonatomic) NSInteger index;
14
+ @property (weak, nonatomic) IBOutlet UILabel *screenNumber;
15
+
16
+ -(void)setIndexLabel:(int) index;
17
+
18
+ @end
@@ -0,0 +1,24 @@
1
+ //
2
+ // ScrollPageViewController.m
3
+ // RufusApp
4
+ //
5
+ // Created by Jeremy Stewart on 10/18/13.
6
+ // Copyright (c) 2013 Northwoods. All rights reserved.
7
+ //
8
+
9
+ #import "ScrollChildViewController.h"
10
+
11
+ @interface ScrollChildViewController ()
12
+
13
+ @end
14
+
15
+ @implementation ScrollChildViewController
16
+ @synthesize screenNumber;
17
+
18
+
19
+ -(void)setIndexLabel:(int) index
20
+ {
21
+ [[self screenNumber] setText:[NSString stringWithFormat:@"Screen #%d", index]];
22
+ }
23
+
24
+ @end
@@ -0,0 +1,30 @@
1
+ <?xml version="1.0" encoding="UTF-8" standalone="no"?>
2
+ <document type="com.apple.InterfaceBuilder3.CocoaTouch.iPad.XIB" version="3.0" toolsVersion="4510" systemVersion="12F45" targetRuntime="iOS.CocoaTouch.iPad" propertyAccessControl="none" useAutolayout="YES">
3
+ <dependencies>
4
+ <plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="3742"/>
5
+ </dependencies>
6
+ <objects>
7
+ <placeholder placeholderIdentifier="IBFilesOwner" id="-1" userLabel="File's Owner" customClass="ScrollChildViewController">
8
+ <connections>
9
+ <outlet property="screenNumber" destination="Xxs-ch-qjw" id="iZf-B6-JX8"/>
10
+ <outlet property="view" destination="2" id="3"/>
11
+ </connections>
12
+ </placeholder>
13
+ <placeholder placeholderIdentifier="IBFirstResponder" id="-2" customClass="UIResponder"/>
14
+ <view clearsContextBeforeDrawing="NO" contentMode="scaleToFill" id="2">
15
+ <rect key="frame" x="0.0" y="0.0" width="768" height="1004"/>
16
+ <autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMaxY="YES"/>
17
+ <subviews>
18
+ <label opaque="NO" clipsSubviews="YES" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" fixedFrame="YES" text="Screen #n" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="Xxs-ch-qjw">
19
+ <rect key="frame" x="290" y="412" width="189" height="61"/>
20
+ <autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMaxY="YES"/>
21
+ <fontDescription key="fontDescription" type="system" pointSize="40"/>
22
+ <color key="textColor" red="1" green="1" blue="1" alpha="1" colorSpace="custom" customColorSpace="calibratedRGB"/>
23
+ <nil key="highlightedColor"/>
24
+ </label>
25
+ </subviews>
26
+ <color key="backgroundColor" white="0.0" alpha="1" colorSpace="calibratedWhite"/>
27
+ <simulatedStatusBarMetrics key="simulatedStatusBarMetrics" statusBarStyle="lightContent"/>
28
+ </view>
29
+ </objects>
30
+ </document>
@@ -0,0 +1,13 @@
1
+ //
2
+ // ScrollPageViewController.h
3
+ // RufusApp
4
+ //
5
+ // Created by Jeremy Stewart on 10/20/13.
6
+ // Copyright (c) 2013 Northwoods. All rights reserved.
7
+ //
8
+
9
+ #import <UIKit/UIKit.h>
10
+
11
+ @interface ScrollPageViewController : UIViewController
12
+
13
+ @end
@@ -0,0 +1,91 @@
1
+ //
2
+ // ScrollPageViewController.m
3
+ // RufusApp
4
+ //
5
+ // Created by Jeremy Stewart on 10/20/13.
6
+ // Copyright (c) 2013 Northwoods. All rights reserved.
7
+ //
8
+
9
+ #import "ScrollPageViewController.h"
10
+ #import "ScrollChildViewController.h"
11
+
12
+ @interface ScrollPageViewController ()
13
+
14
+ @end
15
+
16
+ @implementation ScrollPageViewController
17
+
18
+ - (id)initWithNibName:(NSString *)nibNameOrNil bundle:(NSBundle *)nibBundleOrNil
19
+ {
20
+ self = [super initWithNibName:nibNameOrNil bundle:nibBundleOrNil];
21
+ if (self) {
22
+ // Custom initialization
23
+ }
24
+ return self;
25
+ }
26
+
27
+ - (void)viewDidLoad
28
+ {
29
+ [super viewDidLoad];
30
+ // Do any additional setup after loading the view from its nib.
31
+ }
32
+
33
+ - (void)didReceiveMemoryWarning
34
+ {
35
+ [super didReceiveMemoryWarning];
36
+ // Dispose of any resources that can be recreated.
37
+ }
38
+
39
+ -(void)loadView
40
+ {
41
+ [super loadView];
42
+ UIScrollView *scrollView = [[UIScrollView alloc] initWithFrame:CGRectMake(0, 0, self.view.frame.size.width, self.view.frame.size.height)];
43
+ [scrollView setPagingEnabled:YES];
44
+
45
+ [scrollView addSubview:[self getChildViewForIndex:1]];
46
+ [scrollView addSubview:[self getChildViewForIndex:2]];
47
+ [scrollView addSubview:[self getChildViewForIndex:3]];
48
+
49
+ float childWidth = [self getChildViewForIndex:0].frame.size.width;
50
+ float childHeight = [self getChildViewForIndex:0].frame.size.height;
51
+
52
+ [scrollView setContentSize:CGSizeMake(childWidth * 3, childHeight)];
53
+
54
+ [[self view] addSubview:scrollView];
55
+ }
56
+
57
+ -(UIView *)getChildViewForIndex:(int) index
58
+ {
59
+ ScrollChildViewController *childViewController = [[ScrollChildViewController alloc] initWithNibName:@"ScrollChildViewController" bundle:nil];
60
+
61
+
62
+ UIView *view = [childViewController view];
63
+
64
+ switch (index) {
65
+ case 1:
66
+ [view setBackgroundColor:[UIColor blueColor]];
67
+ [childViewController setIndexLabel:index];
68
+ break;
69
+ case 2:
70
+ {
71
+ [view setBackgroundColor:[UIColor redColor]];
72
+ CGRect frame = CGRectMake([self view].frame.size.width, 0, [self view].frame.size.width, [self view].frame.size.height);
73
+ [view setFrame:frame];
74
+ [childViewController setIndexLabel:index];
75
+ break;
76
+ }
77
+ case 3:
78
+ {
79
+ [view setBackgroundColor:[UIColor greenColor]];
80
+ CGRect frame = CGRectMake([self view].frame.size.width * 2, 0, [self view].frame.size.width, [self view].frame.size.height);
81
+ [view setFrame:frame];
82
+ [childViewController setIndexLabel:index];
83
+ break;
84
+ }
85
+ default:
86
+ break;
87
+ }
88
+ return [childViewController view];
89
+ }
90
+
91
+ @end
@@ -0,0 +1,20 @@
1
+ <?xml version="1.0" encoding="UTF-8" standalone="no"?>
2
+ <document type="com.apple.InterfaceBuilder3.CocoaTouch.XIB" version="3.0" toolsVersion="4437" systemVersion="13A451" targetRuntime="iOS.CocoaTouch.iPad" propertyAccessControl="none" useAutolayout="YES">
3
+ <dependencies>
4
+ <plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="3662"/>
5
+ </dependencies>
6
+ <objects>
7
+ <placeholder placeholderIdentifier="IBFilesOwner" id="-1" userLabel="File's Owner" customClass="ScrollPageViewController">
8
+ <connections>
9
+ <outlet property="view" destination="2" id="3"/>
10
+ </connections>
11
+ </placeholder>
12
+ <placeholder placeholderIdentifier="IBFirstResponder" id="-2" customClass="UIResponder"/>
13
+ <view clearsContextBeforeDrawing="NO" contentMode="scaleToFill" id="2">
14
+ <rect key="frame" x="0.0" y="20" width="768" height="1004"/>
15
+ <autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMaxY="YES"/>
16
+ <color key="backgroundColor" white="1" alpha="1" colorSpace="custom" customColorSpace="calibratedWhite"/>
17
+ <simulatedStatusBarMetrics key="simulatedStatusBarMetrics" statusBarStyle="blackTranslucent"/>
18
+ </view>
19
+ </objects>
20
+ </document>
@@ -0,0 +1,23 @@
1
+ //
2
+ // TablePageViewController.h
3
+ // RufusApp
4
+ //
5
+ // Created by Jeremy Stewart on 10/20/13.
6
+ // Copyright (c) 2013 Northwoods. All rights reserved.
7
+ //
8
+
9
+ #import <UIKit/UIKit.h>
10
+
11
+ @interface TablePageViewController : UIViewController <UITableViewDataSource, UITableViewDelegate>
12
+ {
13
+ NSArray *labels;
14
+ NSArray *unsorted;
15
+ }
16
+
17
+ @property (weak, nonatomic) IBOutlet UITableView *ascending;
18
+ @property (weak, nonatomic) IBOutlet UITableView *descending;
19
+ @property (weak, nonatomic) IBOutlet UILabel *sortedLabel;
20
+ @property (weak, nonatomic) IBOutlet UILabel *unsortedLabel;
21
+ @property (weak, nonatomic) IBOutlet UITableView *notSorted;
22
+
23
+ @end
@@ -0,0 +1,108 @@
1
+ //
2
+ // TablePageViewController.m
3
+ // RufusApp
4
+ //
5
+ // Created by Jeremy Stewart on 10/20/13.
6
+ // Copyright (c) 2013 Northwoods. All rights reserved.
7
+ //
8
+
9
+ #import "TablePageViewController.h"
10
+
11
+ @interface TablePageViewController ()
12
+
13
+ @end
14
+
15
+ @implementation TablePageViewController
16
+ @synthesize ascending, descending, notSorted;
17
+
18
+ - (id)initWithNibName:(NSString *)nibNameOrNil bundle:(NSBundle *)nibBundleOrNil
19
+ {
20
+ self = [super initWithNibName:nibNameOrNil bundle:nibBundleOrNil];
21
+ if (self) {
22
+ labels = [self makeLabels];
23
+
24
+ }
25
+ return self;
26
+ }
27
+
28
+ -(void)viewWillAppear:(BOOL)animated
29
+ {
30
+ [super viewWillAppear:animated];
31
+ [ascending setAccessibilityLabel:@"ascending"];
32
+ [descending setAccessibilityLabel:@"descending"];
33
+ [notSorted setAccessibilityLabel:@"notSorted"];
34
+ }
35
+
36
+ -(NSInteger)numberOfSectionsInTableView:(UITableView *)tableView
37
+ {
38
+ return 1;
39
+ }
40
+
41
+ -(NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section
42
+ {
43
+ return [labels count];
44
+ }
45
+
46
+ -(UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
47
+ {
48
+ UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:@"Cell"];
49
+ if (!cell) {
50
+ cell = [[UITableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:@"Cell"];
51
+ }
52
+ NSLog(@"%@", [tableView accessibilityLabel]);
53
+
54
+ if ([[tableView accessibilityLabel] isEqualToString:[ascending accessibilityLabel]]) {
55
+ UILabel *text = [labels objectAtIndex:[indexPath row]];
56
+ [[cell textLabel] setText:[text text]];
57
+ } else if ([[tableView accessibilityLabel] isEqualToString:[descending accessibilityLabel]]) {
58
+ UILabel *text = [labels objectAtIndex:([labels count] - 1) - [indexPath row]];
59
+ [[cell textLabel] setText:[text text]];
60
+ } else {
61
+ if ([indexPath row] % 2 == 0) {
62
+ [[cell textLabel] setText:@"x"];
63
+ } else {
64
+ [[cell textLabel] setText:@"j"];
65
+ }
66
+
67
+ }
68
+
69
+ return cell;
70
+ }
71
+
72
+ -(NSArray *) makeLabels
73
+ {
74
+
75
+ UILabel *one = [[UILabel alloc] init];
76
+ [one setText:@"1"];
77
+ UILabel *two = [[UILabel alloc] init];
78
+ [two setText:@"2"];
79
+ UILabel *three = [[UILabel alloc] init];
80
+ [three setText:@"3"];
81
+
82
+ UILabel *a = [[UILabel alloc] init];
83
+ [a setText:@"a"];
84
+ UILabel *b = [[UILabel alloc] init];
85
+ [b setText:@"b"];
86
+ UILabel *c = [[UILabel alloc] init];
87
+ [c setText:@"c"];
88
+ UILabel *d = [[UILabel alloc] init];
89
+ [d setText:@"d"];
90
+ UILabel *e = [[UILabel alloc] init];
91
+ [e setText:@"e"];
92
+
93
+ NSMutableArray *tableLabels = [[NSMutableArray alloc] init];
94
+ [tableLabels addObject:one];
95
+ [tableLabels addObject:two];
96
+ [tableLabels addObject:three];
97
+ [tableLabels addObject:a];
98
+ [tableLabels addObject:b];
99
+ [tableLabels addObject:c];
100
+ [tableLabels addObject:d];
101
+ [tableLabels addObject:e];
102
+
103
+ return tableLabels;
104
+
105
+ }
106
+
107
+
108
+ @end
@@ -0,0 +1,75 @@
1
+ <?xml version="1.0" encoding="UTF-8" standalone="no"?>
2
+ <document type="com.apple.InterfaceBuilder3.CocoaTouch.iPad.XIB" version="3.0" toolsVersion="4510" systemVersion="12F45" targetRuntime="iOS.CocoaTouch.iPad" propertyAccessControl="none" useAutolayout="YES">
3
+ <dependencies>
4
+ <plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="3742"/>
5
+ </dependencies>
6
+ <objects>
7
+ <placeholder placeholderIdentifier="IBFilesOwner" id="-1" userLabel="File's Owner" customClass="TablePageViewController">
8
+ <connections>
9
+ <outlet property="ascending" destination="kZD-bA-3M9" id="9YH-ox-6m4"/>
10
+ <outlet property="descending" destination="bFd-cR-AnT" id="eBV-Hh-9s9"/>
11
+ <outlet property="notSorted" destination="uNl-JB-Y7y" id="qUm-f4-Dvn"/>
12
+ <outlet property="sortedLabel" destination="y3W-to-ma5" id="BFf-Dd-ctn"/>
13
+ <outlet property="unsortedLabel" destination="D79-jP-phq" id="KXO-Qp-Qgv"/>
14
+ <outlet property="view" destination="2" id="3"/>
15
+ </connections>
16
+ </placeholder>
17
+ <placeholder placeholderIdentifier="IBFirstResponder" id="-2" customClass="UIResponder"/>
18
+ <view clearsContextBeforeDrawing="NO" contentMode="scaleToFill" id="2">
19
+ <rect key="frame" x="0.0" y="0.0" width="768" height="1004"/>
20
+ <autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMaxY="YES"/>
21
+ <subviews>
22
+ <tableView clipsSubviews="YES" contentMode="scaleToFill" fixedFrame="YES" alwaysBounceVertical="YES" style="plain" separatorStyle="default" rowHeight="44" sectionHeaderHeight="22" sectionFooterHeight="22" translatesAutoresizingMaskIntoConstraints="NO" id="kZD-bA-3M9">
23
+ <rect key="frame" x="42" y="162" width="150" height="467"/>
24
+ <autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
25
+ <color key="backgroundColor" white="1" alpha="1" colorSpace="calibratedWhite"/>
26
+ <connections>
27
+ <outlet property="dataSource" destination="-1" id="LFA-Si-hjw"/>
28
+ <outlet property="delegate" destination="-1" id="mZE-tT-AJ1"/>
29
+ </connections>
30
+ </tableView>
31
+ <label opaque="NO" clipsSubviews="YES" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" fixedFrame="YES" text="Ascending" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="y3W-to-ma5">
32
+ <rect key="frame" x="69" y="114" width="81" height="21"/>
33
+ <autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMaxY="YES"/>
34
+ <fontDescription key="fontDescription" type="system" pointSize="17"/>
35
+ <color key="textColor" cocoaTouchSystemColor="darkTextColor"/>
36
+ <nil key="highlightedColor"/>
37
+ </label>
38
+ <label opaque="NO" clipsSubviews="YES" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" fixedFrame="YES" text="Unsorted" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="SsI-ER-Hih">
39
+ <rect key="frame" x="294" y="114" width="71" height="21"/>
40
+ <autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMaxY="YES"/>
41
+ <fontDescription key="fontDescription" type="system" pointSize="17"/>
42
+ <color key="textColor" cocoaTouchSystemColor="darkTextColor"/>
43
+ <nil key="highlightedColor"/>
44
+ </label>
45
+ <tableView clipsSubviews="YES" contentMode="scaleToFill" fixedFrame="YES" alwaysBounceVertical="YES" style="plain" separatorStyle="default" rowHeight="44" sectionHeaderHeight="22" sectionFooterHeight="22" translatesAutoresizingMaskIntoConstraints="NO" id="bFd-cR-AnT">
46
+ <rect key="frame" x="503" y="162" width="150" height="467"/>
47
+ <autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
48
+ <color key="backgroundColor" white="1" alpha="1" colorSpace="calibratedWhite"/>
49
+ <connections>
50
+ <outlet property="dataSource" destination="-1" id="xoA-JK-lwY"/>
51
+ <outlet property="delegate" destination="-1" id="Yuo-gb-oXe"/>
52
+ </connections>
53
+ </tableView>
54
+ <label opaque="NO" clipsSubviews="YES" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" fixedFrame="YES" text="Descending" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="D79-jP-phq">
55
+ <rect key="frame" x="543" y="114" width="92" height="21"/>
56
+ <autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMaxY="YES"/>
57
+ <fontDescription key="fontDescription" type="system" pointSize="17"/>
58
+ <nil key="highlightedColor"/>
59
+ </label>
60
+ <tableView clipsSubviews="YES" contentMode="scaleToFill" fixedFrame="YES" alwaysBounceVertical="YES" style="plain" separatorStyle="default" rowHeight="44" sectionHeaderHeight="22" sectionFooterHeight="22" translatesAutoresizingMaskIntoConstraints="NO" id="uNl-JB-Y7y">
61
+ <rect key="frame" x="227" y="166" width="228" height="460"/>
62
+ <autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
63
+ <color key="backgroundColor" white="1" alpha="1" colorSpace="calibratedWhite"/>
64
+ <connections>
65
+ <outlet property="dataSource" destination="-1" id="Oy2-GU-eZX"/>
66
+ <outlet property="delegate" destination="-1" id="LLv-JY-nfq"/>
67
+ </connections>
68
+ </tableView>
69
+ </subviews>
70
+ <color key="backgroundColor" white="1" alpha="1" colorSpace="custom" customColorSpace="calibratedWhite"/>
71
+ <accessibility key="accessibilityConfiguration" label="tableView"/>
72
+ <simulatedStatusBarMetrics key="simulatedStatusBarMetrics" statusBarStyle="lightContent"/>
73
+ </view>
74
+ </objects>
75
+ </document>
@@ -10,7 +10,9 @@
10
10
  <outlet property="enabledPageButton" destination="8Xe-wy-gw2" id="mNp-pl-GZO"/>
11
11
  <outlet property="existsPageButton" destination="ptK-30-J0y" id="eem-Ie-lJP"/>
12
12
  <outlet property="rufusButton" destination="4" id="11"/>
13
+ <outlet property="scrollPageButton" destination="Trw-jM-66l" id="lPV-bJ-geS"/>
13
14
  <outlet property="showAlertButton" destination="VTc-fX-2Iw" id="ndi-Zu-qSy"/>
15
+ <outlet property="tablePageButton" destination="dE6-Ap-U8w" id="rGg-Yd-dCs"/>
14
16
  <outlet property="view" destination="2" id="3"/>
15
17
  </connections>
16
18
  </placeholder>
@@ -93,6 +95,28 @@
93
95
  <action selector="toDisplayedPage:" destination="-1" eventType="touchUpInside" id="hho-oP-47b"/>
94
96
  </connections>
95
97
  </button>
98
+ <button opaque="NO" contentMode="scaleToFill" fixedFrame="YES" contentHorizontalAlignment="center" contentVerticalAlignment="center" buttonType="roundedRect" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="Trw-jM-66l">
99
+ <rect key="frame" x="315" y="472" width="132" height="30"/>
100
+ <autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMaxY="YES"/>
101
+ <accessibility key="accessibilityConfiguration" label="swipePageButton"/>
102
+ <state key="normal" title="Swipe Page Button">
103
+ <color key="titleShadowColor" white="0.5" alpha="1" colorSpace="calibratedWhite"/>
104
+ </state>
105
+ <connections>
106
+ <action selector="toSwipePage:" destination="-1" eventType="touchUpInside" id="1Hg-Xm-nsi"/>
107
+ </connections>
108
+ </button>
109
+ <button opaque="NO" contentMode="scaleToFill" fixedFrame="YES" contentHorizontalAlignment="center" contentVerticalAlignment="center" buttonType="roundedRect" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="dE6-Ap-U8w">
110
+ <rect key="frame" x="318" y="510" width="126" height="30"/>
111
+ <autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMaxY="YES"/>
112
+ <accessibility key="accessibilityConfiguration" label="tablePageButton"/>
113
+ <state key="normal" title="Table Page Button">
114
+ <color key="titleShadowColor" white="0.5" alpha="1" colorSpace="calibratedWhite"/>
115
+ </state>
116
+ <connections>
117
+ <action selector="toTablePage:" destination="-1" eventType="touchUpInside" id="hgd-Rn-c0B"/>
118
+ </connections>
119
+ </button>
96
120
  </subviews>
97
121
  <color key="backgroundColor" white="1" alpha="1" colorSpace="custom" customColorSpace="calibratedWhite"/>
98
122
  <constraints>
@@ -17,4 +17,16 @@ Feature: Using Rufus
17
17
  Scenario: Getting page elements by class
18
18
  Then I can get a list of the buttons
19
19
 
20
+ Scenario: Waiting for a view defined by a hash to be enabled
21
+ Given I have navigated to the "EnabledPage" using the "to_enabled" route
22
+ Then I can use a hash to wait for "enabledTextField" to become enabled
23
+ And I see that the "notEnabledTextField" is never enabled
20
24
 
25
+ Scenario: Waiting for a view defined by a hash to exist
26
+ Given I have navigated to the "ExistsPage" using the "to_exists" route
27
+ Then I can use a hash to wait for the "This Alert Exists" view to exist
28
+
29
+ Scenario: Waiting for a view defined by a hash to be displayed
30
+ Given I have navigated to the "DisplayedPage" using the "to_displayed" route
31
+ Then I can use a hash to wait for the "Mystery Label" to be displayed
32
+ And I see that the "Invisible Label" is never displayed
@@ -0,0 +1,10 @@
1
+ @swipe
2
+ Feature: Swiping the screen
3
+
4
+ Background:
5
+ Given I rotate the app to "portrait"
6
+
7
+ Scenario: Swiping to the right
8
+ Given I have navigated to the "ScrollPage" using the "to_scroll" route
9
+ When I scroll to the right on the view defined "Screen #3"
10
+ Then I can see I scrolled to the view named "Screen #3"
@@ -12,4 +12,19 @@ Then(/^I can get a list of the buttons$/) do
12
12
  elements_of_type('UIAButton').each do |element|
13
13
  element.class.name.should eq('Selenium::WebDriver::Element')
14
14
  end
15
+ end
16
+ Then(/^I can use a hash to wait for "([^"]*)" to become enabled$/) do |which|
17
+ enabled_hash_after_wait?(:name => "#{which}").should be_true
18
+ end
19
+ Then(/^I can use a hash to wait for the "([^"]*)" view to exist$/) do |which|
20
+ exists_hash_after_wait?(:name => "#{which}").should be_true
21
+ end
22
+ Then(/^I can use a hash to wait for the "([^"]*)" to be displayed$/) do |which|
23
+ displayed_hash_after_wait?(:name => "#{which}").should be_true
24
+ end
25
+ When(/^I see that the "([^"]*)" is never displayed$/) do |which|
26
+ displayed_hash_after_wait?(:name => "#{which}").should be_false
27
+ end
28
+ When(/^I see that the "([^"]*)" is never enabled$/) do |which|
29
+ enabled_hash_after_wait?(:name => "#{which}").should be_false
15
30
  end
@@ -0,0 +1,6 @@
1
+ When(/^I scroll to the right on the view defined "([^"]*)"$/) do |which|
2
+ scroll_to :name => which
3
+ end
4
+ Then(/^I can see I scrolled to the view named "([^"]*)"$/) do |which|
5
+ find(:name => "#{which}").text.should eq which
6
+ end
@@ -0,0 +1,14 @@
1
+ Then(/^I see the table defined "([^"]*)" is( not)? sorted$/) do |which, unsorted|
2
+ on(TablePage).send("view_#{which}_view").sorted?.should == unsorted.nil?
3
+ end
4
+ Then(/^I can see all the children for the view defined "([^"]*)"$/) do |which|
5
+ children = on(TablePage).send("view_#{which}_view").children
6
+ children[0].attribute('name').should eq '1'
7
+ children[1].attribute('name').should eq '2'
8
+ children[2].attribute('name').should eq '3'
9
+ children[3].attribute('name').should eq 'a'
10
+ children[4].attribute('name').should eq 'b'
11
+ children[5].attribute('name').should eq 'c'
12
+ children[6].attribute('name').should eq 'd'
13
+ children[7].attribute('name').should eq 'e'
14
+ end
@@ -12,5 +12,13 @@ Rufus::Navigation.routes = {
12
12
  :to_enabled => [
13
13
  [HomePage, :view_enabled],
14
14
  [EnabledPage],
15
+ ],
16
+ :to_scroll => [
17
+ [HomePage, :view_scroll],
18
+ [ScrollPage],
19
+ ],
20
+ :to_tables => [
21
+ [HomePage, :view_tables],
22
+ [TablePage],
15
23
  ]
16
24
  }
@@ -11,6 +11,8 @@ class HomePage
11
11
  button(:view_exists, :name => 'existsButton')
12
12
  button(:view_displayed, :name => 'displayedPageButton')
13
13
  button(:view_enabled, :name => 'enabledPageButton')
14
+ button(:view_scroll, :name => 'swipePageButton')
15
+ button(:view_tables, :name => 'tablePageButton')
14
16
  button(:alert_Ok, :name => 'Ok')
15
17
  button(:alert_Cancel, :name => 'Cancel')
16
18
 
@@ -0,0 +1,11 @@
1
+ require 'rufus'
2
+
3
+ class ScrollPage
4
+ include Rufus
5
+
6
+ view(:view_initial, :name => 'Screen #1')
7
+
8
+ def active?
9
+ exists_after_wait? view_initial_view
10
+ end
11
+ end
@@ -0,0 +1,14 @@
1
+ require 'rufus'
2
+
3
+ class TablePage
4
+ include Rufus
5
+
6
+ table(:view_ascending, :name => 'ascending')
7
+ table(:view_descending, :name => 'descending')
8
+ table(:view_unsorted, :name => 'notSorted')
9
+
10
+ def active?
11
+ exists_after_wait? view_ascending_view
12
+ end
13
+
14
+ end
@@ -0,0 +1,13 @@
1
+ @table
2
+ Feature: dealing with tables
3
+
4
+ Background:
5
+ Given I have navigated to the "TablePage" using the "to_tables" route
6
+
7
+ Scenario: Checking the sort
8
+ Then I see the table defined "ascending" is sorted
9
+ And I see the table defined "descending" is sorted
10
+ And I see the table defined "unsorted" is not sorted
11
+
12
+ Scenario: Getting the child elements
13
+ Then I can see all the children for the view defined "ascending"
@@ -31,7 +31,7 @@ Feature: Interacting with views
31
31
  Given I have navigated to the "EnabledPage" using the "to_enabled" route
32
32
  Then I am on the "EnabledPage"
33
33
  And the view marked "not_enabled" is not enabled
34
- @block
34
+
35
35
  Scenario: Calling views in a block
36
36
  Given I am on the "HomePage"
37
37
  Then in a block can see the existence of views "rufus", "exists" and "displayed"
data/lib/rufus.rb CHANGED
@@ -1,6 +1,7 @@
1
1
  require 'rufus/navigation'
2
2
  require 'rufus/accessors/accessors'
3
3
  require 'rufus/accessors/view'
4
+ require 'rufus/accessors/table'
4
5
 
5
6
  module Rufus
6
7
 
@@ -38,6 +39,21 @@ module Rufus
38
39
  true
39
40
  end
40
41
 
42
+ def enabled_hash_after_wait?(locator, timeout = 5)
43
+ element = find locator
44
+ enabled_after_wait? element, timeout
45
+ end
46
+
47
+ def exists_hash_after_wait?(locator, timeout = 5)
48
+ view = Rufus::Accessors::View.new locator
49
+ exists_after_wait? view, timeout
50
+ end
51
+
52
+ def displayed_hash_after_wait?(locator, timeout = 5)
53
+ view = Rufus::Accessors::View.new locator
54
+ displayed_after_wait? view, timeout
55
+ end
56
+
41
57
  def find(locator)
42
58
  selenium.find(locator)
43
59
  end
@@ -54,6 +70,11 @@ module Rufus
54
70
  selenium.elements_by_tag(type)
55
71
  end
56
72
 
73
+ def scroll_to(locator)
74
+ selenium.scroll_to(locator)
75
+ end
57
76
  end
58
77
 
59
78
 
79
+
80
+
@@ -25,5 +25,11 @@ module Rufus
25
25
  def alert(name, locator)
26
26
  view(name, locator)
27
27
  end
28
+
29
+ def table(name, locator)
30
+ define_method("#{name}_view") do
31
+ Rufus::Accessors::Table.new(locator)
32
+ end
33
+ end
28
34
  end
29
35
  end
@@ -0,0 +1,49 @@
1
+ require 'rufus/accessors/view'
2
+
3
+ module Rufus
4
+ module Accessors
5
+ class Table < View
6
+
7
+ def children
8
+ selenium.cells locator
9
+ end
10
+
11
+ def sorted?
12
+ elements_sorted children
13
+ end
14
+
15
+ def sorted_ascending?
16
+ ascending? children
17
+ end
18
+
19
+ def sorted_descending?
20
+ descending? children
21
+ end
22
+
23
+ private
24
+
25
+ def elements_sorted(elements)
26
+ return true if elements.count == 1
27
+ descending? elements or ascending? elements
28
+ end
29
+
30
+ def descending?(elements)
31
+ labels = elements.map{|element| element.attribute 'name'}
32
+ elements = elements.map{|element| element.attribute 'name'}
33
+ elements == labels.sort.reverse
34
+ end
35
+
36
+ def ascending?(elements)
37
+ labels = elements.map{|element| element.attribute 'name'}
38
+ elements = elements.map{|element| element.attribute 'name'}
39
+ elements == labels.sort
40
+
41
+ end
42
+
43
+ def element_names(elements)
44
+ elements.map{|element| element.attribute 'name'}
45
+ end
46
+
47
+ end
48
+ end
49
+ end
data/lib/rufus/driver.rb CHANGED
@@ -41,6 +41,12 @@ module Rufus
41
41
  end
42
42
  end
43
43
 
44
+ def cells(locator)
45
+ element = find(locator)
46
+ raise 'Expected view to be of type UIATableView' unless element.tag_name.eql? 'UIATableView'
47
+ element.find_elements(:tag_name, 'UIATableCell')
48
+ end
49
+
44
50
  def click(locator)
45
51
  find(locator).click
46
52
  end
@@ -161,6 +167,11 @@ module Rufus
161
167
  driver.find_elements(:tag_name, name)
162
168
  end
163
169
 
170
+ def scroll_to(locator)
171
+ id = find(locator).ref
172
+ driver.execute_script 'mobile: scrollTo', {'element' => id}
173
+ end
174
+
164
175
  private
165
176
 
166
177
  def url(config)
data/rakefile CHANGED
@@ -26,7 +26,7 @@ end
26
26
 
27
27
  desc "Run the features"
28
28
  task :features do
29
- `bundle exec cucumber --tags @rufus 1>&2`
29
+ `bundle exec cucumber 1>&2`
30
30
  end
31
31
 
32
32
  desc "Starting the appium server"
@@ -88,3 +88,6 @@ task :reset_sim do
88
88
  APPLESCRIPT}
89
89
  end
90
90
 
91
+ desc "Deploy new build to simulator"
92
+ task :deploy => [:reset_sim, :build_sim, :install_sim]
93
+
data/rufus.gemspec CHANGED
@@ -1,6 +1,6 @@
1
1
  Gem::Specification.new do |gem|
2
2
  gem.name = "rufus"
3
- gem.version = "0.5"
3
+ gem.version = "0.6"
4
4
  gem.authors = ["Jeremy Stewart"]
5
5
  gem.email = ["jlstewart379@gmail.com"]
6
6
  gem.description = "Page object wrapper for Appium"
@@ -350,5 +350,57 @@ describe Rufus::Driver do
350
350
  end
351
351
  end
352
352
  end
353
+ context 'scrolling' do
354
+
355
+ let(:yaml){double('YAML loader')}
356
+ let(:mock_driver){'a mock app driver'}
357
+ let(:url){'http://127.0.0.1:4723/wd/hub'}
358
+ let(:mock_element){'mock selenium element'}
359
+ let(:swipe_options){{'element' => 1}}
360
+ before(:each) do
361
+ File.stub(:exists?).and_return(true)
362
+ @config = {"browser_name" =>"iOS", "platform"=>"Mac", "version"=>"6.1", "app"=>"/Users/app/path/rufus.app", "use_physical" => false}
363
+ YAML.should_receive(:load).and_return(@config)
364
+ @driver = Rufus::Driver.new
365
+ end
366
+
367
+ it 'can scroll to a view' do
368
+ Rufus::Drivers::IOS_Simulator.should_receive(:for).with(@config, url).and_return(mock_driver)
369
+ mock_driver.should_receive(:find_element).with(:name, 'elementName').and_return(mock_element)
370
+ mock_element.should_receive(:ref).and_return(1)
371
+ mock_driver.should_receive(:execute_script).with('mobile: scrollTo', swipe_options)
372
+ @driver.scroll_to(:name => 'elementName')
373
+ end
374
+ end
375
+
376
+ context 'finding child elements of table view' do
377
+
378
+ let(:yaml){double('YAML loader')}
379
+ let(:mock_driver){'a mock app driver'}
380
+ let(:url){'http://127.0.0.1:4723/wd/hub'}
381
+ let(:mock_element){'mock selenium element'}
382
+ let(:children){'mock tableview children'}
383
+
384
+ before(:each) do
385
+ File.stub(:exists?).and_return(true)
386
+ @config = {"browser_name" =>"iOS", "platform"=>"Mac", "version"=>"6.1", "app"=>"/Users/app/path/rufus.app", "use_physical" => false}
387
+ YAML.should_receive(:load).and_return(@config)
388
+ @driver = Rufus::Driver.new
389
+ Rufus::Drivers::IOS_Simulator.should_receive(:for).with(@config, url).and_return(mock_driver)
390
+ mock_driver.should_receive(:find_element).with(:name, 'elementName').and_return(mock_element)
391
+ end
392
+
393
+ it 'returns no elements if element is not table view' do
394
+ mock_element.should_receive(:tag_name).and_return('UIStaticText')
395
+ expect{@driver.cells(:name => 'elementName')}.to raise_error(RuntimeError, 'Expected view to be of type UIATableView')
396
+ end
397
+
398
+ it 'can find a list of child elements' do
399
+ mock_element.should_receive(:tag_name).and_return('UIATableView')
400
+ mock_element.should_receive(:find_elements).with(:tag_name, 'UIATableCell').and_return(children)
401
+ @driver.cells(:name => 'elementName').should == children
402
+ end
403
+ end
353
404
  end
354
405
  end
406
+
data/spec/rufus_spec.rb CHANGED
@@ -112,4 +112,12 @@ describe Rufus do
112
112
  end
113
113
 
114
114
  end
115
+
116
+ context 'scrolling' do
117
+ let(:selenium){'mock selenium driver'}
118
+ it 'can swipe to the right' do
119
+ selenium.should_receive(:scroll_to).with(:name => 'elementName')
120
+ scroll_to(:name => 'elementName')
121
+ end
122
+ end
115
123
  end
@@ -0,0 +1,34 @@
1
+ require 'rufus/accessors/table'
2
+ require 'spec_helper'
3
+
4
+ describe Rufus::Accessors::Table do
5
+
6
+
7
+ context 'getting child elements' do
8
+
9
+ let(:table) {Rufus::Accessors::Table.new(:name => 'testTable')}
10
+ let(:selenium){double('Selenium::WebDriver')}
11
+ let(:mock_child_elements){double('list of child elements')}
12
+
13
+ before(:each) do
14
+ table.should_receive(:selenium).and_return(selenium)
15
+ selenium.should_receive(:cells).with(:name => 'testTable').and_return(mock_child_elements)
16
+ end
17
+
18
+ it 'can get all the child elements of the table' do
19
+ table.children.should eq mock_child_elements
20
+ end
21
+
22
+ context 'determining sort' do
23
+
24
+ let(:first_element){'first child element'}
25
+ let(:second_element){'second child element'}
26
+ let(:third_element){'third child element'}
27
+
28
+ it 'is considered sorted for one child' do
29
+ mock_child_elements.should_receive(:count).and_return 1
30
+ table.sorted?.should be_true
31
+ end
32
+ end
33
+ end
34
+ end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rufus
3
3
  version: !ruby/object:Gem::Version
4
- version: '0.5'
4
+ version: '0.6'
5
5
  platform: ruby
6
6
  authors:
7
7
  - Jeremy Stewart
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2013-10-15 00:00:00.000000000 Z
11
+ date: 2013-10-22 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: page_navigation
@@ -304,6 +304,15 @@ files:
304
304
  - RufusApp/RufusApp/RufusPageViewController.h
305
305
  - RufusApp/RufusApp/RufusPageViewController.m
306
306
  - RufusApp/RufusApp/RufusPageViewController.xib
307
+ - RufusApp/RufusApp/ScrollChildViewController.h
308
+ - RufusApp/RufusApp/ScrollChildViewController.m
309
+ - RufusApp/RufusApp/ScrollChildViewController.xib
310
+ - RufusApp/RufusApp/ScrollPageViewController.h
311
+ - RufusApp/RufusApp/ScrollPageViewController.m
312
+ - RufusApp/RufusApp/ScrollPageViewController.xib
313
+ - RufusApp/RufusApp/TablePageViewController.h
314
+ - RufusApp/RufusApp/TablePageViewController.m
315
+ - RufusApp/RufusApp/TablePageViewController.xib
307
316
  - RufusApp/RufusApp/en.lproj/InfoPlist.strings
308
317
  - RufusApp/RufusApp/en.lproj/RUViewController.xib
309
318
  - RufusApp/RufusApp/main.m
@@ -315,9 +324,12 @@ files:
315
324
  - features/alert.feature
316
325
  - features/driver.feature
317
326
  - features/rufus.feature
327
+ - features/scroll.feature
318
328
  - features/step_definitions/alert_steps.rb.rb
319
329
  - features/step_definitions/driver_steps.rb
320
330
  - features/step_definitions/rufus_steps.rb
331
+ - features/step_definitions/scroll_steps.rb
332
+ - features/step_definitions/table_steps.rb
321
333
  - features/step_definitions/view_steps.rb
322
334
  - features/support/core_ext/string.rb
323
335
  - features/support/env.rb
@@ -328,9 +340,13 @@ files:
328
340
  - features/support/screens/exists_page.rb
329
341
  - features/support/screens/home_page.rb
330
342
  - features/support/screens/rufus_page.rb
343
+ - features/support/screens/scroll_page.rb
344
+ - features/support/screens/table_page.rb
345
+ - features/table.feature
331
346
  - features/view.feature
332
347
  - lib/rufus.rb
333
348
  - lib/rufus/accessors/accessors.rb
349
+ - lib/rufus/accessors/table.rb
334
350
  - lib/rufus/accessors/view.rb
335
351
  - lib/rufus/driver.rb
336
352
  - lib/rufus/drivers/iOS_device.rb
@@ -345,6 +361,7 @@ files:
345
361
  - spec/navigation_spec.rb
346
362
  - spec/rufus_spec.rb
347
363
  - spec/spec_helper.rb
364
+ - spec/table_spec.rb
348
365
  - spec/view_spec.rb
349
366
  homepage: https://github.com/jlstewart379/rufus
350
367
  licenses: