title: How to select correct value depending on params?
body: <p>So I am trying to solve a solution with protractor where I have few options. I want to be able to test timeslots which are between 1600, 1900 and a else statement.</p>
  
  <p>If we select 1600 then we obviously do the 1600 element and etc etc.</p>
  
  <p>When I start my code it goes doing the code:</p>
  
  <p><code>npm run e2e.js --params.tiemslot.t1600</code></p>
  
  <p>it can also be t1900 or no params at all.</p>
  
  <p>The test cases are following:</p>
  
  <pre><code>const utils = require("../utils/utils");
  const ServicesPage = require("../objects/servicesPage.obj");
  
  describe("Services page", function () {
      servicesPage = new ServicesPage();
  
      if (browser.params.timeslot.t1600) {
          it("Has truck and choose 1600 timeslot delivery",
              async function () {
                  const nextStep = servicesPage.getForm().buttons.nextStep;
  
                  await servicesPage.truckLateDelivery();
  
                  await utils.elementToBeClickable(nextStep);
                  await utils.click(nextStep);
              })
      }
      else if (browser.params.timeslot.t1900) {
          it("Has truck and choose 1900 delivery",
              async function () {
                  const nextStep = servicesPage.getForm().buttons.nextStep;
  
                  await servicesPage.truckLateDelivery();
  
                  await utils.elementToBeClickable(nextStep);
                  await utils.click(nextStep);
              })
      }
      else {
          it("Has truck and choose latest delivery",
              async function () {
                  const nextStep = servicesPage.getForm().buttons.nextStep;
  
                  await servicesPage.chooseLatestDelivery();
  
                  await utils.elementToBeClickable(nextStep);
                  await utils.click(nextStep);
              })
      }
  });
  </code></pre>
  
  <p>and my object script is </p>
  
  <pre><code>const utils = require("../utils/utils");
  const servicesPage = require("../specs/servicesPage.specs");
  
  module.exports = class DetailsPage {
      constructor() {
          const _buttons = {
              nextStep: servicesPage.nextStepButton,
              lateDelivery: servicesPage.lateDeliveryCheckbox,
              truck: servicesPage.truckButton,
              timeSlotAll: servicesPage.timeslotAll,
              timeSlot1600: servicesPage.timeSlot1600,
              timeSlot1900: servicesPage.timeSlot1900,
          };
  
          this.getFormButtons = function () {
              return _buttons;
          };
      }
  
      getForm() {
          return {
              buttons: this.getFormButtons()
          };
      }
  
      async truckLateDelivery() {
          const truckButton = this.getForm().buttons.truck;
          const lateDelivery = this.getForm().buttons.lateDelivery;
          const timeslot = this.getForm().buttons.timeSlot1600;
  
          //Choose Truck
          await utils.elementToBeClickable(truckButton);
          await utils.click(truckButton);
  
          //Click Late Delivery
          await utils.elementToBeClickable(timeslot);
          await utils.click(timeslot);
  
          //Click late hour checkbox
          await utils.elementToBeClickable(lateDelivery);
          await utils.click(lateDelivery);
      }
  
      async chooseLatestDelivery() {
  
          const truckButton = this.getForm().buttons.truck;
          const lateDelivery = this.getForm().buttons.lateDelivery;
          const timeSlots = this.getForm().buttons.timeSlotAll;
  
          //Choose Truck
          await utils.elementToBeClickable(truckButton);
          await utils.click(truckButton);
  
          //check if timeslots are avaliable
          await utils.presenceOf(timeSlots);
  
          const countElement = await timeSlots.count();
          console.log(`Found ${countElement} timeslots buttons`);
  
          //Choose last timeslot
          await utils.elementToBeClickable(timeSlots.last());
          await utils.click(timeSlots.last());
  
          //Click on checkbox
          await utils.elementToBeClickable(lateDelivery);
          await utils.click(lateDelivery);
      }
  };
  </code></pre>
  
  <p>and my problem is that I need by somehow give the value <code>async truckLateDelivery() {</code> to know to run t1600 or t1900 basically and I am not sure how I can do that? Because as you can see I have the function <code>_buttons</code> which has the correct elements and I have the function <code>truckLateDelivery()</code> that handles the tests.</p>
  
  <p>So my question is how can I let the test case know if I want to run <code>npm run e2e.js --params.tiemslot.t1600</code> to run the t1600 and if I write <code>npm run e2e.js --params.tiemslot.t1900</code> to run t1900 and to choose the correct element? </p>