<commit_before>var chai = require('chai');
var chaiAsPromised = require('chai-as-promised');
chai.use(chaiAsPromised);

var expect = chai.expect;

//Necessary for uploading a file
var path = require('path');

//Defining page elements
var pageErrors = element.all(by.css(".page-errors"));
var submitButton = element(by.css(".form-buttons button"));
var fileSelector = element(by.id('file'));

module.exports = function() {

    this.When(/^I upload the "([^"]*)" file for validation$/, function (fileName, next) {
        //Get filename as argument, convert into path, send path to selector on site.
        var fileToUpload = '../files/'+fileName;
        var absolutePath = path.resolve(__dirname, fileToUpload);

        fileSelector.sendKeys(absolutePath).then(function(){
            next();
        });
    });

    this.When(/^I click the submit button$/, function (next) {
        submitButton.click().then(function(){
            next();
        });
    });

    this.Then(/^I am notified that the format is incorrect$/, function (next) {
        expect(pageErrors.count()).to.eventually.equal(1).then(function(){
            next();
        });
    });

    this.Then(/^I am not notified that the format is incorrect$/, function (next) {
        next();
    });
};<commit_msg>Added step to check that there are no errors after a good file is uploaded<commit_after>var chai = require('chai');
var chaiAsPromised = require('chai-as-promised');
chai.use(chaiAsPromised);

var expect = chai.expect;

//Necessary for uploading a file
var path = require('path');

//Defining page elements
var pageErrors = element.all(by.css(".page-errors"));
var submitButton = element(by.css(".form-buttons button"));
var fileSelector = element(by.id('file'));

module.exports = function() {

    this.When(/^I upload the "([^"]*)" file for validation$/, function (fileName, next) {
        //Get filename as argument, convert into path, send path to selector on site.
        var fileToUpload = '../files/'+fileName;
        var absolutePath = path.resolve(__dirname, fileToUpload);

        fileSelector.sendKeys(absolutePath).then(function(){
            next();
        });
    });

    this.When(/^I click the submit button$/, function (next) {
        submitButton.click().then(function(){
            next();
        });
    });

    this.Then(/^I am notified that the format is incorrect$/, function (next) {
        expect(pageErrors.count()).to.eventually.equal(1).then(function(){
            next();
        });
    });

    this.Then(/^I am not notified that the format is incorrect$/, function (next) {
        expect(pageErrors.count()).to.eventually.equal(0).then(function(){
            next();
        });
    });
};
{'fraction_non_alphanumeric': 0.15870683321087437, 'fraction_numerical': 0.0011021307861866275, 'mean_word_length': 2.957848837209302, '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': '3952072', 'n_tokens_mistral': 787, 'n_tokens_neox': 769, 'n_words': 209}