|
| 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.bootstrap; |
| 16 | + |
| 17 | +import org.eclipse.jetty.server.Server; |
| 18 | +import org.htmlunit.WebDriverTestCase; |
| 19 | +import org.htmlunit.WebServerTestCase; |
| 20 | +import org.htmlunit.junit.annotation.HtmlUnitNYI; |
| 21 | +import org.junit.jupiter.api.AfterAll; |
| 22 | +import org.junit.jupiter.api.BeforeAll; |
| 23 | +import org.junit.jupiter.api.Test; |
| 24 | + |
| 25 | +/** |
| 26 | + * Tests for Apache MyFaces. |
| 27 | + * |
| 28 | + * @author Ronald Brill |
| 29 | + */ |
| 30 | +public class Bootstrap538Test extends WebDriverTestCase { |
| 31 | + |
| 32 | + /** The server. */ |
| 33 | + protected static Server SERVER_; |
| 34 | + |
| 35 | + /** |
| 36 | + * @throws Exception if an error occurs |
| 37 | + */ |
| 38 | + @BeforeAll |
| 39 | + public static void startSesrver() throws Exception { |
| 40 | + SERVER_ = WebServerTestCase.createWebServer("src/test/resources/libraries/bootstrap/5.3.8", null); |
| 41 | + } |
| 42 | + |
| 43 | + /** |
| 44 | + * @throws Exception if an error occurs |
| 45 | + */ |
| 46 | + @AfterAll |
| 47 | + public static void stopServer() throws Exception { |
| 48 | + if (SERVER_ != null) { |
| 49 | + SERVER_.stop(); |
| 50 | + SERVER_.destroy(); |
| 51 | + SERVER_ = null; |
| 52 | + } |
| 53 | + } |
| 54 | + |
| 55 | + /** |
| 56 | + * @throws Exception if the test fails |
| 57 | + */ |
| 58 | + @Test |
| 59 | + @HtmlUnitNYI(CHROME = "org.htmlunit.ScriptException: syntax error", |
| 60 | + EDGE = "org.htmlunit.ScriptException: syntax error", |
| 61 | + FF = "org.htmlunit.ScriptException: syntax error", |
| 62 | + FF_ESR = "org.htmlunit.ScriptException: syntax error") |
| 63 | + public void checkForJsCompileErrors() throws Exception { |
| 64 | + try { |
| 65 | + getWebDriver().get(URL_FIRST + "bootstrap.bundle.html"); |
| 66 | + } |
| 67 | + catch (final Exception e) { |
| 68 | + if (getExpectedAlerts().length > 0) { |
| 69 | + assertTrue(e.getMessage(), e.getMessage().startsWith(getExpectedAlerts()[0])); |
| 70 | + return; |
| 71 | + } |
| 72 | + |
| 73 | + throw e; |
| 74 | + } |
| 75 | + } |
| 76 | +} |
0 commit comments