<commit_before>'use strict';

describe('Activity E2E Test', function () {
  var constants       = require('../../../testConstants.json');
  var util            = require('../../../bellows/pages/utils.js');
  var loginPage       = require('../../../bellows/pages/loginPage.js');
  var activityPage    = require('../../../bellows/pages/activityPage.js');
  var projectListPage = require('../../../bellows/pages/projectsPage.js');
  var projectPage         = require('../../sfchecks/pages/projectPage.js');
  var projectSettingsPage = require('../../sfchecks/pages/projectSettingsPage.js');
  var questionPage        = require('../../sfchecks/pages/questionPage.js');
  var textPage            = require('../../sfchecks/pages/textPage.js');

  var activityIndex = 0;
  var testData = {
    answer: {
      add: 'Beethoven was the speaker.',
      edit: 'Mozart was also the speaker.'
    },
    comment: {
      add: 'This is an original comment.',
      edit: 'This is an edited comment.'
    }
  };

  beforeEach(util.registerCustomJasmineMatchers);

  describe('Running as member: ', function () {

    it('Login and navigate to the first test Question page', function () {
      loginPage.loginAsUser();
      projectListPage.get();
      projectListPage.clickOnProject(constants.testProjectName);
      projectPage.textLink(constants.testText1Title).click();
      textPage.clickOnQuestion(constants.testText1Question1Title);
    });

    performCommonActions();

    it('Navigate to Activity Page to verify actions', function () {
      activityPage.get();

      // Print everything in the activity list for debugging purposes
      // activityPage.printActivitiesNames();
    });

    activityIndex = verifyCommonActions(activityIndex, constants.memberUsername);

    verifyFilters(constants.memberUsername);

  });

  describe('Running as second member: ', function () {

    it('Login and navigate to the first test Question page', function () {
      loginPage.loginAsSecondUser();
      projectListPage.get();
      projectListPage.clickOnProject(constants.testProjectName);
      projectPage.textLink(constants.testText1Title).click();
      textPage.clickOnQuestion(constants.testText1Question1Title);
    });

    performCommonActions();

    it('Navigate to Activity Page to verify actions', function () {
      activityPage.get();

      // Print everything in the activity list for debugging purposes
      // activityPage.printActivitiesNames();
    });

    activityIndex = verifyCommonActions(activityIndex, constants.member2Username);

    verifyFilters(constants.member2Username);

  });

  describe('Running as manager: ', function () {
    var memberCount = 0;

    it('Login and navigate to the first test Question page', function () {
      loginPage.loginAsManager();
      projectListPage.get();
      projectListPage.clickOnProject(constants.testProjectName);
      projectPage.textLink(constants.testText1Title).click();
      textPage.clickOnQuestion(constants.testText1Question1Title);
    });

    performCommonActions();

    it("Performing action 'add' on 'texts'", function () {
      // Navigate back to Project Page
      browser.navigate().back();
      browser.navigate().back();
      expect(projectPage.notice.list.count()).toBe(0);
      projectPage.addNewText(constants.testText3Title, projectPage.testData);
      projectPage.notice.waitToInclude('The text \'' + constants.testText3Title +
        '\' was added successfully');
      projectPage.notice.firstCloseButton.click();
    });

    it("Performing action 'add' on 'questions'", function () {
      browser.navigate().forward();
      expect(textPage.notice.list.count()).toBe(0);
      textPage.addNewQuestion(constants.testText1Question3Title,
        constants.testText1Question3Summary);
      textPage.notice.waitToInclude('\'' + constants.testText1Question3Summary +
        '\' was added successfully');
      textPage.notice.firstCloseButton.click();
    });

    it('Get existing user count', function () {
      // Navigate back to Project Page<commit_msg>Changed activity spec to work with typescript projectPage<commit_after>'use strict';

describe('Activity E2E Test', function () {
  var constants       = require('../../../testConstants.json');
  var util            = require('../../../bellows/pages/utils.js');
  var loginPage       = require('../../../bellows/pages/loginPage.js');
  var activityPage    = require('../../../bellows/pages/activityPage.js');
  var projectListPage = require('../../../bellows/pages/projectsPage.js');
  var projectPage         = require('../../sfchecks/pages/projectPage.js');
  var projectSettingsPage = require('../../sfchecks/pages/projectSettingsPage.js');
  var questionPage        = require('../../sfchecks/pages/questionPage.js');
  var textPage            = require('../../sfchecks/pages/textPage.js');

  var activityIndex = 0;
  var testData = {
    answer: {
      add: 'Beethoven was the speaker.',
      edit: 'Mozart was also the speaker.'
    },
    comment: {
      add: 'This is an original comment.',
      edit: 'This is an edited comment.'
    }
  };

  beforeEach(util.registerCustomJasmineMatchers);

  describe('Running as member: ', function () {

    it('Login and navigate to the first test Question page', function () {
      loginPage.loginAsUser();
      projectListPage.get();
      projectListPage.clickOnProject(constants.testProjectName);
      projectPage.textLink(constants.testText1Title).click();
      textPage.clickOnQuestion(constants.testText1Question1Title);
    });

    performCommonActions();

    it('Navigate to Activity Page to verify actions', function () {
      activityPage.get();

      // Print everything in the activity list for debugging purposes
      // activityPage.printActivitiesNames();
    });

    activityIndex = verifyCommonActions(activityIndex, constants.memberUsername);

    verifyFilters(constants.memberUsername);

  });

  describe('Running as second member: ', function () {

    it('Login and navigate to the first test Question page', function () {
      loginPage.loginAsSecondUser();
      projectListPage.get();
      projectListPage.clickOnProject(constants.testProjectName);
      projectPage.textLink(constants.testText1Title).click();
      textPage.clickOnQuestion(constants.testText1Question1Title);
    });

    performCommonActions();

    it('Navigate to Activity Page to verify actions', function () {
      activityPage.get();

      // Print everything in the activity list for debugging purposes
      // activityPage.printActivitiesNames();
    });

    activityIndex = verifyCommonActions(activityIndex, constants.member2Username);

    verifyFilters(constants.member2Username);

  });

  describe('Running as manager: ', function () {
    var memberCount = 0;

    it('Login and navigate to the first test Question page', function () {
      loginPage.loginAsManager();
      projectListPage.get();
      projectListPage.clickOnProject(constants.testProjectName);
      projectPage.textLink(constants.testText1Title).click();
      textPage.clickOnQuestion(constants.testText1Question1Title);
    });

    performCommonActions();

    it("Performing action 'add' on 'texts'", function () {
      // Navigate back to Project Page
      browser.navigate().back();
      browser.navigate().back();
      expect(projectPage.notice.list.count()).toBe(0);
      projectPage.addNewText(constants.testText3Title, projectPage.testData.simpleUsx1);
      projectPage.notice.waitToInclude('The text \'' + constants.testText3Title +
        '\' was added successfully');
      projectPage.notice.firstCloseButton.click();
    });

    it("Performing action 'add' on 'questions'", function () {
      browser.navigate().forward();
      expect(textPage.notice.list.count()).toBe(0);
      textPage.addNewQuestion(constants.testText1Question3Title,
        constants.testText1Question3Summary);
      textPage.notice.waitToInclude('\'' + constants.testText1Question3Summary +
        '\' was added successfully');
      textPage.notice.firstCloseButton.click();
    });

    it('Get existing user count', function () {
      // Navigate back to Project Page
{'fraction_non_alphanumeric': 0.13420442056417145, 'fraction_numerical': 0.005983636585663695, 'mean_word_length': 3.3082588111520255, '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': '1082362', 'n_tokens_mistral': 2195, 'n_tokens_neox': 2170, 'n_words': 452}