Top Level Namespace

Defined Under Namespace

Modules: PageObject, TNR360 Classes: LdsAction, LdsArea, LdsBlock, LdsBlockInSummaryView, LdsCheckbox, LdsColumn, LdsFKey, LdsGrid, LdsLov, LdsMenu, LdsRadio, LdsScreen, LdsSummaryView, LdsTextField, LdsVue360, ServerUtils, String

Instance Method Summary collapse

Instance Method Details

#bool_no_null(obj) ⇒ Object

method to replace nil with false string



14
15
16
# File 'lib/TNR360/TnrUtilsGeneric.rb', line 14

def bool_no_null obj
  ((obj==nil) ? 'false' : obj)
end

#browser(version) ⇒ Object



8
9
10
11
12
13
# File 'lib/TNR360/TnrUtils.rb', line 8

def browser(version)
  # :chrome, :ie, or :ff
  @browser ||= Watir::Browser.new(version)
  @browser.driver.manage.timeouts.implicit_wait=3
  @browser
end

#click(browser) ⇒ Object



44
45
46
47
48
# File 'lib/TNR360/TnrUtilsInes.rb', line 44

def click
  #@@browser.
  #$browser.div(:class => "fwk-result-contractIe").when_present.double_click
  @browser.button(:text => "Search").when_present.click
end

#custom_double_click(brwser, elmnt) ⇒ Object



18
19
20
21
22
23
24
# File 'lib/TNR360/TnrUtilsGeneric.rb', line 18

def custom_double_click brwser,elmnt
  if (brwser.driver.browser.to_s =='firefox')
    elmnt.when_present.fire_event("ondblclick")
  else
    elmnt.when_present.double_click
  end
end

#doubleClick(browser) ⇒ Object



39
40
41
42
# File 'lib/TNR360/TnrUtilsInes.rb', line 39

def doubleClick
  #@@browser.
  @browser.div(:class => "fwk-result-managementCompany").when_present.double_click
end

#findParentWithClass(parent_class_name, current_element) ⇒ Object

find a parent class with a class containing expression



27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
# File 'lib/TNR360/TnrUtilsGeneric.rb', line 27

def findParentWithClass parent_class_name,current_element
  found=false
  element=nil
  previousElement=nil
  while (!found)
    if (element==nil)
      tempElement= element=previousElement=current_element.parent
    else
      previousElement=element
      tempElement=element.parent
    end

    if (tempElement.class_name.include? parent_class_name)
      found=true
    end
    element=tempElement
  end
  return element, previousElement
end

#findParentWithId(parent_idElement, current_element) ⇒ Object

find a parent class with a id containing expression



49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
# File 'lib/TNR360/TnrUtilsGeneric.rb', line 49

def findParentWithId parent_idElement,current_element
  found=false
  element=nil
  previousElement=nil
  while (!found)
    if (element==nil)
      tempElement= element=previousElement=current_element.parent
    else
      previousElement=element
      tempElement=element.parent
    end

    if (tempElement.id.include? parent_idElement)
      found=true
    end
    element=tempElement
  end
  return element, previousElement
end

#force_find_element(block) ⇒ Object



69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
# File 'lib/TNR360/TnrUtilsGeneric.rb', line 69

def force_find_element  block
  found_element=false
  retries_left = 3
  begin
    found_element= block.call
  rescue Timeout::Error
    puts("Caught a TIMEOUT ERROR!")

    # You may want to wait for a while before retrying.
    sleep(3)

    # Retry the code that generates the exception.
    retries_left -= 1
    retry if retries_left > 0

    # No more retries left - time to bail out! Re-raise the exception.
    raise
  end
  found_element
end

#goToAssetSearchObject



31
32
33
34
# File 'lib/TNR360/TnrUtils.rb', line 31

def goToAssetSearch
  @browser.button(:text , "Asset search".split('/').take(1).first).when_present.click
  @browser.button(:value,"Search").when_present.click#
end

#goToContractElementsExpiringSearchObject



46
47
48
49
# File 'lib/TNR360/TnrUtils.rb', line 46

def goToContractElementsExpiringSearch
  @browser.a(:text => "Parties and Contracts").when_present(60).click
  @browser.button(:value,"Contract elements expiring search").when_present.click
end

#goToContractPopulationObject



51
52
53
54
55
# File 'lib/TNR360/TnrUtils.rb', line 51

def goToContractPopulation
  @browser.a(:text => "Fleet management").when_present(60).click
  @browser.button(:value,"Contract population search").when_present.click
  @browser.button(:value, "Search").when_present.click#
end

#goToDas2Closure(browser) ⇒ Object



25
26
27
28
29
# File 'lib/TNR360/TnrUtils.rb', line 25

def goToDas2Closure
  @browser.a(:text => "Interfaces").when_present(60).click
  @browser.button(:value,"DAS2").when_present.click
  @browser.link(:text, "New DAS2 closure").when_present.click
end

#goToInvoiceSearch(browser) ⇒ Object



32
33
34
35
36
37
# File 'lib/TNR360/TnrUtilsInes.rb', line 32

def goToInvoiceSearch

  @browser.a(:text => "Main").when_present(60).click#TODO:groupe menu /root title
  @browser.link(:value,"Invoice search").when_present.click#TODO:liste menu

end

#goToPartyContractSearch(browser) ⇒ Object



36
37
38
39
# File 'lib/TNR360/TnrUtils.rb', line 36

def goToPartyContractSearch
  @browser.button(:text , "Party contract search".split('/').take(1).first).when_present.click
  @browser.button(:value, "Search").when_present.click#
end

#goToPaymentSearchObject



41
42
43
44
# File 'lib/TNR360/TnrUtils.rb', line 41

def goToPaymentSearch
  @browser.button(:text , "Payment search".split('/').take(1).first).when_present.click
  @browser.button(:value, "Search").when_present.click#
end

#goToWeeksAndMonthsConfigurationObject



57
58
59
60
61
# File 'lib/TNR360/TnrUtils.rb', line 57

def goToWeeksAndMonthsConfiguration
  @browser.a(:text => "Setup").when_present(60).click
  @browser.table(:id,"x-auto-165").button(:class,"x-btn-text").click
  @browser.link(:text, "Configuration of week's days and year's months").when_present.click
end

#login(url, username, password) ⇒ Object



14
15
16
17
18
19
20
21
22
23
# File 'lib/TNR360/TnrUtils.rb', line 14

def (url,username, password)


  @browser.goto url
  @browser.driver.manage.window.maximize

  @browser.text_field(:name => "j_username").when_present.set(username)
  @browser.text_field(:name => "j_password").when_present.set(password )
  @browser.button(:value, "Connection").when_present.click
end

#no_null(obj) ⇒ Object

method to replace nil with an empty string



9
10
11
# File 'lib/TNR360/TnrUtilsGeneric.rb', line 9

def no_null obj
  ((obj==nil) ? '' : obj)
end