Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Retargeting iOS 7.0 and fixing issues with UISwitch accessor #10

Merged
merged 1 commit into from
Apr 1, 2014
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
.DS_Store
*.xccheckout
Frank
xcuserdata
*.gem
Expand Down
115 changes: 58 additions & 57 deletions app/FurterApp/FurterApp/en.lproj/MainStoryboard_iPad.storyboard

Large diffs are not rendered by default.

59 changes: 23 additions & 36 deletions app/FurterApp/FurterApp/en.lproj/MainStoryboard_iPhone.storyboard
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<document type="com.apple.InterfaceBuilder3.CocoaTouch.Storyboard.XIB" version="2.0" toolsVersion="3084" systemVersion="12D78" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" initialViewController="3">
<document type="com.apple.InterfaceBuilder3.CocoaTouch.Storyboard.XIB" version="3.0" toolsVersion="5053" systemVersion="13C64" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" initialViewController="3">
<dependencies>
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="2083"/>
<deployment defaultVersion="1552" identifier="iOS"/>
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="3733"/>
</dependencies>
<scenes>
<!--Navigation Controller-->
Expand All @@ -22,29 +23,28 @@
<!--Master View Controller - Master-->
<scene sceneID="18">
<objects>
<tableViewController storyboardIdentifier="" title="Master" id="12" customClass="MasterViewController" sceneMemberID="viewController">
<tableView key="view" opaque="NO" clipsSubviews="YES" clearsContextBeforeDrawing="NO" contentMode="scaleToFill" alwaysBounceVertical="YES" dataMode="prototypes" style="plain" rowHeight="44" sectionHeaderHeight="22" sectionFooterHeight="22" id="13">
<rect key="frame" x="0.0" y="64" width="320" height="504"/>
<tableViewController title="Master" id="12" customClass="MasterViewController" sceneMemberID="viewController">
<tableView key="view" opaque="NO" clipsSubviews="YES" clearsContextBeforeDrawing="NO" contentMode="scaleToFill" alwaysBounceVertical="YES" dataMode="prototypes" style="plain" separatorStyle="default" rowHeight="44" sectionHeaderHeight="22" sectionFooterHeight="22" id="13">
<rect key="frame" x="0.0" y="0.0" width="320" height="568"/>
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
<color key="backgroundColor" white="1" alpha="1" colorSpace="calibratedWhite"/>
<prototypes>
<tableViewCell contentMode="scaleToFill" selectionStyle="blue" accessoryType="disclosureIndicator" hidesAccessoryWhenEditing="NO" indentationLevel="1" indentationWidth="0.0" reuseIdentifier="Cell" textLabel="phq-AM-6qj" style="IBUITableViewCellStyleDefault" id="lJ0-d7-vTF">
<rect key="frame" x="0.0" y="22" width="320" height="44"/>
<rect key="frame" x="0.0" y="86" width="320" height="44"/>
<autoresizingMask key="autoresizingMask"/>
<view key="contentView" opaque="NO" clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="center">
<rect key="frame" x="0.0" y="0.0" width="300" height="43"/>
<tableViewCellContentView key="contentView" opaque="NO" clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="center" tableViewCell="lJ0-d7-vTF" id="XfA-LH-DZO">
<rect key="frame" x="0.0" y="0.0" width="287" height="43"/>
<autoresizingMask key="autoresizingMask"/>
<subviews>
<label opaque="NO" clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="center" text="Title" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" id="phq-AM-6qj">
<rect key="frame" x="10" y="0.0" width="280" height="43"/>
<rect key="frame" x="15" y="0.0" width="270" height="43"/>
<autoresizingMask key="autoresizingMask"/>
<fontDescription key="fontDescription" type="boldSystem" pointSize="20"/>
<color key="textColor" cocoaTouchSystemColor="darkTextColor"/>
<color key="highlightedColor" red="1" green="1" blue="1" alpha="1" colorSpace="calibratedRGB"/>
</label>
</subviews>
<color key="backgroundColor" white="0.0" alpha="0.0" colorSpace="calibratedWhite"/>
</view>
</tableViewCellContentView>
<color key="backgroundColor" white="1" alpha="1" colorSpace="calibratedWhite"/>
<connections>
<segue destination="21" kind="push" identifier="showDetail" id="jZb-fq-zAk"/>
Expand All @@ -66,35 +66,36 @@
<!--Detail View Controller - Detail-->
<scene sceneID="24">
<objects>
<viewController storyboardIdentifier="" title="Detail" id="21" customClass="DetailViewController" sceneMemberID="viewController">
<viewController title="Detail" id="21" customClass="DetailViewController" sceneMemberID="viewController">
<layoutGuides>
<viewControllerLayoutGuide type="top" id="jXf-FB-Fgb"/>
<viewControllerLayoutGuide type="bottom" id="krh-jV-bGI"/>
</layoutGuides>
<view key="view" contentMode="scaleToFill" id="22">
<rect key="frame" x="0.0" y="64" width="320" height="504"/>
<rect key="frame" x="0.0" y="0.0" width="320" height="568"/>
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMaxY="YES"/>
<subviews>
<label clipsSubviews="YES" userInteractionEnabled="NO" contentMode="scaleToFill" text="Detail view content goes here" textAlignment="center" lineBreakMode="tailTruncation" minimumFontSize="10" translatesAutoresizingMaskIntoConstraints="NO" id="27">
<rect key="frame" x="20" y="9" width="280" height="17"/>
<color key="backgroundColor" white="1" alpha="1" colorSpace="calibratedWhite"/>
<fontDescription key="fontDescription" type="system" size="system"/>
<color key="textColor" cocoaTouchSystemColor="darkTextColor"/>
<nil key="highlightedColor"/>
</label>
<button opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" buttonType="roundedRect" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="BGA-y0-odx">
<fontDescription key="fontDescription" type="boldSystem" pointSize="15"/>
<rect key="frame" x="20" y="431" width="46" height="30"/>
<state key="normal" title="Button">
<color key="titleColor" red="0.19607843459999999" green="0.30980393290000002" blue="0.52156865600000002" alpha="1" colorSpace="calibratedRGB"/>
<color key="titleShadowColor" white="0.5" alpha="1" colorSpace="calibratedWhite"/>
</state>
<state key="highlighted">
<color key="titleColor" white="1" alpha="1" colorSpace="calibratedWhite"/>
</state>
</button>
</subviews>
<color key="backgroundColor" white="1" alpha="1" colorSpace="custom" customColorSpace="calibratedWhite"/>
<constraints>
<constraint firstAttribute="bottom" secondItem="BGA-y0-odx" secondAttribute="bottom" constant="107" id="Oz5-UI-e4N"/>
<constraint firstItem="27" firstAttribute="leading" secondItem="22" secondAttribute="leading" constant="20" symbolic="YES" type="default" id="R0m-z7-TWk"/>
<constraint firstItem="BGA-y0-odx" firstAttribute="leading" secondItem="22" secondAttribute="leading" constant="20" symbolic="YES" type="default" id="a4V-WS-rvQ"/>
<constraint firstItem="27" firstAttribute="leading" secondItem="22" secondAttribute="leading" constant="20" symbolic="YES" id="R0m-z7-TWk"/>
<constraint firstItem="BGA-y0-odx" firstAttribute="leading" secondItem="22" secondAttribute="leading" constant="20" symbolic="YES" id="a4V-WS-rvQ"/>
<constraint firstItem="27" firstAttribute="top" secondItem="22" secondAttribute="top" constant="9" id="fqs-Iu-ZEi"/>
<constraint firstAttribute="trailing" secondItem="27" secondAttribute="trailing" constant="20" symbolic="YES" type="default" id="pRe-qY-58T"/>
<constraint firstAttribute="trailing" secondItem="27" secondAttribute="trailing" constant="20" symbolic="YES" id="pRe-qY-58T"/>
</constraints>
</view>
<navigationItem key="navigationItem" title="Detail" id="26"/>
Expand All @@ -107,23 +108,9 @@
<point key="canvasLocation" x="902" y="64"/>
</scene>
</scenes>
<classes>
<class className="DetailViewController" superclassName="UIViewController">
<source key="sourceIdentifier" type="project" relativePath="./Classes/DetailViewController.h"/>
<relationships>
<relationship kind="outlet" name="detailDescriptionLabel" candidateClass="UILabel"/>
</relationships>
</class>
<class className="MasterViewController" superclassName="UITableViewController">
<source key="sourceIdentifier" type="project" relativePath="./Classes/MasterViewController.h"/>
</class>
<class className="NSLayoutConstraint" superclassName="NSObject">
<source key="sourceIdentifier" type="project" relativePath="./Classes/NSLayoutConstraint.h"/>
</class>
</classes>
<simulatedMetricsContainer key="defaultSimulatedMetrics">
<simulatedStatusBarMetrics key="statusBar"/>
<simulatedOrientationMetrics key="orientation"/>
<simulatedScreenMetrics key="destination" type="retina4"/>
</simulatedMetricsContainer>
</document>
</document>
2 changes: 1 addition & 1 deletion features/support/hooks.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
Before do
launch_app APP_BUNDLE_PATH, '6.1', 'ipad'
launch_app APP_BUNDLE_PATH, '7.1', 'ipad'
end
6 changes: 6 additions & 0 deletions lib/furter.rb
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,12 @@ def wait_for_and_touch(locator)
touch locator
end
end

def wait_for_and_tap(locator, duration)
wait_for(locator) do |locator|
tap_and_hold locator, duration
end
end
end


Expand Down
2 changes: 1 addition & 1 deletion lib/furter/accessors/switch.rb
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ def on?
end

def set(on_or_off)
click if on_or_off != on?
tap_and_hold_for 0.1 if on_or_off != on?
end

private
Expand Down
5 changes: 4 additions & 1 deletion lib/furter/accessors/view.rb
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,13 @@ def initialize(locator={})
end

def click

wait_for_and_touch selector
end

def tap_and_hold_for(duration)
wait_for_and_tap(selector, duration)
end

def visible?
element_is_not_hidden selector
end
Expand Down
4 changes: 2 additions & 2 deletions spec/lib/furter/accessors/switch_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -16,13 +16,13 @@

it 'can turn it off or on' do
switch.should_receive(:on?).and_return(true, false)
switch.should_receive(:click).twice
switch.should_receive(:tap_and_hold_for).twice
[false, true].each { |on_or_off| switch.set on_or_off }
end

it 'will only toggle if in the expected state' do
switch.should_receive(:frankly_map).with(anything, 'isOn').and_return([false])
switch.should_not_receive(:click)
switch.should_not_receive(:tap_and_hold_for)
switch.set false
end
end
6 changes: 6 additions & 0 deletions spec/lib/furter/accessors/view_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,12 @@
view.click
end

it 'can be tapped' do
expected_duration = 0.1
view.should_receive(:wait_for_and_tap).with(selector, expected_duration)
view.tap_and_hold_for(expected_duration)
end

it 'knows if it is visible' do
view.should_receive(:element_is_not_hidden).with(selector).and_return(true)
view.should be_visible
Expand Down