title: How can I use the same value as written in the Json during the same test execution in the testcafe
body: <p>I have been trying to use the value from the JSON that I have got added successfully using fs.write() function,</p>
  <p>There are two test cases in the same fixture, one to create an ID and 2nd to use that id. I can wrote the id successfully in the json file using fs.write() function and trying to use that id using importing json file like var myid=require('../../resources/id.json')</p>
  <p>The json file storing correct id of the current execution but I get the id of first test execution in 2nd execution.</p>
  <p>For example, id:1234 is stored during first test execution and id:4567 is stored in 2nd test execution. During 2nd test execution I need the id:4567 but I get 1234 this is weird, isn't it?</p>
  <p>I use it like
  t.typeText(ele, myid.orid)</p>
  <p>my json file contains only id like {&quot;orid&quot;:&quot;4567&quot;}</p>
  <p>I am new to Javascript and Testcafe any help would really be appreciated</p>
  <h2>Write File class</h2>
  <pre><code>const fs = require('fs')
  const baseClass =require('../component/base')
  class WriteIntoFile{
      constructor(orderID){
          const OID = {
              orderid: orderID
          }
          const jsonString = JSON.stringify(OID)
          fs.writeFile(`resources\id.json`, jsonString, err =&gt; {
              if (err) {
                  console.log('Error writing file', err)
              } else {
                  console.log('Successfully wrote file')
              }
          })
      }
  }
  export default WriteIntoFile
  </code></pre>
  <p>I created 2 different classes in order to separate create &amp; update operations and call the functions of create &amp; update order in single fixture in test file</p>
  <h2>Create Order class</h2>
  <pre><code>class CreateOrder{
  
          ----
          ----
          ----
      async createNewOrder(){
      //get text of created ordder and saved order id in to the json file
          -----
          -----
          -----
     const orId= await baseclass.getOrderId();
     new WriteIntoFile(orId)
     console.log(orId)
     
          -----
          -----
          -----
  }
  }export default CreateOrder
  </code></pre>
  <h2>Update Order class</h2>
  <pre><code>var id=require('../../resources/id.json')
  class UpdateOrder{
  async searchOrderToUpdate(){
       await t
      ***//Here, I get old order id that was saved during previous execution***
      .typeText(baseClass.searchBox, id.orderid)
      .wait(2500)
      .click(baseClass.searchIcon)
      .doubleClick(baseClass.orderAGgrid)
      console.log(id.ordderid)
      
      ----
      ----
      async updateOrder(){
          this.searchOrderToUpdate()
          .typeText(baseClass.phNo, '1234567890')
          .click(baseClass.saveBtn) 
      }
      
  }export default UpdateOrder
  </code></pre>
  <h2>Test file</h2>
  <pre><code>const newOrder = new CreateOrder();
  const update = new UpdateOrder();
  const role = Role(`siteurl`, async t =&gt; {
      await t 
     login('id')
      await t
     .wait(1500)
    },{preserveUrl:true})
  
    test('Should be able to create an Order', async t=&gt;{
      await newOrder.createNewOrder();
    });
    test('Should be able to update an order', async t=&gt;{
         
      await update.updateOrder();
    });
  </code></pre>