Sha256: 9c79169bd69067f228d4d77f964b8d227754345e272ded8a100798ec1aa1158c

Contents?: true

Size: 1.68 KB

Versions: 26

Compression:

Stored size: 1.68 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.now
    Marty::Promise.create title: "Test Job 2",
      user: other_user,
      cformat: 'csv',
      start_dt: Time.now

    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

26 entries across 26 versions & 1 rubygems

Version Path
marty-2.5.2 spec/features/jobs_dashboard_spec.rb
marty-2.5.1 spec/features/jobs_dashboard_spec.rb
marty-2.5.0 spec/features/jobs_dashboard_spec.rb
marty-2.4.9 spec/features/jobs_dashboard_spec.rb
marty-2.4.8 spec/features/jobs_dashboard_spec.rb
marty-2.4.7 spec/features/jobs_dashboard_spec.rb
marty-2.4.6 spec/features/jobs_dashboard_spec.rb
marty-2.4.5 spec/features/jobs_dashboard_spec.rb
marty-2.4.4 spec/features/jobs_dashboard_spec.rb
marty-2.4.3 spec/features/jobs_dashboard_spec.rb
marty-2.4.2 spec/features/jobs_dashboard_spec.rb
marty-2.4.1 spec/features/jobs_dashboard_spec.rb
marty-2.4.0 spec/features/jobs_dashboard_spec.rb
marty-2.3.15 spec/features/jobs_dashboard_spec.rb
marty-2.3.14 spec/features/jobs_dashboard_spec.rb
marty-2.3.13 spec/features/jobs_dashboard_spec.rb
marty-2.3.12 spec/features/jobs_dashboard_spec.rb
marty-2.3.11 spec/features/jobs_dashboard_spec.rb
marty-2.3.10 spec/features/jobs_dashboard_spec.rb
marty-2.3.9 spec/features/jobs_dashboard_spec.rb