<commit_before>var pages = require('./pages');
var api = require('./api-helper');

describe('Member', function() {

  var editPage = pages.member.edit,
      listPage = pages.member.list;

  it('should create a new member', function() {
    listPage.navigate();
    listPage.createButton.click();

    editPage.name.sendKeys('<PASSWORD>');
    editPage.saveButton.click();

    expect(editPage.getId()).toBeDefined();
    expect(editPage.getMessage()).toBe('Member created');
  });

  it('should update existing member', function() {
    listPage.navigate();

    // Create a new member.
    api.member.create({name: 'test member'}).then(function(id) {
      editPage.navigate(id);
    });

    editPage.name.sendKeys('_<PASSWORD>');

    editPage.saveButton.click();

    expect(editPage.getMessage()).toBe('Member updated');
  });

  it('should delete member', function() {
    listPage.navigate();
    listPage.clickOnRow(0);

    var memberCount;
    api.member.findAll().then(function(list) {
      memberCount = list.length;
      console.log('Before it was ', memberCount);
    });

    editPage.deleteButton.click();

    api.member.findAll().then(function(list) {
      console.log('Now it is', list.length);
      expect(list.length).toBe(memberCount - 1);
    });
  });
});
<commit_msg>add beforeEach to navigate before<commit_after>var pages = require('./pages');
var api = require('./api-helper');

describe('Member', function() {

  var editPage = pages.member.edit,
      listPage = pages.member.list;

  beforeEach(function() {
    listPage.navigate();
  });

  it('should create a new member', function() {
    listPage.createButton.click();

    editPage.name.sendKeys('<PASSWORD>');
    editPage.saveButton.click();

    expect(editPage.getId()).toBeDefined();
    expect(editPage.getMessage()).toBe('Member created');
  });

  it('should update existing member', function() {
    // Create a new member.
    api.member.create({name: 'test member'}).then(function(id) {
      editPage.navigate(id);
    });

    editPage.name.sendKeys('_<PASSWORD>');

    editPage.saveButton.click();

    expect(editPage.getMessage()).toBe('Member updated');
  });

  it('should delete member', function() {
    listPage.clickOnRow(0);

    var memberCount;
    api.member.findAll().then(function(list) {
      memberCount = list.length;
      console.log('Before it was ', memberCount);
    });

    editPage.deleteButton.click();

    api.member.findAll().then(function(list) {
      console.log('Now it is', list.length);
      expect(list.length).toBe(memberCount - 1);
    });
  });
});

{'fraction_non_alphanumeric': 0.17526964560862865, 'fraction_numerical': 0.0015408320493066256, 'mean_word_length': 3.5086805555555554, 'pattern_counts': {'":': 0, '<': 7, '<?xml version=': 0, '>': 7, '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': '4367671', 'n_tokens_mistral': 809, 'n_tokens_neox': 784, 'n_words': 137}