public void test_Sm_vpc_015_complexPresentationUpload() throws Exception {
   {
     try {
       // Global variables file name
       String globalVariableFile = "Global_variables.xml";
       // Local variable file name
       String localVariableFile = "CVP_Sm_vpc_015_complexPresentationUpload.xml";
       setUp();
       Utility_Functions utilityFunction = new Utility_Functions();
       // Variable for the user name
       String VAR_USR = utilityFunction.GetValue(globalVariableFile, "VAR_USR");
       // Variable for the Password
       String VAR_PWD = utilityFunction.GetValue(globalVariableFile, "VAR_PWD");
       // Variable for domain name
       String Var_DomainName = utilityFunction.GetValue(globalVariableFile, "Var_DomainClassic");
       // Variable for complex presentation display name
       String Var_complexPresentationDisplayName =
           utilityFunction.GetValue(localVariableFile, "Var_complexPresentationDisplayName");
       // Variable for complex presentation file name
       String Var_complexPresentationFileName =
           utilityFunction.GetValue(localVariableFile, "Var_complexPresentationFileName");
       // Variable for complex presentation duration
       // String Var_complexPresentationDuration=utilityFunction.GetValue(localVariableFile
       // ,"Var_complexPresentationDuration");
       Login.adminPortalLogin(selenium, VAR_USR, VAR_PWD, Var_DomainName);
       Upload_Media.Upload_complexPresentation(
           selenium, Var_complexPresentationDisplayName, Var_complexPresentationFileName);
       utilityFunction.waitForChangesToReflect();
       Advance_Search.AdvanceSearch(selenium, Var_complexPresentationDisplayName);
       utilityFunction.waitForElementToPresent(selenium, EnvObjectMap_Rep.Lbl_nameHeader, 300);
       assertTrue(
           "Sm_vpc_015",
           "Classic VP: Ensure that Complex presentation file is uploaded in Content page.",
           date,
           selenium.isTextPresent(Var_complexPresentationDisplayName));
     } catch (Exception e) {
       e.printStackTrace();
     } finally {
       selenium.close();
       selenium.stop();
     }
   }
 }
 public Command executeStep(Element stepRow) throws Exception {
   Command command = new Command();
   NodeList stepFields = stepRow.getElementsByTagName("td");
   String cmd = stepFields.item(0).getTextContent().trim();
   command.cmd = cmd;
   ArrayList<String> argList = new ArrayList<String>();
   if (stepFields.getLength() == 1) {
     // skip comments
     command.result = "OK";
     return command;
   }
   for (int i = 1; i < stepFields.getLength(); i++) {
     String content = stepFields.item(i).getTextContent();
     content = content.replaceAll(" +", " ");
     content = content.replace('\u00A0', ' ');
     content = content.trim();
     argList.add(content);
   }
   String args[] = argList.toArray(new String[0]);
   command.args = args;
   if (this.verbose) {
     System.out.println(cmd + " " + Arrays.asList(args));
   }
   try {
     command.result = this.commandProcessor.doCommand(cmd, args);
     command.error = false;
   } catch (Exception e) {
     command.result = e.getMessage();
     command.error = true;
   }
   command.failure = command.error && !cmd.startsWith("verify");
   if (this.verbose) {
     System.out.println(command.result);
   }
   return command;
 }
  public void test_SVP_EGCupload_FLV() throws Exception {
    {
      try {
        setUp();
        Utility_Functions utilityFunction = new Utility_Functions();
        // Global variables file name
        String str_path = "Global_variables.xml";
        String local_path = "SVP_EGCupload_FLV.xml";
        // Variable for the domain name
        String VAR_DomSocial = utilityFunction.GetValue(str_path, "VAR_DomSocial");
        // Variable for the user name
        String VAR_USR = utilityFunction.GetValue(str_path, "VAR_USR");
        // Variable for the Password
        String VAR_PWD = utilityFunction.GetValue(str_path, "VAR_PWD");
        String VAR_MED_WAIT = utilityFunction.GetValue(str_path, "VAR_MED_WAIT");
        // Variable for EGC user's email id
        String VAR_userEmailID = utilityFunction.GetValue(local_path, "VAR_userEmailID");
        // Variable for EGC user's password
        String VAR_userPassword = utilityFunction.GetValue(local_path, "VAR_userPassword");
        // Variable for EGC user's First Name
        String VAR_userFirstName = utilityFunction.GetValue(local_path, "VAR_userFirstName");
        // Variable for EGC user's Last Name
        String VAR_userLastName = utilityFunction.GetValue(local_path, "VAR_userLastName");
        // Variable for Streaming Media Name
        String VAR_streamingMedia = utilityFunction.GetValue(local_path, "VAR_streamingMedia");
        // Variable for Streaming Media type
        String VAR_streamingMediaType =
            utilityFunction.GetValue(local_path, "VAR_streamingMediaType");
        // Variable for Master VOD Name
        String VAR_MasterVOD = utilityFunction.GetValue(local_path, "VAR_MasterVOD");
        // Variable for channel Name
        String VAR_ChannelName = utilityFunction.GetValue(local_path, "VAR_ChannelName");
        // Variable for Program Name Created from SVP by EGC user
        String VAR_EGCprogramName = utilityFunction.GetValue(local_path, "VAR_EGCprogramName");
        // Variable for Streaming Media uploaded by EGC user from SVP
        String VAR_streamingMediaEGC =
            utilityFunction.GetValue(local_path, "VAR_streamingMediaEGC");
        // Variable for Social Viewer Portal
        String Var_Columbia_vpURL = utilityFunction.GetValue(str_path, "Var_Columbia_vpURL");
        // Variable for framework path
        String Var_frameWork_Path = utilityFunction.GetValue(str_path, "Var_frameWork_Path");
        // Variable for asx file
        String Var_asxLink = utilityFunction.GetValue(str_path, "Var_asxLink");

        // Reusable action for Login to VCC
        Login.test_login(selenium, VAR_USR, VAR_PWD, VAR_DomSocial);
        // Reusable action for create User
        CreateUser.test_Create_User(
            selenium, VAR_userFirstName, VAR_userLastName, VAR_userEmailID, VAR_userPassword);
        // Reusable action to upload streaming media (flv)
        Upload_Media.Upload_streamingMedia(selenium, VAR_streamingMedia, VAR_streamingMediaType);
        // Reusable action for creating the on-demand program
        Create_Program.test_Create_vodProgram(selenium, VAR_MasterVOD, VAR_streamingMedia);

        if (!selenium.isTextPresent(VAR_MasterVOD)) {
          // Search the new created Live program
          selenium.click(EnvObjectMap_Rep.LNK_Search_Program);
          // provide program name in Search field
          selenium.type(EnvObjectMap_Rep.SelectType_Search_Program, VAR_MasterVOD);
          // click Search button
          selenium.click(EnvObjectMap_Rep.Btn_Search_Program);
          // wait for loading the page
          selenium.waitForPageToLoad(VAR_MED_WAIT);
        }
        selenium.click("link=" + VAR_MasterVOD);
        // wait
        selenium.waitForPageToLoad(VAR_MED_WAIT);
        // select the master program checkbox
        selenium.click(EnvObjectMap_Rep.chk_masterProgram);
        // wait
        utilityFunction.waitForChangesToReflect();
        selenium.click(EnvObjectMap_Rep.Btn_Finish_Program);
        // wait
        selenium.waitForPageToLoad(VAR_MED_WAIT);

        // Reusable action for EGC enabled channel
        Create_EGCchannel.test_Create_EGCchannel(
            selenium, VAR_ChannelName, VAR_MasterVOD, VAR_userEmailID);
        // variable for social viewer portal url
        String SVP_url = Var_Columbia_vpURL + VAR_DomSocial + "/home.vp";
        // navigate to social viewer portal
        selenium.open(SVP_url);
        selenium.waitForPageToLoad(VAR_MED_WAIT);

        // select the time zone
        if (selenium.isElementPresent(EnvObjectMap_Rep.drp_selectTimeZoneCVP)) {
          selenium.select(
              EnvObjectMap_Rep.drp_selectTimeZoneCVP, EnvObjectMap_Rep.drp_selectTimeZone_valueCVP);
          selenium.click(EnvObjectMap_Rep.btn_selectTimeZoneCVP);
          selenium.waitForPageToLoad(VAR_MED_WAIT);
        }
        selenium.selectWindow("Qumu Program Browser Home");
        selenium.windowMaximize();
        utilityFunction.waitForChangesToReflect();
        utilityFunction.waitForChangesToReflect();

        // Login to Social Viewer portal as EGC user
        Login.LoginSVP(selenium, VAR_userEmailID, VAR_userPassword);
        // wait
        utilityFunction.waitForChangesToReflect();
        utilityFunction.waitForChangesToReflect();
        // Create a program containing WMV file
        Upload_EGCprogramSVP.test_Upload_EGCprogramSVP(
            selenium, VAR_EGCprogramName, VAR_ChannelName, VAR_streamingMediaEGC);
        // wait
        utilityFunction.waitForChangesToReflect();
        utilityFunction.waitForChangesToReflect();
        // check whether the program has been created on SVP
        for (int second = 0; ; second++) {
          if (second >= 600) fail("timeout");
          try {
            if (selenium.isElementPresent("link=" + VAR_EGCprogramName))
              assertTrue(
                  "SVP_EGCupload_FLV",
                  "Social VP: Ensure that Program is successfully created using the FLV file from SVP EGC portal.",
                  date,
                  selenium.isTextPresent(VAR_EGCprogramName));
            selenium.open(SVP_url + "?debug=true");
            selenium.waitForPageToLoad("60000");
            break;
          } catch (Exception e) {
          }

          Thread.sleep(1000);
        }

        // wait
        utilityFunction.waitForChangesToReflect();

        // click on All videos link
        selenium.click(EnvObjectMap_Rep.LNK_AllVideos);
        utilityFunction.waitForChangesToReflect();
        // input the search term
        selenium.type(EnvObjectMap_Rep.TBX_SearchSVP, VAR_EGCprogramName);
        // wait
        utilityFunction.waitForChangesToReflect();
        // Set focus on the search textbox
        selenium.typeKeys(EnvObjectMap_Rep.TBX_SearchSVP, "t");
        // select the icon to perform search
        selenium.click(EnvObjectMap_Rep.ICN_SearchBoxArrowlinkSVP);
        // Wait
        utilityFunction.waitForChangesToReflect();
        // Click the vod file in search results
        for (int i = 1; i < 50; i++) {
          String str_var =
              selenium.getText(MessageFormat.format(EnvObjectMap_Rep.LST_Searchresult, i));
          System.out.println(str_var);
          if (str_var.equals(VAR_EGCprogramName)) {
            selenium.click(MessageFormat.format(EnvObjectMap_Rep.LST_Searchresult, i));
            break;
          }
        }

        // Click the vod file in search results
        // selenium.click(EnvObjectMap_Rep.LST_Searchresult);
        // Wait
        utilityFunction.waitForChangesToReflect();
        utilityFunction.waitForChangesToReflect();
        // Capture the screenshot at the specified path
        String screenShot_locPath =
            Var_frameWork_Path + "\\commonfiles\\" + VAR_EGCprogramName + ".jpg";
        // Capture the screen shot of the live program
        selenium.captureScreenshot(screenShot_locPath);
        // Wait
        utilityFunction.waitForChangesToReflect();
        String contentlink = selenium.getText(Var_asxLink);
        // wait
        utilityFunction.waitForChangesToReflect();
        String contentlink_final = StringUtils.substringAfter(contentlink, "Loading content from");
        contentlink_final = contentlink_final.trim();
        System.out.println("exact:" + contentlink_final + "&playerType=silverlightembed");
        selenium.click("link=exact:" + contentlink_final);
        utilityFunction.waitForChangesToReflect();

        // Generate the asx file
        String htmlsource = selenium.getHtmlSource();
        System.out.println(htmlsource);

        // To verify the asx file
        assertTrue(
            "SVP_EGCupload_FLV",
            "Verify that asx file for on-demand program with FLV file is generated successfully.",
            date,
            utilityFunction.assertTextContains(htmlsource, VAR_EGCprogramName));
        // Verify that the stream is displayed correct in the asx file
        assertTrue(
            "SVP_EGCupload_FLV",
            "Social VP: Ensure that FLV file is uploaded from EGC portal and correctly displayed in asx file.",
            date,
            utilityFunction.assertTextContains(htmlsource, VAR_EGCprogramName));
        utilityFunction = null;
      } catch (Exception e) {
        e.printStackTrace();
      } finally {
        selenium.close();
        selenium.stop();
      }
    }
  }
  public boolean runTest(Test test) throws Exception {
    String filename = test.file.toString();
    if (this.verbose) {
      System.out.println(
          "Running "
              + filename
              + " against "
              + this.host
              + ":"
              + this.port
              + " with "
              + this.browser);
    }
    this.document = parseDocument(filename);

    if (this.baseUrl == null) {
      NodeList links = this.document.getElementsByTagName("link");
      if (links.getLength() != 0) {
        Element link = (Element) links.item(0);
        setBaseUrl(link.getAttribute("href"));
      }
    }
    if (this.verbose) {
      System.out.println("Base URL=" + this.baseUrl);
    }

    Node body = this.document.getElementsByTagName("body").item(0);
    Element resultContainer = document.createElement("div");
    resultContainer.setTextContent("Result: ");
    Element resultElt = document.createElement("span");
    resultElt.setAttribute("id", "result");
    resultElt.setIdAttribute("id", true);
    resultContainer.appendChild(resultElt);
    body.insertBefore(resultContainer, body.getFirstChild());

    Element executionLogContainer = document.createElement("div");
    executionLogContainer.setTextContent("Execution Log:");
    Element executionLog = document.createElement("div");
    executionLog.setAttribute("id", "log");
    executionLog.setIdAttribute("id", true);
    executionLog.setAttribute("style", "white-space: pre;");
    executionLogContainer.appendChild(executionLog);
    body.appendChild(executionLogContainer);

    NodeList tableRows = document.getElementsByTagName("tr");
    Element theadRow = (Element) tableRows.item(0);
    test.name = theadRow.getTextContent();
    appendCellToRow(theadRow, "Result");

    this.commandProcessor =
        new HtmlCommandProcessor(this.host, this.port, this.browser, this.baseUrl);
    String resultState;
    String resultLog;
    test.result = true;
    try {
      this.commandProcessor.start();
      test.commands = new Command[tableRows.getLength() - 1];
      for (int i = 1; i < tableRows.getLength(); i++) {
        Element stepRow = (Element) tableRows.item(i);
        Command command = executeStep(stepRow);
        appendCellToRow(stepRow, command.result);
        test.commands[i - 1] = command;
        if (command.error) {
          test.result = false;
        }
        if (command.failure) {
          test.result = false;
          // break;
        }
      }
      resultState = test.result ? "PASSED" : "FAILED";
      resultLog = (test.result ? "Test Complete" : "Error");
      this.commandProcessor.stop();
    } catch (Exception e) {
      test.result = false;
      resultState = "ERROR";
      resultLog = "Failed to initialize session\n" + e;
      e.printStackTrace();
    }
    document.getElementById("result").setTextContent(resultState);
    Element log = document.getElementById("log");
    log.setTextContent(log.getTextContent() + resultLog + "\n");
    return test.result;
  }
 public static void main(String args[]) {
   try {
     SeleniumHtmlClient client = new SeleniumHtmlClient();
     String testFile = null;
     String testSuite = null;
     String resultsFilename = null;
     for (int i = 0; i < args.length; i++) {
       if (args[i].equals("--host")) {
         i++;
         if (i < args.length) {
           client.setHost(args[i]);
         } else {
           throw new BadUsageException("--host must be followed by a hostname");
         }
       } else if (args[i].equals("--port")) {
         i++;
         if (i < args.length) {
           client.setPort(Integer.parseInt(args[i]));
         } else {
           throw new BadUsageException("--port must be followed by a port number");
         }
       } else if (args[i].equals("--browser")) {
         i++;
         if (i < args.length) {
           client.setBrowser(args[i]);
         } else {
           throw new BadUsageException("--browser must be followed by a browser spec");
         }
       } else if (args[i].equals("--out")) {
         i++;
         if (i < args.length) {
           resultsFilename = args[i];
         } else {
           throw new BadUsageException("--out must be followed by a filename");
         }
         /*
         } else if (args[i].equals("--outdir")) {
         	i++;
         	if (i < args.length) {
         		client.setResultsDir(new File(args[i]));
         	} else {
         		throw new BadUsageException("--outdir must be followed by a path");
         	}
         	*/
       } else if (args[i].equals("--baseurl")) {
         i++;
         if (i < args.length) {
           client.setBaseUrl(args[i]);
         } else {
           throw new BadUsageException("--baseurl must be followed by a URL");
         }
       } else if (args[i].equals("--test")) {
         i++;
         if (i < args.length) {
           if (testFile == null) {
             testFile = args[i];
           } else {
             throw new BadUsageException("only one test file permitted");
           }
         } else {
           throw new BadUsageException("--test must be followed by a test filepath");
         }
       } else if (args[i].equals("--testsuite")) {
         i++;
         if (i < args.length) {
           testSuite = args[i];
         } else {
           throw new BadUsageException("--testsuite must be followed by a testsuite filepath");
         }
       } else if (args[i].equals("--verbose") || args[i].equals("-v")) {
         client.setVerbose(true);
       } else if (args[i].equals("--help") || args[i].equals("-h")) {
         printUsage();
         System.exit(0);
       } else {
         throw new BadUsageException("Unknown parameter " + args[i]);
       }
     }
     if (testFile == null && testSuite == null) {
       throw new BadUsageException("No test or testsuite file specified");
     } else if (testFile != null && testSuite != null) {
       throw new BadUsageException("A test and testsuite file cannot both be specified");
     }
     Writer resultsWriter = null;
     if (resultsFilename != null) {
       resultsWriter = new FileWriter(resultsFilename);
     } else /* if (client.resultsDir == null) */ {
       resultsWriter = new OutputStreamWriter(System.out);
     }
     client.setResultsWriter(resultsWriter);
     if (testFile != null) {
       client.runTest(testFile);
     } else {
       client.runSuite(testSuite);
     }
     if (resultsWriter != null) resultsWriter.close();
   } catch (BadUsageException e) {
     System.err.println("Error: " + e.getMessage());
     System.err.println();
     printUsage();
     System.exit(1);
   } catch (Exception e) {
     e.printStackTrace();
     System.exit(1);
   }
 }
  public void test_SVP_EGC_Unapproved_Prg_Verification() throws Exception {
    {
      try {
        setUp();
        Utility_Functions utilityFunction = new Utility_Functions();
        // Global variables file name
        String str_path = "Global_variables.xml";
        String local_path = "SVP_EGC_Unapproved_Prg_Verification.xml";
        // Variable for the domain name
        String VAR_DomSocial = utilityFunction.GetValue(str_path, "VAR_DomSocial");
        // Variable for the user name
        String VAR_Username = utilityFunction.GetValue(str_path, "VAR_USR");
        // Variable for the Password
        String VAR_Password = utilityFunction.GetValue(str_path, "VAR_PWD");
        String VAR_MED_WAIT = utilityFunction.GetValue(str_path, "VAR_MED_WAIT");
        // Variable for filename name
        String VAR_userFirstName = utilityFunction.GetValue(local_path, "VAR_userFirstName");
        String VAR_userLastName = utilityFunction.GetValue(local_path, "VAR_userLastName");
        String VAR_userEmailID = utilityFunction.GetValue(local_path, "VAR_userEmailID");
        String VAR_userPassword = utilityFunction.GetValue(local_path, "VAR_userPassword");
        String VAR_streamingMedia = utilityFunction.GetValue(local_path, "VAR_streamingMedia");
        String VAR_streamingMediaType =
            utilityFunction.GetValue(local_path, "VAR_streamingMediaType");
        String VAR_MasterVOD = utilityFunction.GetValue(local_path, "VAR_MasterVOD");
        String VAR_ChannelName = utilityFunction.GetValue(local_path, "VAR_ChannelName");
        String VAR_EGCprogramName = utilityFunction.GetValue(local_path, "VAR_EGCprogramName");
        String VAR_streamingMediaEGC =
            utilityFunction.GetValue(local_path, "VAR_streamingMediaEGC");
        String Var_Columbia_vpURL = utilityFunction.GetValue(str_path, "Var_Columbia_vpURL");

        // Reusable action for Login to VCC
        Login.test_login(selenium, VAR_Username, VAR_Password, VAR_DomSocial);
        selenium.waitForPageToLoad("30000");

        // click the Domains link in right pane
        selenium.click(EnvObjectMap_Rep.LNK_Domains);
        selenium.waitForPageToLoad("50000");
        selenium.click(EnvObjectMap_Rep.LNK_selecteddomainName + VAR_DomSocial + "')]");
        selenium.waitForPageToLoad("30000");

        // verify the EGC Approval Required checkbox should not be checked
        if (selenium.isChecked(EnvObjectMap_Rep.CHK_EGCApprovalRequiredchkbox)) {
          System.out.println(
              "checked" + selenium.isChecked(EnvObjectMap_Rep.CHK_EGCApprovalRequiredchkbox));
          // if the checkbox is checked, following action will save the settings.

          selenium.click(EnvObjectMap_Rep.BTN_DomainSave);
        } else {
          // If checkbox is not checked,  then following action will select the checkbox and save
          // the settings.
          System.out.println(
              "Unchecked" + selenium.isChecked(EnvObjectMap_Rep.CHK_EGCApprovalRequiredchkbox));
          selenium.click(EnvObjectMap_Rep.CHK_EGCApprovalRequiredchkbox);
          selenium.click(EnvObjectMap_Rep.BTN_DomainSave);
        }
        selenium.waitForPageToLoad("30000");

        // Reusable action for create User if EGC user is not already available
        CreateUser.test_Create_User(
            selenium, VAR_userFirstName, VAR_userLastName, VAR_userEmailID, VAR_userPassword);
        // Reusable action to upload streaming media (wmv)
        Upload_Media.Upload_streamingMedia(selenium, VAR_streamingMedia, VAR_streamingMediaType);
        // Reusable action for creating the on-demand program
        Create_Program.test_Create_vodProgram(selenium, VAR_MasterVOD, VAR_streamingMedia);

        if (!selenium.isTextPresent(VAR_MasterVOD)) {
          // Search the new created Live program
          selenium.click(EnvObjectMap_Rep.LNK_Search_Program);
          // provide program name in Search field
          selenium.type(EnvObjectMap_Rep.SelectType_Search_Program, VAR_MasterVOD);
          // click Search button
          selenium.click(EnvObjectMap_Rep.Btn_Search_Program);
          // wait for loading the page
          selenium.waitForPageToLoad(VAR_MED_WAIT);
        }
        selenium.click("link=" + VAR_MasterVOD);
        selenium.waitForPageToLoad(VAR_MED_WAIT);
        selenium.click(EnvObjectMap_Rep.chk_masterProgram);
        selenium.click(EnvObjectMap_Rep.Btn_Finish_Program);
        selenium.waitForPageToLoad(VAR_MED_WAIT);

        // Reusable action for EGC enabled channel
        Create_EGCchannel.test_Create_EGCchannel(
            selenium, VAR_ChannelName, VAR_MasterVOD, VAR_userEmailID);

        // variable for social viewer portal url
        String SVP_url = Var_Columbia_vpURL + VAR_DomSocial + "/home.vp";
        // navigate to social viewer portal
        selenium.open(SVP_url);
        selenium.waitForPageToLoad(VAR_MED_WAIT);
        utilityFunction.waitForChangesToReflect();
        // select the time zone
        if (selenium.isElementPresent(EnvObjectMap_Rep.drp_selectTimeZoneCVP)) {
          selenium.select(
              EnvObjectMap_Rep.drp_selectTimeZoneCVP, EnvObjectMap_Rep.drp_selectTimeZone_valueCVP);
          selenium.click(EnvObjectMap_Rep.btn_selectTimeZoneCVP);
          selenium.waitForPageToLoad(VAR_MED_WAIT);
        }
        selenium.selectWindow("Qumu Program Browser Home");
        selenium.windowMaximize();
        utilityFunction.waitForChangesToReflect();
        utilityFunction.waitForChangesToReflect();

        // Login to Social Viewer portal as EGC user
        Login.LoginSVP(selenium, VAR_userEmailID, VAR_userPassword);
        // wait
        utilityFunction.waitForChangesToReflect();
        utilityFunction.waitForChangesToReflect();

        /* for (int second = 0;; second++) {
            if (second >= 600) fail("timeout");
            try { if (selenium.isElementPresent(EnvObjectMap_Rep.lnk_AddProgram_SVP))
         	   // selenium.waitForPageToLoad("60000");
             break; } catch (Exception e) {}

            Thread.sleep(1000);
        }*/
        // Create a program containing WMV file
        Upload_EGCprogramSVP.test_Upload_EGCprogramSVP(
            selenium, VAR_EGCprogramName, VAR_ChannelName, VAR_streamingMediaEGC);

        utilityFunction.waitForChangesToReflect();
        utilityFunction.waitForChangesToReflect();
        boolean flag_program_created = false;

        utilityFunction.waitForChangesToReflect();
        if (selenium.isTextPresent(VAR_EGCprogramName)) {
          flag_program_created = true;
          System.out.println(flag_program_created);
        }
        utilityFunction.waitForChangesToReflect();
        selenium.click(EnvObjectMap_Rep.LNK_HomeSVP);
        selenium.waitForPageToLoad(VAR_MED_WAIT);

        utilityFunction.waitForChangesToReflect();
        // click on All videos link
        selenium.click(EnvObjectMap_Rep.LNK_AllVideos);
        utilityFunction.waitForChangesToReflect();
        // input the search term
        selenium.type(EnvObjectMap_Rep.TBX_SearchSVP, VAR_EGCprogramName);
        utilityFunction.waitForChangesToReflect();
        // Set focus on the search textbox
        selenium.typeKeys(EnvObjectMap_Rep.TBX_SearchSVP, "t");
        // select the icon to perform search
        selenium.click(EnvObjectMap_Rep.ICN_SearchBoxArrowlinkSVP);
        // Wait
        utilityFunction.waitForChangesToReflect();
        boolean flag_program_inlist = false;
        if (!selenium.isTextPresent(VAR_EGCprogramName)) {
          flag_program_inlist = true;
          System.out.println(flag_program_inlist);
        }
        if (flag_program_inlist & flag_program_created) {
          // Reusable action for Login to VCC
          Login.test_login(selenium, VAR_Username, VAR_Password, VAR_DomSocial);
          utilityFunction.waitForChangesToReflect();
          // click on "Programming" link
          selenium.click("menu_programming_cont");
          utilityFunction.waitForChangesToReflect();
          // Click on Program Approve menu link
          selenium.click(EnvObjectMap_Rep.lnk_approveProgram);
          // wait for page to load
          utilityFunction.waitForChangesToReflect();
          // Select the show drop down as "Pending"
          selenium.select(
              EnvObjectMap_Rep.drp_approvalStatus,
              EnvObjectMap_Rep.drp_approvalStatusValue + "Pending");
          // Verify that program status is Unapproved
          assertTrue(
              "SVP_EGC_Unapproved_Prg_Verification",
              "Social VP: Ensure that unapproved EGC programs are not accessible to viewers.",
              date,
              selenium.isTextPresent(VAR_EGCprogramName));
          utilityFunction = null;
        }
      } catch (Exception e) {
        e.printStackTrace();
      } finally {
        selenium.close();
        selenium.stop();
      }
    }
  }
  public void test_SVP_Sm_vpv_018_LiveSurveySummary_Report() throws Exception {
    {
      try {
        setUp();
        Utility_Functions utilityFunction = new Utility_Functions();
        String str_path = "Global_variables.xml";
        // local variable file name
        String local_path = "SVP_LiveProgramSurveySummary_Report.xml";
        // String VAR_MED_WAIT = utilityFunction.GetValue(str_path ,"VAR_MED_WAIT");
        String VAR_DomSocial = utilityFunction.GetValue(str_path, "VAR_DomSocial");
        // Variable for the user name
        String VAR_USR = utilityFunction.GetValue(str_path, "VAR_USR");
        // Variable for the Password
        String VAR_PWD = utilityFunction.GetValue(str_path, "VAR_PWD");
        // Encoder Name
        String VAR_Encodername = utilityFunction.GetValue(local_path, "VAR_Encodername");
        // Variable for Live program name
        String Var_LiveProgramName = utilityFunction.GetValue(local_path, "Var_LiveProgramName");
        // Variable for the archive of Live program
        String Var_LiveProgramArchive =
            utilityFunction.GetValue(local_path, "Var_LiveProgramArchive");
        // Variable for the Framework path
        String Var_frameWork_Path = utilityFunction.GetValue(str_path, "Var_frameWork_Path");
        // variable for media net name
        String VAR_MedianetName = utilityFunction.GetValue(local_path, "VAR_medianetName");
        // Variable for Encoder profile name
        String VAR_EncoderProfileName =
            utilityFunction.GetValue(local_path, "VAR_EncoderProfileName");
        // Variable for viewer portal
        String Var_Columbia_vpURL = utilityFunction.GetValue(str_path, "Var_Columbia_vpURL");
        // Variable for the Survey Name
        String VAR_SurveyName = utilityFunction.GetValue(local_path, "SurveyName");
        // Variable for Poll name
        String VAR_PollName = utilityFunction.GetValue(local_path, "PollName");
        // Variable for the Question Name
        String VAR_QuestionName = utilityFunction.GetValue(local_path, "QuestionName");
        // Variable for the Question Explanation
        String VAR_QuestionExp = utilityFunction.GetValue(local_path, "QuestionExp");
        // Variable for the Question Type
        String VAR_QuestionType = utilityFunction.GetValue(local_path, "QuestionType");
        // Variable for the slide display name
        String VAR_SlideDisplayName = utilityFunction.GetValue(local_path, "VAR_SlideDisplayName");
        // Reusable action for Login to VCC
        Login.test_login(selenium, VAR_USR, VAR_PWD, VAR_DomSocial);
        // Reusable action to add survey
        // Upload_Media.Add_Survey(selenium, VAR_PollName, VAR_QuestionName, VAR_QuestionExp,
        // VAR_QuestionType);
        // Reusable to create a live program
        Create_Program.test_create_LiveProg(
            selenium,
            Var_LiveProgramName,
            VAR_Encodername,
            VAR_EncoderProfileName,
            VAR_SlideDisplayName,
            VAR_PollName,
            VAR_SurveyName,
            VAR_MedianetName);
        // Launch the LBC
        Launch_LBC.test_LaunchLBC(
            selenium, "Sm_vpv_018", Var_LiveProgramName, Var_LiveProgramArchive);
        // wait
        // selenium.waitForPageToLoad("30000");
        selenium.selectWindow("null");
        utilityFunction.waitForChangesToReflect();
        // Launch the viewer portal video
        selenium.openWindow(Var_Columbia_vpURL + VAR_DomSocial + "/home.vp?debug=true", "SVP");
        // Select the viewer portal
        selenium.selectWindow("SVP");
        selenium.windowMaximize();
        utilityFunction.waitForElementToVisible(selenium, EnvObjectMap_Rep.LNK_AllVideos, 300);
        // selenium.setTimeout("90000");
        // utilityFunction.waitForChangesToReflect();
        // click the Live program from all videos
        selenium.click(EnvObjectMap_Rep.LNK_AllVideos);
        utilityFunction.waitForChangesToReflect();
        utilityFunction.waitForChangesToReflect();

        selenium.type(
            EnvObjectMap_Rep.TBX_SearchSVP,
            utilityFunction.GetValue(local_path, "Var_LiveProgramName"));
        utilityFunction.waitForChangesToReflect();

        // Set focus on the search textbox
        selenium.typeKeys(EnvObjectMap_Rep.TBX_SearchSVP, "t");
        // select the icon to perform search
        selenium.click(EnvObjectMap_Rep.ICN_SearchBoxArrowlinkSVP);
        // Wait
        utilityFunction.waitForChangesToReflect();
        // select the Live program from all Videos in search results
        for (int i = 1; i < 50; i++) {
          String str_var =
              selenium.getText(MessageFormat.format(EnvObjectMap_Rep.LST_Searchresult, i));
          System.out.println(str_var);
          if (str_var.equals(Var_LiveProgramName)) {
            selenium.click(MessageFormat.format(EnvObjectMap_Rep.LST_Searchresult, i));
            break;
          }
        }
        // Wait
        utilityFunction.waitForChangesToReflect();
        // variable for path where to save the screenshot
        String screenShot_locPath =
            Var_frameWork_Path + "\\commonfiles\\" + Var_LiveProgramName + ".jpg";
        // Capture the screen shot of the live program
        selenium.captureScreenshot(screenShot_locPath);
        // Wait
        //    utilityFunction.waitForChangesToReflect();
        // select the LBC window
        for (String windowName : selenium.getAllWindowNames()) {
          if (windowName.indexOf(EnvObjectMap_Rep.Select_LBC) != -1) {
            selenium.selectWindow(windowName);
          }
        }
        // Click on Broadcast control tab
        selenium.click(EnvObjectMap_Rep.tab_broadcastControlLBC);
        // wait
        utilityFunction.waitForChangesToReflect();
        // Stop the broadcast
        selenium.click(EnvObjectMap_Rep.btn_stopBroadcast);
        utilityFunction.waitForChangesToReflect();
        selenium.close();
        // Select the parent window
        selenium.selectWindow("null");
        // wait
        //	utilityFunction.waitForChangesToReflect();
        // select SVP window
        selenium.selectWindow("Qumu Program Browser Home");
        // wait
        utilityFunction.waitForChangesToReflect();
        // Verify that survey is available
        for (int second = 0; ; second++) {
          if (second >= 600) fail("timeout");

          try {
            if (selenium.isElementPresent(EnvObjectMap_Rep.LNK_SurveyWindow))
              assertTrue(
                  "Sm_vpv_018",
                  "Verify that Survey is displayed successfully on SVP after the broadcast is stopped on LBC.",
                  date,
                  selenium.isElementPresent(EnvObjectMap_Rep.LNK_SurveyWindow));
            break;
          } catch (Exception e) {
          }
          Thread.sleep(1000);
        }
        selenium.click(EnvObjectMap_Rep.CHK_SurveyWindow);
        selenium.click(EnvObjectMap_Rep.btn_SubmitSurveyanswer);
        utilityFunction.waitForChangesToReflect();
        selenium.selectWindow("null");
        // Click 'Reporting' menu
        selenium.click(EnvObjectMap_Rep.lnk_reporting);
        // Click 'Reports' link
        selenium.click(EnvObjectMap_Rep.lnk_reports);
        // wait
        selenium.waitForPageToLoad("30000");
        // Select Report name
        selenium.click(EnvObjectMap_Rep.radio_LiveProgramSurveySummary);
        // Click 'Next' button
        selenium.click(EnvObjectMap_Rep.btn_reportNext);
        // wait
        selenium.waitForPageToLoad("30000");
        // select Survey as the option
        selenium.select(EnvObjectMap_Rep.drp_SelectPollorSurvey, EnvObjectMap_Rep.txt_Survey);
        utilityFunction.waitForChangesToReflect();
        selenium.select("input_programId", "label=" + Var_LiveProgramName);
        // wait
        utilityFunction.waitForChangesToReflect();
        // click the Run report button
        selenium.click(EnvObjectMap_Rep.btn_runReport);
        // wait
        selenium.waitForPageToLoad("30000");
        // verify that 'Content Storage' report is generated
        assertTrue(
            "Sm_vpv_018",
            "Social VP: Ensure that 'Live Program Survey Summary' report is generated.",
            date,
            selenium.isTextPresent("Live Program Poll/Survey Summary Report"));
        assertTrue(
            "Sm_vpv_018",
            "Social VP: Ensure that correct Live program is displayed on 'Live Program Survey Summary' report.",
            date,
            selenium.isTextPresent(Var_LiveProgramName));
        selenium.close();
        // stop selenium
        utilityFunction = null;
      } catch (Exception e) {
        e.printStackTrace();
      } finally {
        selenium.close();
        selenium.stop();
      }
    }
  }