<commit_before>'use strict';

describe('loading sequences', function () {
  // start at the main page
  beforeEach(function () {
    browser.get('/');
  });

  it('should be able load the load sequence modal dialog and hide it', function () {
    // find the modal dialog (it always exists)
    var modalDialog = element(by.css('.ng-modal'));
    expect(modalDialog.isDisplayed()).not.toBeTruthy();
    
    // and the overlay that we'll click to hide it again
    var modalOverlay = element(by.css('.ng-modal > .ng-modal-overlay'));
    expect(modalOverlay.isDisplayed()).not.toBeTruthy();

    // and the close button
    var modalCloseButton = element(by.css('.ng-modal > .ng-modal-dialog > .ng-modal-close'));
    // this really should be tested, but it fails in firefox, so we can't really test it over all
    // expect(modalCloseButton.isDisplayed()).not.toBeTruthy();

    // load it by pressing the Load button
    var loadButton = element(by.css('.left-controls')).all(by.css('button')).first();
    loadButton.click();
    expect(modalDialog.isDisplayed()).toBeTruthy();
    expect(modalOverlay.isDisplayed()).toBeTruthy();
    // this really should be tested, but it fails in firefox, so we can't really test it over all
    // expect(modalCloseButton.isDisplayed()).toBeTruthy();

    // close it by pressing the close button (only if it's displayed... thanks firefox for being annoying)
    modalCloseButton.isDisplayed().then(function (val) {
      if (val) {
        modalCloseButton.click();
        expect(modalDialog.isDisplayed()).not.toBeTruthy();
        expect(modalOverlay.isDisplayed()).not.toBeTruthy();
        expect(modalCloseButton.isDisplayed()).not.toBeTruthy();
      }
    });

    // load it again and close it by pressing the overlay
    loadButton.click();
    expect(modalDialog.isDisplayed()).toBeTruthy();
    expect(modalOverlay.isDisplayed()).toBeTruthy();
    expect(modalCloseButton.isDisplayed()).toBeTruthy();
    // have to explicitly click on 1/1 to make sure it's the overlay and not antyhing on top of it
    browser.actions().mouseMove(modalOverlay, {x: 1, y: 1}).click().perform();
    expect(modalDialog.isDisplayed()).not.toBeTruthy();
    expect(modalOverlay.isDisplayed()).not.toBeTruthy();
    expect(modalCloseButton.isDisplayed()).not.toBeTruthy();
  });

  /* Known wrong sequences loaded from web service */
  it('should show an error for a known incorrect PEPTIDE sequence', function () {
    // load the dialog and type in a known incorrect sequence
    element(by.css('.left-controls')).all(by.css('button')).first().click();
    element(by.css('.ng-modal select')).all(by.tagName('option')).get(2).click();
    element(by.css('.ng-modal textarea')).sendKeys('dAA');
    element(by.id('modalLoadButton')).click();
    expect(element(by.css('.message-span')).getText()).toContain('Not appropriate amino acid for HELM');
  });

  it('should show an error for a known incorrect RNA sequence', function () {
    // load the dialog and type in a known incorrect sequence
    element(by.css('.left-controls')).all(by.css('button')).first().click();
    element(by.css('.ng-modal select')).all(by.tagName('option')).get(1).click();
    element(by.css('.ng-modal textarea')).sendKeys('AZD');
    element(by.id('modalLoadButton')).click();<commit_msg>remove wrong references to isDisplayed<commit_after>'use strict';

describe('loading sequences', function () {
  // start at the main page
  beforeEach(function () {
    browser.get('/');
  });

  it('should be able load the load sequence modal dialog and hide it', function () {
    // find the modal dialog (it always exists)
    var modalDialog = element(by.css('.ng-modal'));
    expect(modalDialog.isDisplayed()).not.toBeTruthy();
    
    // and the overlay that we'll click to hide it again
    var modalOverlay = element(by.css('.ng-modal > .ng-modal-overlay'));
    expect(modalOverlay.isDisplayed()).not.toBeTruthy();

    // and the close button
    var modalCloseButton = element(by.css('.ng-modal > .ng-modal-dialog > .ng-modal-close'));
    // this really should be tested, but it fails in firefox, so we can't really test it over all
    // expect(modalCloseButton.isDisplayed()).not.toBeTruthy();

    // load it by pressing the Load button
    var loadButton = element(by.css('.left-controls')).all(by.css('button')).first();
    loadButton.click();
    expect(modalDialog.isDisplayed()).toBeTruthy();
    expect(modalOverlay.isDisplayed()).toBeTruthy();
    // this really should be tested, but it fails in firefox, so we can't really test it over all
    // expect(modalCloseButton.isDisplayed()).toBeTruthy();

    // close it by pressing the close button (only if it's displayed... thanks firefox for being annoying)
    modalCloseButton.isDisplayed().then(function (val) {
      if (val) {
        modalCloseButton.click();
      }
      // otherwise click outside
      else {
        browser.actions().mouseMove(modalOverlay, {x: 1, y: 1}).click().perform();
      }
      expect(modalDialog.isDisplayed()).not.toBeTruthy();
      expect(modalOverlay.isDisplayed()).not.toBeTruthy();
    });

    // load it again and close it by pressing the overlay
    loadButton.click();
    expect(modalDialog.isDisplayed()).toBeTruthy();
    expect(modalOverlay.isDisplayed()).toBeTruthy();
    // have to explicitly click on 1/1 to make sure it's the overlay and not antyhing on top of it
    browser.actions().mouseMove(modalOverlay, {x: 1, y: 1}).click().perform();
    expect(modalDialog.isDisplayed()).not.toBeTruthy();
    expect(modalOverlay.isDisplayed()).not.toBeTruthy();
  });

  /* Known wrong sequences loaded from web service */
  it('should show an error for a known incorrect PEPTIDE sequence', function () {
    // load the dialog and type in a known incorrect sequence
    element(by.css('.left-controls')).all(by.css('button')).first().click();
    element(by.css('.ng-modal select')).all(by.tagName('option')).get(2).click();
    element(by.css('.ng-modal textarea')).sendKeys('dAA');
    element(by.id('modalLoadButton')).click();
    expect(element(by.css('.message-span')).getText()).toContain('Not appropriate amino acid for HELM');
  });

  it('should show an error for a known incorrect RNA sequence', function () {
    // load the dialog and type in a known incorrect sequence
    element(by.css('.left-controls')).all(by.css('button')).first().click();
    element(by.css('.ng-modal select')).all(by.tagName('option')).get(1).click();
    element(by.css('.ng-modal textarea')).sendKeys('AZD');
    element(by.id('modalLoadButton')).click();
{'fraction_non_alphanumeric': 0.1594048884165781, 'fraction_numerical': 0.0021253985122210413, 'mean_word_length': 3.7947598253275108, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 9, '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': '1348404', 'n_tokens_mistral': 1930, 'n_tokens_neox': 1918, 'n_words': 495}