Sha256: 39756a9b88b98c5fe0324477e41ab5fe4feb68b919223fa090c69b4c67275373

Contents?: true

Size: 1.82 KB

Versions: 11

Compression:

Stored size: 1.82 KB

Contents

require 'spec_helper'

describe 'Jobs Dashboard', type: :feature, js: true, capybara: true do
  it 'filters out usernames other than the one specified in the search box' do
    other_user = Marty::User.create(login: 'other',
                                    firstname: 'other',
                                    lastname: 'other',
                                    active: true)
    Marty::Promise.create!(
      title: 'Test Job 1',
      user: Marty::User.find_by(login: 'marty'),
      cformat: 'csv',
      start_dt: Time.zone.now,
      promise_type: 'delorean'
    )
    Marty::Promise.create!(
      title: 'Test Job 2',
      user: other_user,
      cformat: 'csv',
      start_dt: Time.zone.now,
      promise_type: 'delorean'
    )

    visit '/'
    all 'span', text: 'Sign in', minimum: 1
    find(ext_button_id('Sign in')).click
    fill_in 'Login', with: 'marty'
    fill_in 'Password', with: 'marty'
    find(:xpath, '//a[contains(., "OK")]').click
    expect(page).to have_content('marty marty')

    find(ext_button_id('Applications')).click
    find(ext_menuitem_id('Jobs Dashboard')).click
    page_title = I18n.t('jobs.promise_view')
    expect(page).to have_content(page_title)

    sleep 1

    expect(tree_row_count(page_title)).to eq(2)

    fill_in 'live_search_text', with: 'marty'
    sleep 1
    expect(tree_row_count(page_title)).to eq(1)
  end

  def ext_button_id title
    id = page.evaluate_script(
      "Ext.ComponentQuery.query(\"button{isVisible(true)}[text='#{title}']\")[0].id"
    )
    "##{id}"
  end

  def ext_menuitem_id title
    id = page.evaluate_script(
      "Ext.ComponentQuery.query(\"menuitem[text='#{title}']\")[0].id"
    )
    "##{id}"
  end

  def tree_row_count name
    page.evaluate_script(
      "Ext.ComponentQuery.query('treepanel[title=\"#{name}\"]')[0].getStore().getCount()"
    )
  end
end

Version data entries

11 entries across 11 versions & 1 rubygems

Version Path
marty-14.3.0 spec/features/jobs_dashboard_spec.rb
marty-14.0.0 spec/features/jobs_dashboard_spec.rb
marty-13.0.2 spec/features/jobs_dashboard_spec.rb
marty-11.0.0 spec/features/jobs_dashboard_spec.rb
marty-10.0.3 spec/features/jobs_dashboard_spec.rb
marty-10.0.2 spec/features/jobs_dashboard_spec.rb
marty-10.0.0 spec/features/jobs_dashboard_spec.rb
marty-9.5.1 spec/features/jobs_dashboard_spec.rb
marty-9.5.0 spec/features/jobs_dashboard_spec.rb
marty-9.3.3 spec/features/jobs_dashboard_spec.rb
marty-9.3.2 spec/features/jobs_dashboard_spec.rb