View Javadoc
1   /*
2    *  Copyright 2022 Red Hat
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    *
8    *      https://www.apache.org/licenses/LICENSE-2.0
9    *
10   *  Unless required by applicable law or agreed to in writing, software
11   *  distributed under the License is distributed on an "AS IS" BASIS,
12   *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13   *  See the License for the specific language governing permissions and
14   *  limitations under the License.
15   */
16  package org.jboss.hal.testsuite.test.configuration.jsf;
17  
18  import org.jboss.arquillian.core.api.annotation.Inject;
19  import org.jboss.arquillian.graphene.page.Page;
20  import org.jboss.hal.meta.token.NameTokens;
21  import org.jboss.hal.resources.Ids;
22  import org.jboss.hal.resources.Names;
23  import org.jboss.hal.testsuite.Console;
24  import org.jboss.hal.testsuite.CrudOperations;
25  import org.jboss.hal.testsuite.container.WildFlyContainer;
26  import org.jboss.hal.testsuite.fixtures.JSFFixtures;
27  import org.jboss.hal.testsuite.fragment.finder.FinderPath;
28  import org.jboss.hal.testsuite.page.configuration.JSFPage;
29  import org.jboss.hal.testsuite.test.Manatoko;
30  import org.junit.jupiter.api.BeforeAll;
31  import org.junit.jupiter.api.Test;
32  import org.testcontainers.junit.jupiter.Container;
33  import org.testcontainers.junit.jupiter.Testcontainers;
34  import org.wildfly.extras.creaper.core.online.operations.Operations;
35  
36  import static org.jboss.hal.testsuite.container.WildFlyConfiguration.DEFAULT;
37  
38  @Manatoko
39  @Testcontainers
40  class JSFTest {
41  
42      @Container static WildFlyContainer wildFly = WildFlyContainer.standalone(DEFAULT);
43      private static Operations operations;
44  
45      @BeforeAll
46      static void setupModel() {
47          operations = new Operations(wildFly.managementClient());
48      }
49  
50      @Inject Console console;
51      @Inject CrudOperations crudOperations;
52      @Page JSFPage page;
53  
54      @Test
55      public void view() {
56          console.finder(NameTokens.CONFIGURATION, new FinderPath().append(Ids.CONFIGURATION, Ids.asId(Names.SUBSYSTEMS)))
57                  .column(Ids.CONFIGURATION_SUBSYSTEM)
58                  .selectItem(JSFFixtures.JSF)
59                  .view();
60          console.verify(page.getPlaceRequest());
61      }
62  
63      @Test
64      public void updateDefaultJSFImplSlot() throws Exception {
65          page.navigate();
66          crudOperations.update(JSFFixtures.JSF_ADDRESS, page.getDataForm(), JSFFixtures.DEFAULT_JSF_IMPL_SLOT);
67      }
68  
69      @Test
70      public void toggleDisallowDoctypeDecl() throws Exception {
71          page.navigate();
72          boolean disallowDoctypeDecl = operations.readAttribute(JSFFixtures.JSF_ADDRESS, JSFFixtures.DISALLOW_DOCTYPE_DECL)
73                  .booleanValue(false);
74          crudOperations.update(JSFFixtures.JSF_ADDRESS, page.getDataForm(), JSFFixtures.DISALLOW_DOCTYPE_DECL,
75                  !disallowDoctypeDecl);
76      }
77  }