View Javadoc
1   /*
2    * Copyright 2023 Adrian Herscu
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    *     http://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  
17  package dev.aherscu.qa.testing.example.scenarios.tutorial3;
18  
19  import static dev.aherscu.qa.testing.utils.StreamMatchersExtensions.hasSpecificItems;
20  
21  import org.testng.annotations.*;
22  
23  import dev.aherscu.qa.jgiven.webdriver.*;
24  import dev.aherscu.qa.testing.example.*;
25  import dev.aherscu.qa.testing.example.model.tutorial.*;
26  import dev.aherscu.qa.testing.example.steps.tutorial.*;
27  import lombok.*;
28  
29  public class Banking
30      extends
31      ApplicationPerMethodWebSessionTest<TestConfiguration, BankFixtures<?>, BankActions<?>, BankVerifications<?>> {
32  
33      protected Banking() {
34          super(TestConfiguration.class);
35      }
36  
37      @BeforeMethod
38      @SneakyThrows
39      @Override
40      public void beforeMethodOpenWebDriver() {
41          super.beforeMethodOpenWebDriver();
42          webDriver.get().asRemote().manage().window().maximize();
43      }
44  
45      @Test(dataProvider = INTERNAL_DATA_PROVIDER)
46      public void shouldCreateCustomer(final Customer customer) {
47          given()
48              .a_bank(webDriver.get());
49  
50          when()
51              .adding(customer);
52  
53          then()
54              .the_customers(hasSpecificItems(customer));
55      }
56  
57      @DataProvider//(parallel = true)
58      private Customer[] data() {
59          return new Customer[] {
60              Customer.builder()
61                  .firstName("kuku")
62                  .lastName("bar")
63                  .postalCode("12345")
64                  .build()
65          };
66      }
67  }