<commit_before>const expect = require('chai').expect

const caseProgressDataHelper = require('../helpers/data/aggregated-data-helper')

var workloadOwnerIds = []
var workloadOwnerDefaultUrl
var teamDefaultUrl
var lduDefaultUrl
var regionDefaultUrl
var nationalDefaultUrl

describe('View caseload progress flow', () => {
  before(function () {
    return caseProgressDataHelper.selectIdsForWorkloadOwner()
      .then(function (results) {
        workloadOwnerIds = results
        workloadOwnerDefaultUrl = '/offender-manager/' + workloadOwnerIds.filter((item) => item.table === 'workload_owner')[0].id
        teamDefaultUrl = '/team/' + workloadOwnerIds.filter((item) => item.table === 'team')[0].id
        lduDefaultUrl = '/ldu/' + workloadOwnerIds.filter((item) => item.table === 'ldu')[0].id
        regionDefaultUrl = '/region/' + workloadOwnerIds.filter((item) => item.table === 'region')[0].id
        nationalDefaultUrl = '/hmpps/0'
      })
  })

  it('should navigate to the workload owner caseload progress screen', () => {
    return browser.url(workloadOwnerDefaultUrl + '/caseload-capacity')
      .waitForExist('.breadcrumbs')
      .waitForExist('.sln-subnav')
      // Check the href for case progress using the id exists
      .click('[href="' + workloadOwnerDefaultUrl + '/case-progress"]')
      .waitForExist('.js-plotly-plot')
      .waitForExist('.sln-page-subtitle')
      .getText('.sln-page-subtitle')
      .then(function (text) {
        expect(text).to.equal('Offender Manager')
      })
  })

  it('should navigate to the team caseload progress screen', () => {
    return browser.url(teamDefaultUrl + '/case-progress')
      .waitForExist('.breadcrumbs')
      .waitForExist('.sln-subnav')
      .waitForExist('[href="' + teamDefaultUrl + '/caseload-capacity"]')
      .waitForExist('[href="' + teamDefaultUrl + '/case-progress"]')
      .waitForExist('.js-plotly-plot')
      .getText('.sln-page-subtitle')
      .then(function (text) {
        expect(text).to.equal('Team')
      })
  })

  it('should navigate to the ldu caseload progress screen', () => {
    return browser.url(lduDefaultUrl+ '/case-progress')
      .waitForExist('.breadcrumbs')
      .waitForExist('.sln-subnav')
      .waitForExist('[href="' + lduDefaultUrl + '/caseload-capacity"]')
      .waitForExist('[href="' + lduDefaultUrl + '/case-progress"]')
      .waitForExist('.js-plotly-plot')
      .getText('.sln-page-subtitle')
      .then(function (text) {
        expect(text).to.equal('LDU Cluster')
      })
  })

  it('should navigate to the region caseload progress screen', () => {
    return browser.url(regionDefaultUrl + '/case-progress')
      .waitForExist('.breadcrumbs')<commit_msg>871: Fix standard errors<commit_after>const expect = require('chai').expect

const caseProgressDataHelper = require('../helpers/data/aggregated-data-helper')

var workloadOwnerIds = []
var workloadOwnerDefaultUrl
var teamDefaultUrl
var lduDefaultUrl
var regionDefaultUrl
var nationalDefaultUrl

describe('View caseload progress flow', () => {
  before(function () {
    return caseProgressDataHelper.selectIdsForWorkloadOwner()
      .then(function (results) {
        workloadOwnerIds = results
        workloadOwnerDefaultUrl = '/offender-manager/' + workloadOwnerIds.filter((item) => item.table === 'workload_owner')[0].id
        teamDefaultUrl = '/team/' + workloadOwnerIds.filter((item) => item.table === 'team')[0].id
        lduDefaultUrl = '/ldu/' + workloadOwnerIds.filter((item) => item.table === 'ldu')[0].id
        regionDefaultUrl = '/region/' + workloadOwnerIds.filter((item) => item.table === 'region')[0].id
        nationalDefaultUrl = '/hmpps/0'
      })
  })

  it('should navigate to the workload owner caseload progress screen', () => {
    return browser.url(workloadOwnerDefaultUrl + '/caseload-capacity')
      .waitForExist('.breadcrumbs')
      .waitForExist('.sln-subnav')
      // Check the href for case progress using the id exists
      .click('[href="' + workloadOwnerDefaultUrl + '/case-progress"]')
      .waitForExist('.js-plotly-plot')
      .waitForExist('.sln-page-subtitle')
      .getText('.sln-page-subtitle')
      .then(function (text) {
        expect(text).to.equal('Offender Manager')
      })
  })

  it('should navigate to the team caseload progress screen', () => {
    return browser.url(teamDefaultUrl + '/case-progress')
      .waitForExist('.breadcrumbs')
      .waitForExist('.sln-subnav')
      .waitForExist('[href="' + teamDefaultUrl + '/caseload-capacity"]')
      .waitForExist('[href="' + teamDefaultUrl + '/case-progress"]')
      .waitForExist('.js-plotly-plot')
      .getText('.sln-page-subtitle')
      .then(function (text) {
        expect(text).to.equal('Team')
      })
  })

  it('should navigate to the ldu caseload progress screen', () => {
    return browser.url(lduDefaultUrl + '/case-progress')
      .waitForExist('.breadcrumbs')
      .waitForExist('.sln-subnav')
      .waitForExist('[href="' + lduDefaultUrl + '/caseload-capacity"]')
      .waitForExist('[href="' + lduDefaultUrl + '/case-progress"]')
      .waitForExist('.js-plotly-plot')
      .getText('.sln-page-subtitle')
      .then(function (text) {
        expect(text).to.equal('LDU Cluster')
      })
  })

  it('should navigate to the region caseload progress screen', () => {
    return browser.url(regionDefaultUrl + '/case-progress')
      .waitForExist('.breadcrumbs')
{'fraction_non_alphanumeric': 0.16482096714654854, 'fraction_numerical': 0.002399409376153562, 'mean_word_length': 3.4164629176854118, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 21, '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': '4313662', 'n_tokens_mistral': 1699, 'n_tokens_neox': 1664, 'n_words': 294}