<commit_before>var utils = require('./utils.js');

exports.receiver = function() {
  this.viewMostRecentSubmission = function() {
    return element(by.id('tip-0')).click(); 
  };

  this.addPublicKey = function(pub_pgp_key) {
    browser.setLocation('receiver/preferences');
    element(by.cssContainingText("a", "Encryption settings")).click();
    var pgpTxtArea = element(by.model('preferences.pgp_key_public'));
    
    return pgpTxtArea.isDisplayed().then(function(displayed) {
      if (!displayed) {
        clickDelPubKey();
      }

    pgpTxtArea.clear();
    pgpTxtArea.sendKeys(pub_pgp_key);
    return element(by.cssContainingText("span", "Update notification and encryption settings")).click();
    });
  };

  function clickDelPubKey() {
    element(by.model('preferences.pgp_key_remove')).click();
    return element(by.cssContainingText("span", "Update notification and encryption settings")).click();
  }

  this.removePublicKey = function() {
    browser.setLocation('receiver/preferences');
    element(by.cssContainingText('a', 'Encryption settings')).click();
    return clickDelPubKey();
  };
};

exports.whistleblower = function() {
  this.performSubmission = function(title) {
    browser.get('/#/submission');

    browser.wait(function(){
      // Wait until the proof of work is resolved;
      return element(by.id('submissionForm')).evaluate('submission').then(function(submission) {
        return submission.pow === true;
      });
    });

    element(by.id('step-receiver-selection')).element(by.id('receiver-0')).click();
    element(by.id('step-receiver-selection')).element(by.id('receiver-1')).click();
    element(by.id('NextStepButton')).click();
    element(by.id('step-0')).element(by.id('step-0-field-0-0-input-0')).sendKeys(title);

    var submit_button = element(by.id('SubmitButton'));
    var isClickable = protractor.ExpectedConditions.elementToBeClickable(submit_button);
    browser.wait(isClickable);<commit_msg>Add browser timeout to E2E receipt wait<commit_after>var utils = require('./utils.js');

exports.receiver = function() {
  this.viewMostRecentSubmission = function() {
    return element(by.id('tip-0')).click(); 
  };

  this.addPublicKey = function(pub_pgp_key) {
    browser.setLocation('receiver/preferences');
    element(by.cssContainingText("a", "Encryption settings")).click();
    var pgpTxtArea = element(by.model('preferences.pgp_key_public'));
    
    return pgpTxtArea.isDisplayed().then(function(displayed) {
      if (!displayed) {
        clickDelPubKey();
      }

    pgpTxtArea.clear();
    pgpTxtArea.sendKeys(pub_pgp_key);
    return element(by.cssContainingText("span", "Update notification and encryption settings")).click();
    });
  };

  function clickDelPubKey() {
    element(by.model('preferences.pgp_key_remove')).click();
    return element(by.cssContainingText("span", "Update notification and encryption settings")).click();
  }

  this.removePublicKey = function() {
    browser.setLocation('receiver/preferences');
    element(by.cssContainingText('a', 'Encryption settings')).click();
    return clickDelPubKey();
  };
};

exports.whistleblower = function() {
  this.performSubmission = function(title) {
    browser.get('/#/submission');

    browser.wait(function(){
      // Wait until the proof of work is resolved;
      return element(by.id('submissionForm')).evaluate('submission').then(function(submission) {
        return submission.pow === true;
      });
    }, utils.browserTimeout());

    element(by.id('step-receiver-selection')).element(by.id('receiver-0')).click();
    element(by.id('step-receiver-selection')).element(by.id('receiver-1')).click();
    element(by.id('NextStepButton')).click();
    element(by.id('step-0')).element(by.id('step-0-field-0-0-input-0')).sendKeys(title);

    var submit_button = element(by.id('SubmitButton'));
    var isClickable = protractor.ExpectedConditions.elementToBeClickable(submit_button);
    browser.wait(isClickable);
{'fraction_non_alphanumeric': 0.16825715720743345, 'fraction_numerical': 0.004269211451531894, 'mean_word_length': 4.4786795048143055, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '1051045', 'n_tokens_mistral': 1241, 'n_tokens_neox': 1238, 'n_words': 166}