SHARE
TWEET

Untitled

a guest Dec 3rd, 2019 73 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. package de.usu.test.web.suite.testcase.service;
  2.  
  3. import java.util.ArrayList;
  4. import java.util.Arrays;
  5. import java.util.Collection;
  6. import java.util.List;
  7. import java.util.stream.Stream;
  8.  
  9. import de.usu.test.web.api.module.component.Toolbar.Perspective;
  10. import de.usu.test.web.core.WebTestCase;
  11.  
  12. public class TestDebug  extends WebTestCase {
  13.    
  14.     private enum DefaultOpt {
  15.        
  16.         SERVICE_DESCRIPTION(1, "Service Description: Platinum"),
  17.         USER_HELPDESK(1, "User Helpdesk for Valuemation (expand for more)"),
  18.         RESOLUTION_TIME(1, "Resolution time 8H: Platinum"),
  19.         RESPONSE_TIME(1, "Response time 2H: Platinum"),
  20.         SUPPORT(1, "Support 7x24: Platinum"),
  21.         SUPPORTED_LANGUAGE(1, "Supported Language DE,EN and Local: Platinum"),
  22.         DATABASE(1, "Database"),
  23.         VALUEMATION_WEBSERVER(1, "Valuemation webserver (expand for more)"),
  24.         VALUEMATION_ORCHESTRA(1, "Valuemation Orchestra (expand for more)");
  25.        
  26.         String optionName;
  27.         int quantity;
  28.        
  29.         private DefaultOpt(int quantity, String optionName) {
  30.             this.optionName = optionName;
  31.         }
  32.        
  33.         @Override
  34.         public String toString() {
  35.             return this.quantity +" x "+ optionName;   
  36.         }
  37.        
  38.         /**
  39.          * Method returns Enum as Stream object
  40.          * @return Stream
  41.          */
  42.         public static Stream<DefaultOpt> streamValues() {
  43.             return Arrays.stream(DefaultOpt.values());
  44.         }
  45.        
  46.         /**
  47.          * Method iterates through list and returns true if Enum record is present in list
  48.          * @param list - list to be searched in
  49.          * @return boolean - returns true if record was found
  50.          */
  51.         public boolean isPresentInListOptions(List<String> list) {
  52.             return list.stream().filter(item -> item.contains(this.toString())).findFirst().isPresent();
  53.         }
  54.  
  55.     }
  56.    
  57.     public void testRun() {
  58.        
  59.         List<String> summaryOptions = new ArrayList<String>();
  60.                
  61.         onToolbar().switchPerspectiveTo(Perspective.WORK);
  62.         onTileList().findAndClickTile("Open Service Shop for Instantiation");
  63.        
  64.         onCatalog().onCatalogPanel().findRow(1).click();
  65.         onCatalog().onCatalogPanel().findActionButton(".catalog.select").click();
  66.         onShop().onBrowser().onRecommendedProduct().selectButton().click();
  67.         onShop().onConfigurator().onSummary().listOptions().forEach(option -> summaryOptions.add(option.title())); 
  68.        
  69.         /**
  70.          * Iterates trough list of options and checks if these options are present
  71.          */
  72.         DefaultOpt.streamValues().forEach(option -> assertTrue(option.isPresentInListOptions(summaryOptions))
  73.         );
  74.        
  75.     }
  76. }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top