1
package org.sikuli.script.guide.test;
3
import java.awt.AWTException;
7
import org.sikuli.guide.SikuliGuide;
8
import org.sikuli.script.App;
9
import org.sikuli.script.Debug;
10
import org.sikuli.script.FindFailed;
11
import org.sikuli.script.FindFailedResponse;
12
import org.sikuli.script.Location;
13
import org.sikuli.script.Pattern;
14
import org.sikuli.script.Region;
15
import org.sikuli.script.Screen;
16
import org.sikuli.script.Settings;
19
public class SikuliGuideTest {
21
public void testFirefox() throws FindFailed {
23
App a = new App("Firefox");
31
// Region s = a.window(0);
33
Screen s = new Screen();
37
// s.setFindFailedResponse(FindFailedResponse.PROMPT);
40
// Settings.ShowActions = true;
44
// s.click("tools.png",0);
46
SikuliGuide sa = new SikuliGuide();
48
r = s.find("tools.png");
52
// sa.showWaitForButtonClick("Continue", "Tools");
57
public void testICDLSimpleSearch() throws FindFailed{
58
App a = new App("Firefox");
61
Screen s = new Screen();
63
SikuliGuide sa = new SikuliGuide();
65
Location o = s.getTopLeft();
67
sa.addText(o,"1. All the different categories we see in the " +
68
"Simple Search are like the shelves in a regular library. Today, " +
69
"we are looking for Fairy Tales, so, we are going to look for " +
70
"them by clicking on the Fairy Tales button!");
73
r = s.find(new Pattern("fairy.png").similar(0.95f));
74
sa.addClickTarget(r,"");
79
sa.addText(o,"2. If we want to refine our search further, we can select other categories as well. " +
80
"If we only want Fairy Tales that are for ages three to five, we can select " +
81
"the Three to Five button as well. To remove a category from the search," +
82
" click it again to unselect it.");
83
r = s.find(new Pattern("three2five.png").similar(0.95f));
84
sa.addClickTarget(r,"");
91
} catch (AWTException e) {
96
sa.addDialog("Next","3. Now we can see all the Fairy Tale books for age Three to Five in the library. " +
97
"We can use the arrows in the results section to page through " +
98
"all the different books. ");
99
r = s.find(new Pattern("right.png").similar(0.95f));
101
r = s.find(new Pattern("left.png").similar(0.95f));
106
sa.addDialog("Finish", "4. To start over with and do a new search, " +
107
"we can click the Trash Can button. To learn how to read a book" +
108
" go to the reading books section.");
109
r = s.find(new Pattern("trashcan.png").similar(0.95f));
115
public void testMute() throws FindFailed{
116
//App a = new App("System Preferences");
119
Region s = new Screen(0);
124
s.setFindFailedResponse(FindFailedResponse.PROMPT);
129
SikuliGuide sa = new SikuliGuide(s);
130
r = s.find("sound.png");
131
sa.addText(r.getBottomLeft().below(5),"Click this");
133
sa.addClickTarget(r, "");
134
//sa.addDialog("Next", "Hello");
137
sa.addDialog("Next", "Another step");
140
sa.addDialog("Next", "Yet another step");
147
public void testICDL() throws FindFailed{
149
//App a = new App("Firefox");
153
Screen s = new Screen();
154
SikuliGuide sa = new SikuliGuide(s);
156
sa.addDialog("Next","Welcome!");
159
r = s.find("tiger.png");
161
Location o = r.getTopLeft().above(100);
163
sa.addText(o,"Click on the Tiger or the Unicorn");
164
sa.addClickTarget(r,"Tiger");
166
sa.addClickTarget(s.find("unicorn.png"),"Unicorn");
170
sa.addText(o, "You just clicked on the " + sa.getLastClickedTarget().getName());