// Record current event on the given channel private static void recordEvent(Service service, string eventKeyName, _Step step) { // Tune to the given channel IEXGateway._IEXResult res = CL.EA.ChannelSurf(EnumSurfIn.Live, service.LCN); if (!res.CommandSucceeded) { step.FailStep(CL, res, "Failed to tune to channel " + service.LCN); } // Record the current event res = CL.EA.PVR.RecordCurrentEventFromBanner(eventKeyName, Constants.minDurationInEvent, false, false); if (!res.CommandSucceeded) { step.FailStep(CL, res, "Failed to record current event on service " + service.LCN); } // Wait for some time for event to record res = CL.IEX.Wait(Constants.minDurationInEvent * 60); // Stop recording res = CL.EA.PVR.StopRecordingFromArchive(eventKeyName); if (!res.CommandSucceeded) { step.FailStep(CL, res, "Failed to stop recording " + eventKeyName + " from archive"); } }
// Read the favorites available in fast channel list and compare with the given list private static void verifyFavoriteOrder(List <Favourite> expFavorites, _Step step) { // Read all listed favorites List <Favourite> readFavorites = new List <Favourite>(); string channelTitle = ""; string channelNumber = ""; // Read the focused channel name if (!CL.EA.UI.Utils.GetEpgInfo("chname", ref channelTitle)) { step.FailStep(CL, "Failed to verify favorite order: Unable to get 'chname' milestone when parsing favorite list"); } // Read the focused channel number if (!CL.EA.UI.Utils.GetEpgInfo("chNum", ref channelNumber)) { step.FailStep(CL, "Failed to verify favorite order: Unable to get 'chNum' milestone when parsing favorite list"); } do { // Store the favorite channel name/number readFavorites.Add(new Favourite() { channelName = channelTitle, channelNumber = Int32.Parse(channelNumber) }); CL.EA.UI.Utils.ClearEPGInfo(); // Navigate to next favorite by pressing DOWN key CL.EA.UI.Utils.SendIR("SELECT_DOWN"); // Read the focused channel name if (!CL.EA.UI.Utils.GetEpgInfo("chname", ref channelTitle)) { step.FailStep(CL, "Failed to verify favorite order: Unable to get 'chname' milestone when parsing favorite list"); } // Read the focused channel number if (!CL.EA.UI.Utils.GetEpgInfo("chNum", ref channelNumber)) { step.FailStep(CL, "Failed to verify favorite order: Unable to get 'chNum' milestone when parsing favorite list"); } } while (channelTitle != readFavorites[0].channelName); // Sort the read favorites by channel number readFavorites.Sort(); // compare with the expected list of favorite if (!readFavorites.SequenceEqual(expFavorites)) { step.FailStep(CL, "Wrong favorite order\nRead: " + String.Join(", ", readFavorites) + "\nExpected: " + String.Join(", ", expFavorites)); } }
// Launch channel bar and check information displayed private static void verifyPVRChannelBar(Service service, bool isFavourite, string channelNumber, string eventName, _Step step) { // Get poster url displayed in action bar (from archive recordings) to compare with url displayed in channel bar string expPosterUrl = ""; try { CL.EA.UI.Utils.GetEpgInfo("thumbnail", ref expPosterUrl); } catch (Exception) { } CL.EA.UI.Utils.ClearEPGInfo(); // Launch channel bar try { CL.EA.UI.ChannelBar.Navigate(); } catch (Exception) { step.FailStep(CL, "Failed to launch channel bar during record playback"); } // Check channel logo if (service.HasChannelLogo.Equals("True")) { string channelLogo = ""; try{ CL.EA.UI.Utils.GetEpgInfo("channel_logo", ref channelLogo); } catch (Exception) { step.FailStep(CL, "Failed to verify channel bar: Unable to get 'channel_logo' milestone"); } if (string.IsNullOrEmpty(channelLogo)) { step.FailStep(CL, "Failed to verify channel bar: Channel logo is null or empty"); } } // Else check channel name else { string channelName = ""; try { CL.EA.UI.Utils.GetEpgInfo("chname", ref channelName); } catch (Exception) { step.FailStep(CL, "Failed to verify channel bar: Unable to get 'chname' milestone"); } if (channelName != service.Name) { step.FailStep(CL, "Failed to verify channel bar: wong channel name. Expected: " + channelName + ", Returned: " + service.Name); } } // Check favourite indication string favouriteMilestone = ""; try { CL.EA.UI.Utils.GetEpgInfo("IsFavourite", ref favouriteMilestone); } catch (Exception) { step.FailStep(CL, "Failed to verify channel bar: unable to get 'IsFavourite' milestone"); } if ((isFavourite) && (favouriteMilestone != "True")) { step.FailStep(CL, "Failed to verify channel bar: Wrong favourite indication. Expected: indication displayed, Returned: indication not displayed"); } else if ((!isFavourite) && (favouriteMilestone == "True")) { step.FailStep(CL, "Failed to verify channel bar: Wrong favourite indication. Expected: indication not displayed, Returned: indication displayed"); } // Check channel number string channelNb = ""; try { CL.EA.UI.Utils.GetEpgInfo("chnum", ref channelNb); } catch (Exception) { step.FailStep(CL, "Failed to verify channel bar: Unable to get 'chnum' milestone"); } if (channelNb != channelNumber) { step.FailStep(CL, "Failed to verify channel bar: Wrong channel number. Expected: " + channelNumber + ", Returned: " + channelNb); } //Waiting for few seconds as it takes time to load the thumbnail CL.IEX.Wait(8); // Check poster string posterUrl = ""; try { CL.EA.UI.Utils.GetEpgInfo("thumbnail", ref posterUrl); if (posterUrl != expPosterUrl) { step.FailStep(CL, "Failed to verify channel bar: Wrong poster url. Expected: " + expPosterUrl + ", Returned: " + posterUrl); } } catch (Exception) { if (expPosterUrl != "") { step.FailStep(CL, "Failed to verify channel bar: Wrong poster url. Expected: " + expPosterUrl + ", Returned: null"); } } // Check event name string evtName = ""; try { CL.EA.UI.Utils.GetEpgInfo("evtname", ref evtName); } catch (Exception) { step.FailStep(CL, "Failed to verify channel bar: Unable to get 'evtname' milestone"); } if (evtName != eventName) { step.FailStep(CL, "Failed to verify channel bar: Wrong event name. Expected: " + eventName + ", Returned: " + evtName); } }
// Verify the favorites order in re-ordering menu and compare with the given list private static void verifyFavoriteOrder(List <string> expFavoriteChannelList, _Step step) { // Navigate to Re-ordering menu if (!CL.EA.UI.Utils.EPG_Milestones_NavigateByName("STATE:RENUMBER FAVOURITES")) { step.FailStep(CL, "Failed to verify favorite order: Unable to navigate to re-ordering menu"); } // Read all listed favorites List <Favourite> readFavorites = new List <Favourite>(); string channelTitle = ""; string channelNumber = ""; // Read the focused channel name if (!CL.EA.UI.Utils.GetEpgInfo("title", ref channelTitle)) { step.FailStep(CL, "Failed to verify favorite order: Unable to get 'title' milestone when parsing favorite list"); } // Read the focused channel number if (!CL.EA.UI.Utils.GetEpgInfo("id", ref channelNumber)) { step.FailStep(CL, "Failed to verify favorite order: Unable to get 'id' milestone when parsing favorite list"); } do { // Store the favorite channel name/number readFavorites.Add(new Favourite() { channelName = channelTitle, channelNumber = Int32.Parse(channelNumber) }); CL.EA.UI.Utils.ClearEPGInfo(); // Navigate to next favorite by pressing DOWN key CL.EA.UI.Utils.SendIR("SELECT_DOWN"); // Read the focused channel name if (!CL.EA.UI.Utils.GetEpgInfo("title", ref channelTitle)) { step.FailStep(CL, "Failed to verify favorite order: Unable to get 'title' milestone when parsing favorite list"); } // Read the focused channel number if (!CL.EA.UI.Utils.GetEpgInfo("id", ref channelNumber)) { step.FailStep(CL, "Failed to verify favorite order: Unable to get 'chNum' milestone when parsing favorite list"); } } while (channelTitle != readFavorites[0].channelName); // Sort the read favorites by channel number readFavorites.Sort(); // compare with the expected list of favorite for (int i = 0; i < expFavoriteChannelList.Count; i++) { // compare favorite channel numbers and channel names if ((readFavorites[i].channelNumber != (i + 1)) || (readFavorites[i].channelName != expFavoriteChannelList[i])) { step.FailStep(CL, "Wrong favorite order\nRead: " + String.Join(", ", readFavorites) + "\nExpected: " + String.Join(", ", expFavoriteChannelList)); } } CL.EA.ReturnToLiveViewing(); }
// Verify the favorites order in re-ordering menu and compare with the given list private static void verifyFavoriteOrder(List <Favourite> expFavorites, _Step step) { //Restore default settings IEXGateway._IEXResult res; // Navigate to Re-ordering menu res = CL.IEX.MilestonesEPG.NavigateByName("STATE:RENUMBER FAVOURITES"); if (!res.CommandSucceeded) { step.FailStep(CL, "Failed to verify favorite order: Unable to navigate to re-ordering menu"); } CL.IEX.Wait(10); // Read all listed favorites List <Favourite> readFavorites = new List <Favourite>(); string channelTitle = ""; string channelNumber = ""; // Read the focused channel name if (!CL.EA.UI.Utils.GetEpgInfo("title", ref channelTitle)) { step.FailStep(CL, "Failed to verify favorite order: Unable to get 'title' milestone when parsing favorite list"); } // Read the focused channel number if (!CL.EA.UI.Utils.GetEpgInfo("id", ref channelNumber)) { step.FailStep(CL, "Failed to verify favorite order: Unable to get 'id' milestone when parsing favorite list"); } do { // Store the favorite channel name/number readFavorites.Add(new Favourite() { channelName = channelTitle, channelNumber = Int32.Parse(channelNumber) }); CL.EA.UI.Utils.ClearEPGInfo(); CL.IEX.Wait(5); // Navigate to next favorite by pressing DOWN key CL.EA.UI.Utils.SendIR("SELECT_DOWN", 5000); // Read the focused channel name if (!CL.EA.UI.Utils.GetEpgInfo("title", ref channelTitle)) { step.FailStep(CL, "Failed to verify favorite order: Unable to get 'title' milestone when parsing favorite list"); } // Read the focused channel number if (!CL.EA.UI.Utils.GetEpgInfo("id", ref channelNumber)) { step.FailStep(CL, "Failed to verify favorite order: Unable to get 'chNum' milestone when parsing favorite list"); } CL.IEX.Wait(5); } while (channelTitle != readFavorites[0].channelName); // Sort the read favorites by channel number readFavorites.Sort(); // compare with the expected list of favorite if (!readFavorites.SequenceEqual(expFavorites)) { step.FailStep(CL, "Wrong favorite order\nRead: " + String.Join(", ", readFavorites) + "\nExpected: " + String.Join(", ", expFavorites)); } CL.EA.ReturnToLiveViewing(); }