Class: DocTestSiteFileListEntry

Inherits:
Object
  • Object
show all
Defined in:
lib/onlyoffice_documentserver_testing_framework/test_instance_docs/doc_test_site_functions/doc_test_file_list/doc_test_site_file_list_entry.rb

Overview

Class for single entry of file in doc test site

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(instance, xpath, edit_modes_indexes) ⇒ DocTestSiteFileListEntry

Returns a new instance of DocTestSiteFileListEntry.



21
22
23
24
25
26
27
28
29
30
31
# File 'lib/onlyoffice_documentserver_testing_framework/test_instance_docs/doc_test_site_functions/doc_test_file_list/doc_test_site_file_list_entry.rb', line 21

def initialize(instance, xpath, edit_modes_indexes)
  @instance = instance
  @xpath_line = xpath
  @edit_modes_indexes = edit_modes_indexes
  @file_name = fetch_file_name
  @embedded_url = fetch_embedded_url
  @review_mode_url = fetch_review_mode_url
  @comment_mode_url = fetch_comment_mode_url
  @fill_forms_mode_url = fetch_fill_forms_mode_url
  @view_mode_url = fetch_view_mode_url
end

Instance Attribute Details

#comment_mode_urlString

Returns Comment mode url.

Returns:

  • (String)

    Comment mode url



13
14
15
# File 'lib/onlyoffice_documentserver_testing_framework/test_instance_docs/doc_test_site_functions/doc_test_file_list/doc_test_site_file_list_entry.rb', line 13

def comment_mode_url
  @comment_mode_url
end

#embedded_urlString

Returns url of embedded mode.

Returns:

  • (String)

    url of embedded mode



9
10
11
# File 'lib/onlyoffice_documentserver_testing_framework/test_instance_docs/doc_test_site_functions/doc_test_file_list/doc_test_site_file_list_entry.rb', line 9

def embedded_url
  @embedded_url
end

#file_nameString

Returns name of file.

Returns:

  • (String)

    name of file



7
8
9
# File 'lib/onlyoffice_documentserver_testing_framework/test_instance_docs/doc_test_site_functions/doc_test_file_list/doc_test_site_file_list_entry.rb', line 7

def file_name
  @file_name
end

#fill_forms_mode_urlString (readonly)

Returns Fill forms mode url.

Returns:

  • (String)

    Fill forms mode url



15
16
17
# File 'lib/onlyoffice_documentserver_testing_framework/test_instance_docs/doc_test_site_functions/doc_test_file_list/doc_test_site_file_list_entry.rb', line 15

def fill_forms_mode_url
  @fill_forms_mode_url
end

#only_fill_forms_mode_urlString (readonly)

Returns Only fill forms mode url.

Returns:

  • (String)

    Only fill forms mode url



17
18
19
# File 'lib/onlyoffice_documentserver_testing_framework/test_instance_docs/doc_test_site_functions/doc_test_file_list/doc_test_site_file_list_entry.rb', line 17

def only_fill_forms_mode_url
  @only_fill_forms_mode_url
end

#review_mode_urlString

Returns Review mode url.

Returns:

  • (String)

    Review mode url



11
12
13
# File 'lib/onlyoffice_documentserver_testing_framework/test_instance_docs/doc_test_site_functions/doc_test_file_list/doc_test_site_file_list_entry.rb', line 11

def review_mode_url
  @review_mode_url
end

#view_mode_urlString

Returns View mode url.

Returns:

  • (String)

    View mode url



19
20
21
# File 'lib/onlyoffice_documentserver_testing_framework/test_instance_docs/doc_test_site_functions/doc_test_file_list/doc_test_site_file_list_entry.rb', line 19

def view_mode_url
  @view_mode_url
end

Instance Method Details

#==(other) ⇒ True, False

Compare two DocTestSiteFileListEntry

Returns:

  • (True, False)

    is entries are the same



35
36
37
# File 'lib/onlyoffice_documentserver_testing_framework/test_instance_docs/doc_test_site_functions/doc_test_file_list/doc_test_site_file_list_entry.rb', line 35

def ==(other)
  @file_name == other.file_name
end

#editors_modes_empty?True, False

Returns if editors modes are empty.

Returns:

  • (True, False)

    if editors modes are empty



115
116
117
118
119
# File 'lib/onlyoffice_documentserver_testing_framework/test_instance_docs/doc_test_site_functions/doc_test_file_list/doc_test_site_file_list_entry.rb', line 115

def editors_modes_empty?
  empty = @instance.selenium.get_attribute("#{@xpath_line}/td[2]", 'class').include?('contentCellsEmpty')
  OnlyofficeLoggerHelper.log("Editors modes empty?: #{empty}")
  empty
end

#fetch_comment_mode_urlString

Returns url on review mode.

Returns:

  • (String)

    url on review mode



59
60
61
62
63
64
65
66
67
68
# File 'lib/onlyoffice_documentserver_testing_framework/test_instance_docs/doc_test_site_functions/doc_test_file_list/doc_test_site_file_list_entry.rb', line 59

def fetch_comment_mode_url
  return nil if editors_modes_empty?

  xpath_comment = "#{@xpath_line}/td[#{@edit_modes_indexes[:comment_mode]}]/a"
  return nil unless @instance.selenium.element_present?(xpath_comment)

  url = @instance.selenium.get_attribute(xpath_comment, 'href')
  OnlyofficeLoggerHelper.log("Got comment mode #{@xpath_line} url: #{url}")
  url
end

#fetch_embedded_urlString

Returns url on embedded file.

Returns:

  • (String)

    url on embedded file



105
106
107
108
109
110
111
112
# File 'lib/onlyoffice_documentserver_testing_framework/test_instance_docs/doc_test_site_functions/doc_test_file_list/doc_test_site_file_list_entry.rb', line 105

def fetch_embedded_url
  xpath_embedded = "#{@xpath_line}/td[#{@edit_modes_indexes[:embedded]}]/a"
  return nil unless @instance.selenium.element_present?(xpath_embedded)

  url = @instance.selenium.get_attribute(xpath_embedded, 'href')
  OnlyofficeLoggerHelper.log("Got embedded #{@xpath_line} url: #{url}")
  url
end

#fetch_file_nameString

Returns name of file.

Returns:

  • (String)

    name of file



40
41
42
43
44
# File 'lib/onlyoffice_documentserver_testing_framework/test_instance_docs/doc_test_site_functions/doc_test_file_list/doc_test_site_file_list_entry.rb', line 40

def fetch_file_name
  text = @instance.selenium.get_text("#{@xpath_line}/td/a[1]/span")
  OnlyofficeLoggerHelper.log("Got filename #{@xpath_line} name: #{text}")
  text
end

#fetch_fill_forms_mode_urlString

Returns url on fill forms mode.

Returns:

  • (String)

    url on fill forms mode



71
72
73
74
75
76
77
78
79
80
# File 'lib/onlyoffice_documentserver_testing_framework/test_instance_docs/doc_test_site_functions/doc_test_file_list/doc_test_site_file_list_entry.rb', line 71

def fetch_fill_forms_mode_url
  return nil if editors_modes_empty?

  xpath_comment = "#{@xpath_line}/td[#{@edit_modes_indexes[:fill_forms]}]/a"
  return nil unless @instance.selenium.element_present?(xpath_comment)

  url = @instance.selenium.get_attribute(xpath_comment, 'href')
  OnlyofficeLoggerHelper.log("Got fill forms mode #{@xpath_line} url: #{url}")
  url
end

#fetch_only_fill_forms_mode_urlString

Returns url on fill forms mode.

Returns:

  • (String)

    url on fill forms mode



83
84
85
86
87
88
89
90
91
92
# File 'lib/onlyoffice_documentserver_testing_framework/test_instance_docs/doc_test_site_functions/doc_test_file_list/doc_test_site_file_list_entry.rb', line 83

def fetch_only_fill_forms_mode_url
  return nil if editors_modes_empty?

  link_xpath = "#{@xpath_line}/td[#{@edit_modes_indexes[:only_fill_forms]}]/a"
  return nil unless @instance.selenium.element_present?(link_xpath)

  url = @instance.selenium.get_attribute(link_xpath, 'href')
  OnlyofficeLoggerHelper.log("Got only fill forms mode #{@xpath_line} url: #{url}")
  url
end

#fetch_review_mode_urlString

Returns url on review mode.

Returns:

  • (String)

    url on review mode



47
48
49
50
51
52
53
54
55
56
# File 'lib/onlyoffice_documentserver_testing_framework/test_instance_docs/doc_test_site_functions/doc_test_file_list/doc_test_site_file_list_entry.rb', line 47

def fetch_review_mode_url
  return nil if editors_modes_empty?

  xpath_review = "#{@xpath_line}/td[#{@edit_modes_indexes[:review_mode]}]/a"
  return nil unless @instance.selenium.element_present?(xpath_review)

  url = @instance.selenium.get_attribute(xpath_review, 'href')
  OnlyofficeLoggerHelper.log("Got review mode #{@xpath_line} url: #{url}")
  url
end

#fetch_view_mode_urlString

Returns url on viewer mode.

Returns:

  • (String)

    url on viewer mode



95
96
97
98
99
100
101
102
# File 'lib/onlyoffice_documentserver_testing_framework/test_instance_docs/doc_test_site_functions/doc_test_file_list/doc_test_site_file_list_entry.rb', line 95

def fetch_view_mode_url
  xpath_comments = "#{@xpath_line}/td[#{@edit_modes_indexes[:view_mode]}]/a"
  return nil unless @instance.selenium.element_present?(xpath_comments)

  url = @instance.selenium.get_attribute(xpath_comments, 'href')
  OnlyofficeLoggerHelper.log("Got view mode #{@xpath_line} url: #{url}")
  url
end