title: Data Driven Test - Protractor
body: <p>I want is  to edit a profile details with passing data from a json file.</p>
  
  <p>Data Form having:</p>
  
  <pre><code>-First Name
  -Last Name
  -Current Password
  -New Password
  -Confirm Password, etc....
  </code></pre>
  
  <p>I need to change only Last Name. How can I do?</p>
  
  <p>--Edited--</p>
  
  <p><a href="https://i.stack.imgur.com/nLdky.jpg" rel="nofollow noreferrer">"This is the form which I have to edit."</a></p>
  
  <p>I need to change Only the Last name, First name should be the same. I'm passing values through json file.</p>
  
  <p><div class="snippet" data-lang="js" data-hide="false" data-console="true" data-babel="false">
  <div class="snippet-code">
  <pre class="snippet-code-js lang-js prettyprint-override"><code>[
    {
      "fname":"" ,
      "lname":"",
      "currentpassword":"",
      "newpassword":"",
      "confirmpassword":""
    }
  ]</code></pre>
  </div>
  </div>
  </p>
  
  <p>And this is the code :</p>
  
  <p><div class="snippet" data-lang="js" data-hide="false" data-console="true" data-babel="false">
  <div class="snippet-code">
  <pre class="snippet-code-js lang-js prettyprint-override"><code>//import login details
  var testData = require('./login_details.json');
  
  //import editprofiledata
  var editData = require('./editprofiledata.json');
  
  describe ('Edit Profile Test', function(){
  
      //browser.driver.manage().window().maximize();
      browser.get("http://example");
  
      testData.forEach (function (data) {
          it ('Login to the system, and redirect to the dashboard', function() {
              element(by.name('email')).clear().sendKeys(data.Email);
              element(by.name('password')).clear().sendKeys(data.Password);
  
              //**click on Login button**//
              element(by.css('[ng-disabled="register.$invalid"]')).click();
  
              //**popup message click**//
              element(by.css('[ng-click="tapToast()"]')).click();
          });
      });
  
           it("redirect to the Edit Profile",function () {
              
               element(by.css('[ng-click="profileView()"]')).click();
  
               element(by.css('[ng-click = "goToEditView(2)"]')).click();
  
               browser.sleep(500);
           });
  
      editData.forEach (function (data) {
          it("changing details", function () {
  
              element(by.name('fname')).clear().sendKeys(data.fname);
              element(by.name('lname')).clear().sendKeys(data.lname);
              browser.sleep(1000);
              element(by.model('userEdit.currentPassword')).clear().sendKeys(data.currentpassword);
              browser.sleep(1000);
              element(by.model('userEdit.password')).clear().sendKeys(data.newpassword);
              browser.sleep(1000);
              element(by.model('userEdit.confirmPassword')).clear().sendKeys(data.confirmpassword);
              browser.sleep(1000);
  
  element(by.css('[ng-click="editUserProfile(userEdit)"]')).click();
              browser.sleep(2000);
          });
      });
  });</code></pre>
  </div>
  </div>
  </p>
  
  <p>How can I do this?</p>