title: Check filename if correct file is downloaded using Protractor
body: <p>I am trying to write a test case which downloads a file on click of a button. Now I am trying to read that file name and check if correct file is downloaded.
  Below is the snippet I am using.</p>
  
  <pre><code>var filename = 'ABC.csv'
  it('Verify that file is downloaded',function(){
  PageObject.DownloadButton.click();
  browser.driver.wait(function() {
      return fs.existsSync(filename);
  }, 30000).then(function() {
      expect(fs.filename).toContain('ABC.csv');
  });
  </code></pre>
  
  <p>I am doing something wrong as i am getting async timeout error. Can someone please help me find problem here?</p>
  
  <p>I have added below code in my protractor.conf file.</p>
  
  <pre><code>prefs: {
      download: {
          prompt_for_download: false,
          default_directory: '/Downloads/',
      }
  </code></pre>