View Javadoc
1   /*
2    * Copyright (c) 2002-2025 Gargoyle Software Inc.
3    *
4    * Licensed under the Apache License, Version 2.0 (the "License");
5    * you may not use this file except in compliance with the License.
6    * You may obtain a copy of the License at
7    * https://www.apache.org/licenses/LICENSE-2.0
8    *
9    * Unless required by applicable law or agreed to in writing, software
10   * distributed under the License is distributed on an "AS IS" BASIS,
11   * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12   * See the License for the specific language governing permissions and
13   * limitations under the License.
14   */
15  package org.htmlunit.libraries;
16  
17  import java.util.List;
18  
19  import org.htmlunit.WebServerTestCase;
20  import org.junit.jupiter.api.BeforeAll;
21  import org.junit.jupiter.api.Test;
22  import org.openqa.selenium.By;
23  import org.openqa.selenium.WebDriver;
24  import org.openqa.selenium.WebElement;
25  
26  /**
27   * Tests for compatibility with version 1.5.0-rc1 of
28   * <a href="http://www.prototypejs.org/">Prototype JavaScript library</a>.
29   *
30   * @author Daniel Gredler
31   * @author Ahmed Ashour
32   * @author Marc Guillemot
33   * @author Ronald Brill
34   */
35  public class Prototype150rc1Test extends PrototypeTestBase {
36  
37      /**
38       * @throws Exception if an error occurs
39       */
40      @BeforeAll
41      public static void startSesrver() throws Exception {
42          SERVER_ = WebServerTestCase.createWebServer("src/test/resources/libraries/prototype/1.5.0-rc1/", null);
43      }
44  
45      /**
46       * {@inheritDoc}
47       */
48      @Override
49      protected String getVersion() {
50          return "1.5.0-rc1";
51      }
52  
53      /**
54       * @return the resource base url
55       */
56      @Override
57      protected String getBaseUrl() {
58          return URL_FIRST + "test/unit/";
59      }
60  
61      @Override
62      protected boolean testFinished(final WebDriver driver) {
63          final List<WebElement> status = driver.findElements(By.cssSelector("div#logsummary"));
64          for (final WebElement webElement : status) {
65              if (!webElement.getText().contains("errors")) {
66                  return false;
67              }
68          }
69          return true;
70      }
71  
72      /**
73       * @throws Exception if test fails
74       */
75      @Test
76      public void ajax() throws Exception {
77          test("ajax.html");
78      }
79  
80      /**
81       * @throws Exception if test fails
82       */
83      @Test
84      public void array() throws Exception {
85          test("array.html");
86      }
87  
88      /**
89       * @throws Exception if test fails
90       */
91      @Test
92      public void base() throws Exception {
93          test("base.html");
94      }
95  
96      /**
97       * @throws Exception if test fails
98       */
99      @Test
100     public void dom() throws Exception {
101         test("dom.html");
102     }
103 
104     /**
105      * @throws Exception if test fails
106      */
107     @Test
108     public void elementMixins() throws Exception {
109         test("element_mixins.html");
110     }
111 
112     /**
113      * @throws Exception if test fails
114      */
115     @Test
116     public void enumerable() throws Exception {
117         test("enumerable.html");
118     }
119 
120     /**
121      * @throws Exception if test fails
122      */
123     @Test
124     public void form() throws Exception {
125         test("form.html");
126     }
127 
128     /**
129      * @throws Exception if test fails
130      */
131     @Test
132     public void hash() throws Exception {
133         test("hash.html");
134     }
135 
136     /**
137      * @throws Exception if test fails
138      */
139     @Test
140     public void position() throws Exception {
141         test("position.html");
142     }
143 
144     /**
145      * @throws Exception if test fails
146      */
147     @Test
148     public void range() throws Exception {
149         test("range.html");
150     }
151 
152     /**
153      * @throws Exception if test fails
154      */
155     @Test
156     public void selector() throws Exception {
157         test("selector.html");
158     }
159 
160     /**
161      * @throws Exception if test fails
162      */
163     @Test
164     public void string() throws Exception {
165         test("string.html");
166     }
167 }