22
33import android .support .test .rule .ActivityTestRule ;
44import android .support .test .runner .AndroidJUnit4 ;
5- import android .test .suitebuilder .annotation .LargeTest ;
65
76import org .junit .Rule ;
87import org .junit .Test ;
2827import static org .wordpress .aztec .demo .TestUtils .headingTwoSelector ;
2928import static org .wordpress .aztec .demo .TestUtils .italicButton ;
3029import static org .wordpress .aztec .demo .TestUtils .linkButton ;
31- import static org .wordpress .aztec .demo .TestUtils .linkOKButton ;
3230import static org .wordpress .aztec .demo .TestUtils .linkTextField ;
3331import static org .wordpress .aztec .demo .TestUtils .linkURLField ;
3432import static org .wordpress .aztec .demo .TestUtils .linkURLText ;
33+ import static org .wordpress .aztec .demo .TestUtils .listButton ;
34+ import static org .wordpress .aztec .demo .TestUtils .listOrderedSelector ;
35+ import static org .wordpress .aztec .demo .TestUtils .listUnorderedSelector ;
3536import static org .wordpress .aztec .demo .TestUtils .moreButton ;
36- import static org .wordpress .aztec .demo .TestUtils .orderedListButton ;
37- import static org .wordpress .aztec .demo .TestUtils .pageButton ;
38- import static org .wordpress .aztec .demo .TestUtils .preSelector ;
3937import static org .wordpress .aztec .demo .TestUtils .quoteButton ;
4038import static org .wordpress .aztec .demo .TestUtils .sourceText ;
4139import static org .wordpress .aztec .demo .TestUtils .strikethroughButton ;
4240import static org .wordpress .aztec .demo .TestUtils .toggleHTMLView ;
4341import static org .wordpress .aztec .demo .TestUtils .underlineButton ;
4442import static org .wordpress .aztec .demo .TestUtils .unformattedText ;
45- import static org .wordpress .aztec .demo .TestUtils .unorderedListButton ;
4643
47- @ LargeTest
4844@ RunWith (AndroidJUnit4 .class )
4945public class SimpleTextFormattingTests {
5046
@@ -55,7 +51,7 @@ public class SimpleTextFormattingTests {
5551 public void testSimpleBoldFormatting () {
5652 // Enter text in visual editor with formatting
5753 aztecText .perform (typeText (unformattedText ));
58- boldButton .perform (click ());
54+ boldButton .perform (betterScrollTo (), betterClick ());
5955 aztecText .perform (typeText (formattedText ));
6056
6157 // Check that HTML formatting tags were correctly added
@@ -67,7 +63,7 @@ public void testSimpleBoldFormatting() {
6763 public void testSimpleItalicFormatting () {
6864 // Enter text in visual editor with formatting
6965 aztecText .perform (typeText (unformattedText ));
70- italicButton .perform (click ());
66+ italicButton .perform (betterScrollTo (), betterClick ());
7167 aztecText .perform (typeText (formattedText ));
7268
7369 // Check that HTML formatting tags were correctly added
@@ -79,7 +75,7 @@ public void testSimpleItalicFormatting() {
7975 public void testSimpleStrikethroughFormatting () {
8076 // Enter text in visual editor with formatting
8177 aztecText .perform (typeText (unformattedText ));
82- strikethroughButton .perform (click ());
78+ strikethroughButton .perform (betterScrollTo (), betterClick ());
8379 aztecText .perform (typeText (formattedText ));
8480
8581 // Check that HTML formatting tags were correctly added
@@ -91,7 +87,7 @@ public void testSimpleStrikethroughFormatting() {
9187 public void testSimpleUnderlineFormatting () {
9288 // Enter text in visual editor with formatting
9389 aztecText .perform (typeText (unformattedText ));
94- underlineButton .perform (click ());
90+ underlineButton .perform (betterScrollTo (), betterClick ());
9591 aztecText .perform (typeText (formattedText ));
9692
9793 // Check that HTML formatting tags were correctly added
@@ -103,7 +99,7 @@ public void testSimpleUnderlineFormatting() {
10399 public void testSimpleQuoteFormatting () {
104100 // Enter text in visual editor with formatting
105101 aztecText .perform (typeText (unformattedText + "\n " ));
106- quoteButton .perform (click ());
102+ quoteButton .perform (betterScrollTo (), betterClick ());
107103 aztecText .perform (typeText (formattedText ));
108104
109105 // Check that HTML formatting tags were correctly added
@@ -115,7 +111,8 @@ public void testSimpleQuoteFormatting() {
115111 public void testSimpleUnorderedListFormatting () {
116112 // Enter text in visual editor with formatting
117113 aztecText .perform (typeText (unformattedText + "\n " ));
118- unorderedListButton .perform (scrollTo (), click ());
114+ listButton .perform (scrollTo (), click ());
115+ listUnorderedSelector .perform (betterClick ());
119116 aztecText .perform (typeText (formattedText ));
120117
121118 // Check that HTML formatting tags were correctly added
@@ -127,7 +124,8 @@ public void testSimpleUnorderedListFormatting() {
127124 public void testSimpleOrderedListFormatting () {
128125 // Enter text in visual editor with formatting
129126 aztecText .perform (typeText (unformattedText + "\n " ));
130- orderedListButton .perform (scrollTo (), click ());
127+ listButton .perform (scrollTo (), click ());
128+ listOrderedSelector .perform (betterClick ());
131129 aztecText .perform (typeText (formattedText ));
132130
133131 // Check that HTML formatting tags were correctly added
@@ -148,7 +146,7 @@ public void testSimpleLinkFormatting() {
148146
149147 // Check that link dialog contains the correct values
150148 toggleHTMLView ();
151- linkButton .perform (scrollTo (), click ());
149+ linkButton .perform (scrollTo (), betterClick ());
152150 linkURLField .check (matches (withText (linkURLText )));
153151 linkTextField .check (matches (withText (formattedText )));
154152 }
@@ -165,24 +163,25 @@ public void testSimpleMoreTagFormatting() {
165163 sourceText .check (matches (withText (unformattedText + "\n \n <!--more-->\n \n " + unformattedText )));
166164 }
167165
168- @ Test
169- public void testSimplePageBreakFormatting () {
170- // Enter text in visual editor with page break in between
171- aztecText .perform (typeText (unformattedText ));
172- pageButton .perform (betterScrollTo (), betterClick ());
173- aztecText .perform (typeTextIntoFocusedView (unformattedText ));
174-
175- // Check that page break was correctly added
176- toggleHTMLView ();
177- sourceText .check (matches (withText (unformattedText + "\n \n <!--nextpage-->\n \n " + unformattedText )));
178- }
166+ //TODO: uncomment when Page Break is to be added back as a feature
167+ // @Test
168+ // public void testSimplePageBreakFormatting() {
169+ // // Enter text in visual editor with page break in between
170+ // aztecText.perform(typeText(unformattedText));
171+ // pageButton.perform(betterScrollTo(), betterClick());
172+ // aztecText.perform(typeTextIntoFocusedView(unformattedText));
173+ //
174+ // // Check that page break was correctly added
175+ // toggleHTMLView();
176+ // sourceText.check(matches(withText(unformattedText + "\n\n<!--nextpage-->\n\n" + unformattedText)));
177+ // }
179178
180179 @ Test
181180 public void testSimpleHeadingOneFormatting () {
182181 // Enter text in visual editor with formatting
183182 aztecText .perform (typeText (unformattedText + "\n " ));
184- headingButton .perform (click ());
185- headingOneSelector .perform (click ());
183+ headingButton .perform (betterScrollTo (), betterClick ());
184+ headingOneSelector .perform (betterClick ());
186185 aztecText .perform (typeTextIntoFocusedView (formattedText ));
187186
188187 // Check that HTML formatting tags were correctly added
@@ -194,8 +193,8 @@ public void testSimpleHeadingOneFormatting() {
194193 public void testSimpleHeadingTwoFormatting () {
195194 // Enter text in visual editor with formatting
196195 aztecText .perform (typeText (unformattedText + "\n " ));
197- headingButton .perform (click ());
198- headingTwoSelector .perform (click ());
196+ headingButton .perform (betterScrollTo (), betterClick ());
197+ headingTwoSelector .perform (betterClick ());
199198 aztecText .perform (typeTextIntoFocusedView (formattedText ));
200199
201200 // Check that HTML formatting tags were correctly added
@@ -207,8 +206,8 @@ public void testSimpleHeadingTwoFormatting() {
207206 public void testSimpleHeadingThreeFormatting () {
208207 // Enter text in visual editor with formatting
209208 aztecText .perform (typeText (unformattedText + "\n " ));
210- headingButton .perform (click ());
211- headingThreeSelector .perform (click ());
209+ headingButton .perform (betterScrollTo (), betterClick ());
210+ headingThreeSelector .perform (betterClick ());
212211 aztecText .perform (typeTextIntoFocusedView (formattedText ));
213212
214213 // Check that HTML formatting tags were correctly added
@@ -220,8 +219,8 @@ public void testSimpleHeadingThreeFormatting() {
220219 public void testSimpleHeadingFourFormatting () {
221220 // Enter text in visual editor with formatting
222221 aztecText .perform (typeText (unformattedText + "\n " ));
223- headingButton .perform (click ());
224- headingFourSelector .perform (click ());
222+ headingButton .perform (betterScrollTo (), betterClick ());
223+ headingFourSelector .perform (betterClick ());
225224 aztecText .perform (typeTextIntoFocusedView (formattedText ));
226225
227226 // Check that HTML formatting tags were correctly added
@@ -233,8 +232,8 @@ public void testSimpleHeadingFourFormatting() {
233232 public void testSimpleHeadingFiveFormatting () {
234233 // Enter text in visual editor with formatting
235234 aztecText .perform (typeText (unformattedText + "\n " ));
236- headingButton .perform (click ());
237- headingFiveSelector .perform (click ());
235+ headingButton .perform (betterScrollTo (), betterClick ());
236+ headingFiveSelector .perform (betterClick ());
238237 aztecText .perform (typeTextIntoFocusedView (formattedText ));
239238
240239 // Check that HTML formatting tags were correctly added
@@ -246,25 +245,27 @@ public void testSimpleHeadingFiveFormatting() {
246245 public void testSimpleHeadingSixFormatting () {
247246 // Enter text in visual editor with formatting
248247 aztecText .perform (typeText (unformattedText + "\n " ));
249- headingButton .perform (click ());
250- headingSixSelector .perform (click ());
248+ headingButton .perform (betterScrollTo (), betterClick ());
249+ headingSixSelector .perform (betterClick ());
251250 aztecText .perform (typeTextIntoFocusedView (formattedText ));
252251
253252 // Check that HTML formatting tags were correctly added
254253 toggleHTMLView ();
255254 sourceText .check (matches (withText (unformattedText + "\n <h6>" + formattedText + "</h6>" )));
256255 }
257256
258- @ Test
259- public void testSimplePreformattedTextFormatting () {
260- // Enter text in visual editor with formatting
261- aztecText .perform (typeText (unformattedText + "\n " ));
262- headingButton .perform (click ());
263- preSelector .perform (click ());
264- aztecText .perform (typeTextIntoFocusedView (formattedText ));
257+ //TODO: uncomment when Preformatted will be added back as a feature
258+ // @Test
259+ // public void testSimplePreformattedTextFormatting() {
260+ // // Enter text in visual editor with formatting
261+ // aztecText.perform(typeText(unformattedText + "\n"));
262+ // headingButton.perform(betterScrollTo(),betterClick());
263+ // preSelector.perform(betterScrollTo(),betterClick());
264+ // aztecText.perform(typeTextIntoFocusedView(formattedText));
265+ //
266+ // // Check that HTML formatting tags were correctly added
267+ // toggleHTMLView();
268+ // sourceText.check(matches(withText(unformattedText + "\n<pre>" + formattedText + "</pre>")));
269+ // }
265270
266- // Check that HTML formatting tags were correctly added
267- toggleHTMLView ();
268- sourceText .check (matches (withText (unformattedText + "\n <pre>" + formattedText + "</pre>" )));
269- }
270271}
0 commit comments