<commit_before>/*
 *
 * Test for the server, www and app.js
 */

var expect = require('chai').expect,
   webdriver = require('selenium-webdriver'),
   test = require('selenium-webdriver/testing');


test.describe('Tests made on www, app.js and its associated files', function() {

   this.timeout(15000);
   var driver,
      txtBox,
      path = '/Users/Charles/Documents/hea_analysis/south_africa/2016.04/spreadsheets/zakhc_1.xlsx'

   // Set up webdriver (using Chrome) and start the browser
   test.before(() => {
      driver = new webdriver.Builder().withCapabilities(webdriver.Capabilities.chrome()).build();
   });

   // Test 1
   test.it('should open the browser, retrieve the title, heading and first form', function() {
      driver.get('http://localhost:3000');
      driver.getTitle().then(function(title) {
         expect(title).to.contain('Load Spreadsheet')
      });
      driver.findElement(webdriver.By.css('h1')).getText().then(function(text) {
         expect(text).to.contain('HEA Analysis Spreadsheet Loader');
      });
      driver.findElement(webdriver.By.id('identifyLz')).getAttribute('action').then(function(text) {
         expect(text).to.contain('http://localhost:3000/search');
      });
      driver.findElement(webdriver.By.id('confirm')).isDisplayed().then(function(value) {
         expect(value).to.equal(false);
      });
      driver.findElement(webdriver.By.id('confirmLz')).getAttribute('action').then(function(text) {
         console.log(text);
         expect(text).to.equal('http://localhost:3000/uploads');
      });
   });

   // Test 2
   test.it('should have a drop-down saying \'Select your country...\'', function() {
      driver.findElement(webdriver.By.id('countries')).getText().then(function(text) {
         expect(text).to.contain('Select your country...');
      });
   });

   // Test 3
   test.it('should have a single-line search input box, size 70, with \'Type the name, abbreviation or code of your livelihood zone here\' shown in it', function() {
      searchBox = driver.findElement(webdriver.By.id('searchBox'));
      searchBox.getAttribute('placeholder').then(function(text) {
         expect(text).to.contain('Type the name, abbreviation or code of your livelihood zone here');
      });
      searchBox.getAttribute('size').then(function(value) {
         expect(value).to.equal('70');
      });
   });

   // Test 4<commit_msg>Added in tests for Assessment conditions and scenarios<commit_after>/*
 *
 * Test for the server, www and app.js
 */

var expect = require('chai').expect,
   webdriver = require('selenium-webdriver'),
   test = require('selenium-webdriver/testing');


test.describe('Tests made on www, app.js and its associated files', function() {

   this.timeout(15000);
   var driver,
      txtBox,
      path = '/Users/Charles/Documents/hea_analysis/south_africa/2016.04/spreadsheets/zakhc_1.xlsx'

   // Set up webdriver (using Chrome) and start the browser
   test.before(() => {
      driver = new webdriver.Builder().withCapabilities(webdriver.Capabilities.chrome()).build();
   });

   // Test 1
   test.it('should open the browser, retrieve the title, heading and first form', function() {
      driver.get('http://localhost:3000');
      driver.getTitle().then(function(title) {
         expect(title).to.contain('Load Spreadsheet')
      });
      driver.findElement(webdriver.By.css('h1')).getText().then(function(text) {
         expect(text).to.contain('HEA Analysis Spreadsheet Loader');
      });
      driver.findElement(webdriver.By.id('assess')).isDisplayed().then(function(value) {
         expect(value).to.equal(true);
      });
      formAssess = driver.findElement(webdriver.By.id('assessLz'))
      formAssess.getAttribute('method').then(function(text) {
         expect(text).to.equal('get');
      });
      formAssess.getAttribute('action').then(function(text) {
         expect(text).to.contain('http://localhost:3000/countries');
      });
      driver.findElement(webdriver.By.id('identify')).isDisplayed().then(function(value) {
         expect(value).to.equal(false);
      });
      formIdentify = driver.findElement(webdriver.By.id('identifyLz'))
      formIdentify.getAttribute('method').then(function(text) {
         expect(text).to.equal('get');
      });
      formIdentify.getAttribute('action').then(function(text) {
         expect(text).to.contain('http://localhost:3000/search');
      });
      driver.findElement(webdriver.By.id('confirm')).isDisplayed().then(function(value) {
         expect(value).to.equal(false);
      });
      driver.findElement(webdriver.By.id('confirmLz')).getAttribute('action').then(function(text) {
         console.log(text);
         expect(text).to.equal('http://localhost:3000/uploads');
      });
   });

   // Test 2


   // Test 2
   test.it('should have a drop-down saying \'Select your country...\'', function() {
      driver.findElement(webdriver.By.id('countries')).getText().then(function(text) {
         expect(text).to.contain('Select your country...');
      });
   });

   // Test 3
   test.it('should have a single-line search input box, size 70, with \'Type the name, abbreviation or code of your livelihood zone here\' shown in it', function() {
      searchBox = driver.findElement(webdriver.By.id('searchBox'));
      searchBox.getAttribute('placeholder').then(function(text) {
         expect(text).to.contain('Type the name, abbreviation or code of your livelihood zone here');
      });
      searchBox.getAttribute('size').then(function(value) {
         expect(value).to.equal('70');
      });
   });

   // Test 4
{'fraction_non_alphanumeric': 0.16693418940609953, 'fraction_numerical': 0.012662742999821652, 'mean_word_length': 3.310530361260569, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 5, 'https://': 0, 'lorem ipsum': 0, 'www.': 4, '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': '2173559', 'n_tokens_mistral': 1729, 'n_tokens_neox': 1645, 'n_words': 290}