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

          Save data to MySQL database using ExtJS and PHP [closed]2019 Community Moderator ElectionHow can I prevent SQL injection in PHP?Which MySQL data type to use for storing boolean valuesPHP: Delete an element from an arrayHow do I connect to a MySQL Database in Python?Should I use the datetime or timestamp data type in MySQL?How to get a list of MySQL user accountsHow Do You Parse and Process HTML/XML in PHP?Reference — What does this symbol mean in PHP?How does PHP 'foreach' actually work?Why shouldn't I use mysql_* functions in PHP?

          Compiling GNU Global with universal-ctags support Announcing the arrival of Valued Associate #679: Cesar Manara Planned maintenance scheduled April 23, 2019 at 23:30 UTC (7:30pm US/Eastern) Data science time! April 2019 and salary with experience The Ask Question Wizard is Live!Tags for Emacs: Relationship between etags, ebrowse, cscope, GNU Global and exuberant ctagsVim and Ctags tips and trickscscope or ctags why choose one over the other?scons and ctagsctags cannot open option file “.ctags”Adding tag scopes in universal-ctagsShould I use Universal-ctags?Universal ctags on WindowsHow do I install GNU Global with universal ctags support using Homebrew?Universal ctags with emacsHow to highlight ctags generated by Universal Ctags in Vim?

          Add ONERROR event to image from jsp tldHow to add an image to a JPanel?Saving image from PHP URLHTML img scalingCheck if an image is loaded (no errors) with jQueryHow to force an <img> to take up width, even if the image is not loadedHow do I populate hidden form field with a value set in Spring ControllerStyling Raw elements Generated from JSP tagds with Jquery MobileLimit resizing of images with explicitly set width and height attributeserror TLD use in a jsp fileJsp tld files cannot be resolved