1   package org.paneris.jammyjoes.functional;
2   
3   import net.sourceforge.jwebunit.WebTestCase;
4   
5   public class TestCaseFunctionalSearch extends WebTestCase {
6   
7      public TestCaseFunctionalSearch(String name) {
8         super(name);
9      }
10  
11     public void setUp() {
12        getTestContext().setBaseUrl("http://localhost/toys");
13     }
14  
15    public void testType2SearchPathInfo() throws Exception {
16      beginAt("/_/50");
17      assertTextPresent("Jennie - My First Doll");
18      beginAt("/_/0");
19      assertTextPresent("Jennie - My First Doll");
20    }
21  
22    public void testDiscontinuedSingleItem() throws Exception {
23      beginAt("/1025");
24      assertTextPresent("Sorry, we no longer stock this item");
25    }
26  
27    public void testSingleItemRelatedLinks() throws Exception {
28      beginAt("/2233");
29      assertTextPresent("Accessories For Kitchen");
30      assertTextPresent("Similar items now in stock");
31      assertTextPresent("Pintoy Wooden Dollshouse Scooter");
32    }
33  
34    public void testTroidSearch() throws Exception {
35      beginAt("/2233");
36      assertTextPresent("Accessories For Kitchen");
37      assertTextPresent("1 matches");
38    }
39  
40    public void testNameSearch() throws Exception {
41      beginAt("/Accessories For Kitchen");
42      assertTextPresent("Accessories For Kitchen");
43      assertTextPresent("1 matches");
44    }
45  
46    public void testOutOfStockSearch() throws Exception {
47      beginAt("/_/_/_/_/_/_/oos");
48      assertTextPresent("Pampered Princess Vanity");
49    }
50  
51    public void testDescriptionSearch() throws Exception {
52      beginAt("/");
53      setFormElement("field_description", "Wooden Noah's Ark");
54      submit();
55      assertTextPresent("beautifully made wooden Noah's Ark");
56    }
57  
58    public void testDescriptionOrBasedSearch() throws Exception {
59      beginAt("/");
60      setFormElement("field_description", "Pink Wooden Noah's Ark");
61      submit();
62      assertTextPresent("beautifully made wooden Noah's Ark");
63    }
64  
65    public void testDescriptionSearchPathInfo() throws Exception {
66      beginAt("/_/_/_/_/Bathroom Furniture");
67      assertTextPresent("Bathroom Furniture");
68    }
69  
70    public void testTypeSearch() throws Exception {
71      beginAt("/");
72      setFormElement("field_type", "7");
73      submit();
74      assertTextPresent("Brum Brum Apron");
75    }
76  
77    public void testTypeSearchPathInfo() throws Exception {
78      beginAt("/_/7");
79      assertTextPresent("Brum Brum Apron");
80    }
81  
82    public void testTypeSearchPathInfoByName() throws Exception {
83      beginAt("/_/Art+and+Craft");
84      assertTextPresent("Brum Brum Apron");
85    }
86  
87    public void testSupplierSearchPathInfo() throws Exception {
88      beginAt("/_/_/_/_/_/_/_/_/_/BigJigs");
89      assertTextPresent("Wooden Sun Rope Swing");
90    }
91  
92    public void testManufacturerSearchPathInfo() throws Exception {
93      beginAt("/_/_/_/_/_/_/_/_/BRIO");
94      assertTextPresent("Brio Fuel Wagon");
95    }
96  
97    public void testAgeSearch() throws Exception {
98      beginAt("/");
99      setFormElement("field_age", "7 year olds");
100     submit();
101     assertTextPresent("Tiny Tears So Loving");
102   }
103 
104   public void testPriceSearch() throws Exception {
105     beginAt("/_/_/_/50_9999");
106     assertTextPresent("Enchanted Palace");
107   }
108 
109   public void testPriceSearchPathInfo() throws Exception {
110     beginAt("/");
111     setFormElement("field_price", "50_9999");
112     submit();
113     assertTextPresent("Enchanted Palace");
114   }
115 
116 }