Skip to content

Commit

Permalink
Create cheatsheet for EarlGrey (google#97)
Browse files Browse the repository at this point in the history
  • Loading branch information
bootstraponline authored and tirodkar committed May 26, 2016
1 parent cc1d6f2 commit 76ed27d
Show file tree
Hide file tree
Showing 5 changed files with 381 additions and 0 deletions.
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ configured, take a look at the EarlGrey API and start writing your own tests.
* [Backward Compatibility](https://github.com/google/EarlGrey/tree/master/docs/backward-compatibility.md)
* [Install and Run](https://github.com/google/EarlGrey/tree/master/docs/install-and-run.md)
* [API](https://github.com/google/EarlGrey/tree/master/docs/api.md)
* [Cheat Sheet](docs/cheatsheet/cheatsheet.png)

## Getting Help

Expand Down
213 changes: 213 additions & 0 deletions docs/cheatsheet/cheatsheet.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,213 @@
/*
Copyright 2016 Google Inc.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/

@import url(https://fonts.googleapis.com/css?family=Droid+Sans+Mono|Ubuntu:400,700,300);

ol, ul {
list-style:none;
}

* {
margin: 0;
padding: 0;
}

body {
font-weight: bold;
font-family: 'Droid Sans Mono';
background-color: #eee;
}

p, ul {
padding: 1em;
}

ul {
display: flex;
flex-wrap: wrap;
justify-content: space-between;
background: #eee;
max-width: var(--max-width);
}

li:nth-child(1) {
background: inherit;
flex-basis: 100%;
border: none;
box-shadow: none;
}

ul li {
flex-basis: 40%;
text-transform: uppercase;
}

li:nth-child(even) {
margin-right: 0.5em;
}

.body > ul:nth-child(1) > li:nth-child(1) {
text-transform: initial;
padding-bottom: 0;
padding-top: 0;
font-size: 3em;
font-family: 'Ubuntu', sans-serif;
}

.body > ul:nth-child(1) li {
color: var(--pink-color);
border-color: var(--pink-color);
font-family: 'Ubuntu', sans-serif;
}

.body > ul:nth-child(2) > li:nth-child(1) {
text-transform: initial;
padding-bottom: 0;
padding-top: 0;
margin: 0;
font-size: 3em;
font-family: 'Ubuntu', sans-serif;
}

.body > ul:nth-child(2) li {
color: var(--blue-color);
border-color: var(--blue-color);
font-family: 'Ubuntu', sans-serif;
}

.body > ul:nth-child(3) > li:nth-child(1) {
text-transform: initial;
padding-bottom: 0;
padding-top: 0;
margin: 0;
font-size: 3em;
font-family: 'Ubuntu', sans-serif;
}

.body > ul:nth-child(3) li {
color: var(--green-color);
border-color: var(--green-color);
font-family: 'Ubuntu', sans-serif;
}

:root {
--pink-color: #e92663;
--green-color: #57bb8a;
--blue-color: #4285f4;
--max-width: 60em;
}

ul > li > ul > li {
text-transform: initial !important;
color: black !important;
border: none;
box-shadow: none;
font-weight: normal;
padding: 0;
margin: 0.2em 0 0 0;
flex-basis: 100%;
font-family: 'Droid Sans Mono' !important;
}

ul > li > ul {
padding: 0;
margin: 0;
background: white;
}

li {
flex: 4em 1 0;
padding: 0.6em;
background: white;
box-sizing: border-box;
border: solid 0.13em #666;
border-radius: 1em;
box-shadow: 0.3em 0.3em 0px 0px #dcdcdc;
text-align: left;
margin-top: 0.5em;
}

.hide {
visibility: hidden;
}

.header {
display: flex;
flex-wrap: wrap;
justify-content: space-between;
max-width: var(--max-width);
}

.usage {
font-family: 'Ubuntu', sans-serif;
font-weight: normal;
white-space: pre;
height: 3em;
padding-left: 1em;
}

.usage .one {
font-weight: bold;
}

.usage .two {
font-weight: bold;
color: var(--pink-color);
font-family: 'Ubuntu', sans-serif;
}

.usage .three {
font-weight: bold;
color: var(--blue-color);
font-family: 'Ubuntu', sans-serif;
}

.cheatsheet {
height: 0.5em;
font-weight: 300;
padding-right: 1em;
padding-top: 1em;
font-family: 'Ubuntu', sans-serif;
font-size: 2em;
}

.objc {
text-transform: uppercase !important;
padding-top: 1em;
color: var(--pink-color) !important;
font-weight: bold;
font-family: 'Ubuntu', sans-serif !important;
}

@media print {
body {
font-size: 55%;
}

ul {
max-width: 100%;
}

.header {
max-width: 100%;
}

li {
max-width: 60%;
/* chrome can't handle box shadows in PDF : https://bugs.chromium.org/p/chromium/issues/detail?id=174583 */
box-shadow: none;
}
}
167 changes: 167 additions & 0 deletions docs/cheatsheet/cheatsheet.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,167 @@
<!--
Copyright 2016 Google Inc.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
-->

<!DOCTYPE html>
<!--
Only renders in Chrome.
cheatsheet.pdf: Save as PDF from Chrome
cheatsheet.png: Save as image from Chrome using https://chrome.google.com/webstore/detail/full-page-screen-capture/fdpohaocaechififmbbbbbknoalclacl
-->
<html>
<head>
<meta http-equiv="content-type" content="text/html; charset=UTF-8">
<link rel="stylesheet" type="text/css" href="cheatsheet.css">
</head>
<body>

<div class="header">
<div class="usage">
<span class="one">EarlGrey().selectElementWithMatcher</span>(<span class="two">ViewMatcher</span>)
.performAction(<span class="three">ViewAction</span>)
.assertWithMatcher(<span class="two">ViewMatcher</span>)
</pre>
</div>

<div class="cheatsheet">
EarlGrey 1.0.0
</div>
</div>

<div class="body">
<ul>
<li>View Matchers</li>
<li>User Properties
<ul>
<li>grey_accessibilityID(...)</li>
<li>grey_accessibilityLabel(...)</li>
<li>grey_accessibilityValue(...)</li>
<li>grey_accessibilityTrait(...)</li>
<li>grey_accessibilityHint(...)</li>
<li>grey_text(...)</li>
</ul>
</li>
<li>UI Properties
<ul>
<li>grey_minimumVisiblePercent(...)</li>
<li>grey_sufficientlyVisible()</li>
<li>grey_interactable()</li>
<li>grey_notVisible()</li>
<li>grey_systemAlertViewShown()</li>
<li>grey_enabled()</li>
<li>grey_layout(...)</li>
<li>grey_nil()</li>
<li>grey_notNil()</li>
</ul>
</li>
<li>Hierarchy
<ul>
<li>grey_ancestor(...)</li>
<li>grey_descendant(...)</li>
</ul>
</li>
<li>Class
<ul>
<li>grey_kindOfClass(...)</li>
<li>grey_respondsToSelector(...)</li>
<li>grey_conformsToProtocol(...)</li>
</ul>
</li>
<li>Other
<ul>
<li>grey_keyWindow()</li>
<li>grey_firstResponder()</li>
<li>grey_accessibilityElement()</li>
<li>grey_progress(...)</li>
<li>grey_buttonTitle(...)</li>
<li>grey_stepperValue(...)</li>
<li>grey_sliderValueMatcher(...)</li>
<li>grey_pickerColumnSetToValue(...)</li>
<li>grey_datePickerValue(...)</li>
<li>grey_switchWithOnState(...)</li>
<li>grey_closeTo(...)</li>
</ul>
</li>
<li>Object Matchers - Swift
<ul>
<li>grey_allOfMatchers(...)</li>
<li>grey_anyOfMatchers(...)</li>
<li class="objc">Object Matchers - Objective C</li>
<li>grey_allOf(...)</li>
<li>grey_anyOf(...)</li>
</ul>
</li>
</ul>

<ul>
<li>View Actions</li>
<li>Click/Press
<ul>
<li>grey_tap()</li>
<li>grey_tapAtPoint(...)</li>
<li>grey_doubleTap()</li>
<li>grey_longPress()</li>
<li>grey_longPressWithDuration(...)</li>
<li>grey_longPressAtPointWithDuration(...)</li>
</ul>
</li>
<li>Gestures
<ul>
<li>grey_scrollInDirection(...)</li>
<li>grey_scrollToContentEdge(...)</li>
<li>grey_swipeFastInDirection(...)</li>
<li>grey_swipeSlowInDirection(...)</li>
<li>grey_swipeFastInDirectionWithStartPoint(...)</li>
<li>grey_swipeSlowInDirectionWithStartPoint(...)</li>
</ul>
</li>
<li>Text
<ul>
<li>grey_typeText(...)</li>
<li>grey_clearText()</li>
</ul>
</li>
<li>Other
<ul>
<li>grey_moveSliderToValue(...)</li>
<li>grey_setStepperValue(...)</li>
<li>grey_turnSwitchOn(...)</li>
<li>grey_setDate(...)</li>
<li>grey_setPickerColumnToValue(...)</li>
<li>grey_javaScriptExecution(...)</li>
<li>grey_snapshot(...)</li>
</ul>
</li>
</ul>

<ul>
<li>Assertions</li>
<li>Grey Assert
<ul>
<li>GREYAssert(...)</li>
<li>GREYAssertTrue(...)</li>
<li>GREYAssertFalse(...)</li>
<li>GREYAssertNotNil(...)</li>
<li>GREYAssertNil(...)</li>
<li>GREYAssertEqual(...)</li>
<li>GREYFail(...)</li>
</ul>
</li>
<li class="hide"></li>
</ul>
</div>
</body>
</html>
Binary file added docs/cheatsheet/cheatsheet.pdf
Binary file not shown.
Binary file added docs/cheatsheet/cheatsheet.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

0 comments on commit 76ed27d

Please sign in to comment.