Skip to content
Permalink
Browse files

Add save button

We put a Save button into the view and give it an accessibility identifier of "saveButton" so the test can find it.

![save button](saveButton.png)

Next, the test sees that the new message field isn't correctly cleared out when the Save button is tapped:

Red: AssertionFailedException. Element Matcher: accessibilityID('messageTextField'), Assertion Criteria: hasText('')
  • Loading branch information...
CodingItWrong committed Jan 2, 2018
1 parent 415591a commit 352589db3a3e2e6ce5dd6a1dc5bd2c0cf0dcc7bc
Showing with 9 additions and 1 deletion.
  1. +9 −1 LearnTDDInCocoaTouch/Base.lproj/Main.storyboard
@@ -22,13 +22,21 @@
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMaxY="YES"/>
<subviews>
<textField opaque="NO" contentMode="scaleToFill" fixedFrame="YES" contentHorizontalAlignment="left" contentVerticalAlignment="center" borderStyle="roundedRect" textAlignment="natural" minimumFontSize="17" translatesAutoresizingMaskIntoConstraints="NO" id="OZZ-xr-cgC">
<rect key="frame" x="8" y="8" width="353" height="30"/>
<rect key="frame" x="8" y="8" width="317" height="30"/>
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMaxY="YES"/>
<accessibility key="accessibilityConfiguration" identifier="messageTextField"/>
<nil key="textColor"/>
<fontDescription key="fontDescription" type="system" pointSize="14"/>
<textInputTraits key="textInputTraits"/>
</textField>
<button opaque="NO" contentMode="scaleToFill" fixedFrame="YES" contentHorizontalAlignment="center" contentVerticalAlignment="center" buttonType="roundedRect" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="hc2-Pw-ADC">
<rect key="frame" x="333" y="8" width="34" height="30"/>
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMaxY="YES"/>
<accessibility key="accessibilityConfiguration" identifier="saveButton">
<accessibilityTraits key="traits" button="YES"/>
</accessibility>
<state key="normal" title="Save"/>
</button>
</subviews>
<color key="backgroundColor" white="1" alpha="1" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/>
</view>

0 comments on commit 352589d

Please sign in to comment.
You can’t perform that action at this time.