Forum Discussion

johnsski's avatar
johnsski
New Contributor
3 months ago
Solved

2 For loops to run through 2 arrays - how?!

Hi. I'm trying to create a test that clicks on each tab (via an array of tab names) then runs a parameterised test using an array of tab mappings as below. It runs for the 1st tab then tries to run ...
  • johnsski's avatar
    3 months ago

    rraghvaniThanks for the clues(!) After some minutes I've done it!


    function Verify_ContextMenuOptionsOnAllEyeLensSubtabsTEST()
    {
      Log.AppendFolder("Verify the context menu options on all the Eye subtabs");
      
      //arrange
      let eyeTabs = [ ["Tear Film", tearFilm], ["Cornea", cornea], ["Nasolacrimal Duct", nasolacrimalDuct], ["Conjunctiva", conjunctiva], ["Aqueous Humor", aqueousHumor], ["Retina", retina], ["Choroid", choroid], ["Sclera", sclera], ["Iris", iris], ["Vitreous Humor", vitreousHumor], ["Lens", lens] ];  
          
      for (let i = 0; i < eyeTabs.length; i++)
      {    
        Log.AppendFolder("Verify the context menu options on the: "  + eyeTabs[i][0] + " tab");       
        Actions.Select_TabByName(Aliases.simcyp.MainWindowInstance.RadTabControl, eyeTabs[i][0]);
        MenuToolBars.ClearAllSelections();
        Verify_GenericEyeSubTabContextMenuOptions(eyeTabs[i][1]);        
        Log.PopLogFolder();
      } 
      
      Log.PopLogFolder();
    }