Cucumber and Protractor with Javascript - Write in a separate text file The Next CEO of Stack OverflowJavascript - Login with randomic userCalculate text width with JavaScriptTrigger a button click with JavaScript on the Enter key in a text boxWhy should text files end with a newline?Strip HTML from Text JavaScriptHow do I include a JavaScript file in another JavaScript file?How do I save a String to a text file using Java?How to append text to an existing file in JavaWriting files in Node.jsHow to print a number with commas as thousands separators in JavaScriptHow do I get the value of text input field using JavaScript?

Does the Brexit deal have to be agreed by both Houses?

Implement the Thanos sorting algorithm

Visit to the USA with ESTA approved before trip to Iran

How to use tikz in fbox?

Only print output after finding pattern

How to write papers efficiently when English isn't my first language?

What does "Its cash flow is deeply negative" mean?

What is the point of a new vote on May's deal when the indicative votes suggest she will not win?

Grabbing quick drinks

Would this house-rule that treats advantage as a +1 to the roll instead (and disadvantage as -1) and allows them to stack be balanced?

What happens if you roll doubles 3 times then land on "Go to jail?"

How to count occurrences of text in a file?

WOW air has ceased operation, can I get my tickets refunded?

If I blow insulation everywhere in my attic except the door trap, will heat escape through it?

Go Pregnant or Go Home

The King's new dress

What is meant by a M next to a roman numeral?

Rotate a column

What is the purpose of the Evocation wizard's Potent Cantrip feature?

Was a professor correct to chastise me for writing "Prof. X" rather than "Professor X"?

How should I support this large drywall patch?

How can I get through very long and very dry, but also very useful technical documents when learning a new tool?

Why didn't Theresa May consult with Parliament before negotiating a deal with the EU?

Putting a 2D region plot under a 3D plot



Cucumber and Protractor with Javascript - Write in a separate text file



The Next CEO of Stack OverflowJavascript - Login with randomic userCalculate text width with JavaScriptTrigger a button click with JavaScript on the Enter key in a text boxWhy should text files end with a newline?Strip HTML from Text JavaScriptHow do I include a JavaScript file in another JavaScript file?How do I save a String to a text file using Java?How to append text to an existing file in JavaWriting files in Node.jsHow to print a number with commas as thousands separators in JavaScriptHow do I get the value of text input field using JavaScript?










0















I'm using Cucumber and Protractor with Node.js to test my web application. I use javascript to write code with chai expectation. I need to write some results in a separate text file. How can I do it? I need the result in the text file because, I analize the result in the excel. The code is that:



When('I insert the related username and password to access it', timeout: 90*1000, function (next) 
let username_field = element(by.css('.UsernameInput'));
browser.wait(until.presenceOf(username_field), 1200000, 'Element taking too long to appear in the DOM');
let username_password = element(by.css('.PasswordInput'));
browser.wait(until.presenceOf(username_password), 1200000, 'Element taking too long to appear in the DOM');
const fs = require('fs');
const userFile = fs.readFileSync('parametri.txt', encoding: 'utf8');
const users = userFile.split('n');
const randomUser = () =>
const number = Math.floor(Math.random() * Math.floor(users.length - 1));
const user = users[number].split(',');
return username: user[0], password: user[1]

const user = randomUser();
username_field.sendKeys(user.username);
username_password.sendKeys(user.password);
username_field.getText().then(function(text)
var n=new Date();
var time= n.getTime();
browser.sleep(d);
console.log(time);
console.log('1°When');
function WriteFile()
const feat1_stepUno = require('feat1_stepUno');
let a= '5000';
const file_time = feat1_stepUno.writeFile('tempo.txt',a,(err) =>
if (err) throw err;
)


expect(username_field.isPresent()).to.eventually.be.true.and.notify(next);
)
);


Thank you so much for your help!










share|improve this question




























    0















    I'm using Cucumber and Protractor with Node.js to test my web application. I use javascript to write code with chai expectation. I need to write some results in a separate text file. How can I do it? I need the result in the text file because, I analize the result in the excel. The code is that:



    When('I insert the related username and password to access it', timeout: 90*1000, function (next) 
    let username_field = element(by.css('.UsernameInput'));
    browser.wait(until.presenceOf(username_field), 1200000, 'Element taking too long to appear in the DOM');
    let username_password = element(by.css('.PasswordInput'));
    browser.wait(until.presenceOf(username_password), 1200000, 'Element taking too long to appear in the DOM');
    const fs = require('fs');
    const userFile = fs.readFileSync('parametri.txt', encoding: 'utf8');
    const users = userFile.split('n');
    const randomUser = () =>
    const number = Math.floor(Math.random() * Math.floor(users.length - 1));
    const user = users[number].split(',');
    return username: user[0], password: user[1]

    const user = randomUser();
    username_field.sendKeys(user.username);
    username_password.sendKeys(user.password);
    username_field.getText().then(function(text)
    var n=new Date();
    var time= n.getTime();
    browser.sleep(d);
    console.log(time);
    console.log('1°When');
    function WriteFile()
    const feat1_stepUno = require('feat1_stepUno');
    let a= '5000';
    const file_time = feat1_stepUno.writeFile('tempo.txt',a,(err) =>
    if (err) throw err;
    )


    expect(username_field.isPresent()).to.eventually.be.true.and.notify(next);
    )
    );


    Thank you so much for your help!










    share|improve this question


























      0












      0








      0








      I'm using Cucumber and Protractor with Node.js to test my web application. I use javascript to write code with chai expectation. I need to write some results in a separate text file. How can I do it? I need the result in the text file because, I analize the result in the excel. The code is that:



      When('I insert the related username and password to access it', timeout: 90*1000, function (next) 
      let username_field = element(by.css('.UsernameInput'));
      browser.wait(until.presenceOf(username_field), 1200000, 'Element taking too long to appear in the DOM');
      let username_password = element(by.css('.PasswordInput'));
      browser.wait(until.presenceOf(username_password), 1200000, 'Element taking too long to appear in the DOM');
      const fs = require('fs');
      const userFile = fs.readFileSync('parametri.txt', encoding: 'utf8');
      const users = userFile.split('n');
      const randomUser = () =>
      const number = Math.floor(Math.random() * Math.floor(users.length - 1));
      const user = users[number].split(',');
      return username: user[0], password: user[1]

      const user = randomUser();
      username_field.sendKeys(user.username);
      username_password.sendKeys(user.password);
      username_field.getText().then(function(text)
      var n=new Date();
      var time= n.getTime();
      browser.sleep(d);
      console.log(time);
      console.log('1°When');
      function WriteFile()
      const feat1_stepUno = require('feat1_stepUno');
      let a= '5000';
      const file_time = feat1_stepUno.writeFile('tempo.txt',a,(err) =>
      if (err) throw err;
      )


      expect(username_field.isPresent()).to.eventually.be.true.and.notify(next);
      )
      );


      Thank you so much for your help!










      share|improve this question
















      I'm using Cucumber and Protractor with Node.js to test my web application. I use javascript to write code with chai expectation. I need to write some results in a separate text file. How can I do it? I need the result in the text file because, I analize the result in the excel. The code is that:



      When('I insert the related username and password to access it', timeout: 90*1000, function (next) 
      let username_field = element(by.css('.UsernameInput'));
      browser.wait(until.presenceOf(username_field), 1200000, 'Element taking too long to appear in the DOM');
      let username_password = element(by.css('.PasswordInput'));
      browser.wait(until.presenceOf(username_password), 1200000, 'Element taking too long to appear in the DOM');
      const fs = require('fs');
      const userFile = fs.readFileSync('parametri.txt', encoding: 'utf8');
      const users = userFile.split('n');
      const randomUser = () =>
      const number = Math.floor(Math.random() * Math.floor(users.length - 1));
      const user = users[number].split(',');
      return username: user[0], password: user[1]

      const user = randomUser();
      username_field.sendKeys(user.username);
      username_password.sendKeys(user.password);
      username_field.getText().then(function(text)
      var n=new Date();
      var time= n.getTime();
      browser.sleep(d);
      console.log(time);
      console.log('1°When');
      function WriteFile()
      const feat1_stepUno = require('feat1_stepUno');
      let a= '5000';
      const file_time = feat1_stepUno.writeFile('tempo.txt',a,(err) =>
      if (err) throw err;
      )


      expect(username_field.isPresent()).to.eventually.be.true.and.notify(next);
      )
      );


      Thank you so much for your help!







      javascript node.js selenium protractor text-files






      share|improve this question















      share|improve this question













      share|improve this question




      share|improve this question








      edited Mar 7 at 15:10







      Filippo Lombardo

















      asked Mar 7 at 14:08









      Filippo LombardoFilippo Lombardo

      136




      136






















          1 Answer
          1






          active

          oldest

          votes


















          0














          This can solve your issue:



          const fs = require('fs');
          fs.writeFile("tempo.txt", "Hey there!", function(err)
          if(err)
          return console.log(err);


          console.log("The file was saved!");
          );


          Bye!






          share|improve this answer























          • Thank u! This solve my issue!

            – Filippo Lombardo
            Mar 7 at 15:23











          Your Answer






          StackExchange.ifUsing("editor", function ()
          StackExchange.using("externalEditor", function ()
          StackExchange.using("snippets", function ()
          StackExchange.snippets.init();
          );
          );
          , "code-snippets");

          StackExchange.ready(function()
          var channelOptions =
          tags: "".split(" "),
          id: "1"
          ;
          initTagRenderer("".split(" "), "".split(" "), channelOptions);

          StackExchange.using("externalEditor", function()
          // Have to fire editor after snippets, if snippets enabled
          if (StackExchange.settings.snippets.snippetsEnabled)
          StackExchange.using("snippets", function()
          createEditor();
          );

          else
          createEditor();

          );

          function createEditor()
          StackExchange.prepareEditor(
          heartbeatType: 'answer',
          autoActivateHeartbeat: false,
          convertImagesToLinks: true,
          noModals: true,
          showLowRepImageUploadWarning: true,
          reputationToPostImages: 10,
          bindNavPrevention: true,
          postfix: "",
          imageUploader:
          brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
          contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
          allowUrls: true
          ,
          onDemand: true,
          discardSelector: ".discard-answer"
          ,immediatelyShowMarkdownHelp:true
          );



          );













          draft saved

          draft discarded


















          StackExchange.ready(
          function ()
          StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f55045754%2fcucumber-and-protractor-with-javascript-write-in-a-separate-text-file%23new-answer', 'question_page');

          );

          Post as a guest















          Required, but never shown

























          1 Answer
          1






          active

          oldest

          votes








          1 Answer
          1






          active

          oldest

          votes









          active

          oldest

          votes






          active

          oldest

          votes









          0














          This can solve your issue:



          const fs = require('fs');
          fs.writeFile("tempo.txt", "Hey there!", function(err)
          if(err)
          return console.log(err);


          console.log("The file was saved!");
          );


          Bye!






          share|improve this answer























          • Thank u! This solve my issue!

            – Filippo Lombardo
            Mar 7 at 15:23















          0














          This can solve your issue:



          const fs = require('fs');
          fs.writeFile("tempo.txt", "Hey there!", function(err)
          if(err)
          return console.log(err);


          console.log("The file was saved!");
          );


          Bye!






          share|improve this answer























          • Thank u! This solve my issue!

            – Filippo Lombardo
            Mar 7 at 15:23













          0












          0








          0







          This can solve your issue:



          const fs = require('fs');
          fs.writeFile("tempo.txt", "Hey there!", function(err)
          if(err)
          return console.log(err);


          console.log("The file was saved!");
          );


          Bye!






          share|improve this answer













          This can solve your issue:



          const fs = require('fs');
          fs.writeFile("tempo.txt", "Hey there!", function(err)
          if(err)
          return console.log(err);


          console.log("The file was saved!");
          );


          Bye!







          share|improve this answer












          share|improve this answer



          share|improve this answer










          answered Mar 7 at 15:20









          SpicchioSpicchio

          577




          577












          • Thank u! This solve my issue!

            – Filippo Lombardo
            Mar 7 at 15:23

















          • Thank u! This solve my issue!

            – Filippo Lombardo
            Mar 7 at 15:23
















          Thank u! This solve my issue!

          – Filippo Lombardo
          Mar 7 at 15:23





          Thank u! This solve my issue!

          – Filippo Lombardo
          Mar 7 at 15:23



















          draft saved

          draft discarded
















































          Thanks for contributing an answer to Stack Overflow!


          • Please be sure to answer the question. Provide details and share your research!

          But avoid


          • Asking for help, clarification, or responding to other answers.

          • Making statements based on opinion; back them up with references or personal experience.

          To learn more, see our tips on writing great answers.




          draft saved


          draft discarded














          StackExchange.ready(
          function ()
          StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f55045754%2fcucumber-and-protractor-with-javascript-write-in-a-separate-text-file%23new-answer', 'question_page');

          );

          Post as a guest















          Required, but never shown





















































          Required, but never shown














          Required, but never shown












          Required, but never shown







          Required, but never shown

































          Required, but never shown














          Required, but never shown












          Required, but never shown







          Required, but never shown







          Popular posts from this blog

          1928 у кіно

          Захаров Федір Захарович

          Ель Греко