codemie-test-harness 0.1.177__py3-none-any.whl → 0.1.178__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Potentially problematic release.
This version of codemie-test-harness might be problematic. Click here for more details.
- codemie_test_harness/tests/test_data/google_datasource_test_data.py +4 -1
- codemie_test_harness/tests/ui/_test_data/datasource_test_data.py +125 -0
- codemie_test_harness/tests/ui/datasource/__init__.py +0 -0
- codemie_test_harness/tests/ui/datasource/test_create_datasource.py +188 -0
- codemie_test_harness/tests/ui/datasource/test_datasource_page.py +61 -0
- codemie_test_harness/tests/ui/datasource/test_edit_datasource.py +180 -0
- codemie_test_harness/tests/ui/datasource/test_view_datasource.py +220 -0
- codemie_test_harness/tests/ui/pageobject/assistants/assistants_page.py +1 -1
- codemie_test_harness/tests/ui/pageobject/base_page.py +31 -5
- codemie_test_harness/tests/ui/pageobject/components/project_selector.py +116 -0
- codemie_test_harness/tests/ui/pageobject/components/workflow_sidebar.py +1 -1
- codemie_test_harness/tests/ui/pageobject/datasources/__init__.py +0 -0
- codemie_test_harness/tests/ui/pageobject/datasources/create_edit_datasource_page.py +771 -0
- codemie_test_harness/tests/ui/pageobject/datasources/datasource_page.py +233 -0
- codemie_test_harness/tests/ui/pageobject/datasources/datasource_sidebar.py +303 -0
- codemie_test_harness/tests/ui/pageobject/datasources/view_datasource_page.py +335 -0
- codemie_test_harness/tests/utils/datasource_utils.py +13 -18
- {codemie_test_harness-0.1.177.dist-info → codemie_test_harness-0.1.178.dist-info}/METADATA +2 -2
- {codemie_test_harness-0.1.177.dist-info → codemie_test_harness-0.1.178.dist-info}/RECORD +21 -10
- codemie_test_harness/tests/ui/pytest.ini +0 -18
- {codemie_test_harness-0.1.177.dist-info → codemie_test_harness-0.1.178.dist-info}/WHEEL +0 -0
- {codemie_test_harness-0.1.177.dist-info → codemie_test_harness-0.1.178.dist-info}/entry_points.txt +0 -0
|
@@ -0,0 +1,771 @@
|
|
|
1
|
+
from typing import Optional
|
|
2
|
+
|
|
3
|
+
from codemie_test_harness.tests.ui.pageobject.base_page import BasePage
|
|
4
|
+
from playwright.sync_api import expect
|
|
5
|
+
from reportportal_client import step
|
|
6
|
+
from tests.test_data.google_datasource_test_data import GOOGLE_DOC_URL, GOOGLE_GUIDE_URL
|
|
7
|
+
from tests.ui._test_data.datasource_test_data import (
|
|
8
|
+
DataSourceType,
|
|
9
|
+
SUMMARIZATION_METHODS_LIST,
|
|
10
|
+
EMBEDDING_MODELS_LIST,
|
|
11
|
+
DATA_SOURCE_TYPES_LIST,
|
|
12
|
+
FILE_INSTRUCTIONS,
|
|
13
|
+
GOOGLE_INSTRUCTIONS,
|
|
14
|
+
GOOGLE_EXAMPLE,
|
|
15
|
+
EMPTY_NAME_ERROR,
|
|
16
|
+
EMPTY_DESCRIPTION_ERROR,
|
|
17
|
+
EMPTY_REPO_LINK_ERROR,
|
|
18
|
+
EMPTY_BRANCH_ERROR,
|
|
19
|
+
EMPTY_CQL_ERROR,
|
|
20
|
+
EMPTY_JQL_ERROR,
|
|
21
|
+
EMPTY_FILE_ERROR,
|
|
22
|
+
EMPTY_GOOGLE_LINK_ERROR,
|
|
23
|
+
)
|
|
24
|
+
from tests.ui.pageobject.components.project_selector import ProjectSelector
|
|
25
|
+
from tests.ui.pageobject.datasources.datasource_sidebar import DataSourceSidebar
|
|
26
|
+
from tests.utils.base_utils import get_random_name
|
|
27
|
+
|
|
28
|
+
|
|
29
|
+
class CreateEditDatasourcePage(BasePage):
|
|
30
|
+
"""Create Data Source page object with property-based element locators."""
|
|
31
|
+
|
|
32
|
+
page_url = "/#/data-sources/create"
|
|
33
|
+
|
|
34
|
+
def __init__(self, page):
|
|
35
|
+
super().__init__(page)
|
|
36
|
+
self.sidebar = DataSourceSidebar(page)
|
|
37
|
+
self.selector = ProjectSelector(page)
|
|
38
|
+
|
|
39
|
+
# -----------------
|
|
40
|
+
# Page Elements
|
|
41
|
+
# -----------------
|
|
42
|
+
|
|
43
|
+
@property
|
|
44
|
+
def back_button(self):
|
|
45
|
+
return self.page.locator("button svg").nth(0).locator("xpath=..")
|
|
46
|
+
|
|
47
|
+
@property
|
|
48
|
+
def save_reindex_button(self):
|
|
49
|
+
return self.page.locator("button:has-text('Save & Reindex')")
|
|
50
|
+
|
|
51
|
+
@property
|
|
52
|
+
def shared_with_project_switch(self):
|
|
53
|
+
return self.page.locator("input#projectSpaceVisible + span")
|
|
54
|
+
|
|
55
|
+
@property
|
|
56
|
+
def name_input(self):
|
|
57
|
+
return self.page.locator("input#name")
|
|
58
|
+
|
|
59
|
+
@property
|
|
60
|
+
def disabled_name_input(self):
|
|
61
|
+
return self.page.locator("input#name[disabled]")
|
|
62
|
+
|
|
63
|
+
@property
|
|
64
|
+
def error_name_input(self):
|
|
65
|
+
return self.page.locator('label:has(input[name="name"]) .input-error-message')
|
|
66
|
+
|
|
67
|
+
@property
|
|
68
|
+
def description_input(self):
|
|
69
|
+
return self.page.locator("textarea#description")
|
|
70
|
+
|
|
71
|
+
@property
|
|
72
|
+
def error_description_input(self):
|
|
73
|
+
return self.description_input.locator(" + div")
|
|
74
|
+
|
|
75
|
+
@property
|
|
76
|
+
def datasource_type_selector(self):
|
|
77
|
+
return self.page.locator('span#indexType input[type="text"]')
|
|
78
|
+
|
|
79
|
+
@property
|
|
80
|
+
def datasource_type_dropdown(self):
|
|
81
|
+
return self.page.locator("span#indexType button")
|
|
82
|
+
|
|
83
|
+
@property
|
|
84
|
+
def integration_input(self):
|
|
85
|
+
return self.page.locator('span.p-autocomplete[id^="pr_id_"]')
|
|
86
|
+
|
|
87
|
+
@property
|
|
88
|
+
def add_integration_button(self):
|
|
89
|
+
return self.page.locator('button:has-text("Add User Integration")')
|
|
90
|
+
|
|
91
|
+
@property
|
|
92
|
+
def integration_dropdown(self):
|
|
93
|
+
return self.integration_input.locator("button")
|
|
94
|
+
|
|
95
|
+
def dropdown_values(self, value: str):
|
|
96
|
+
return self.page.locator(f'li:has-text("{value}")')
|
|
97
|
+
|
|
98
|
+
# -------------------------------
|
|
99
|
+
# Navigation methods
|
|
100
|
+
# -------------------------------
|
|
101
|
+
@step
|
|
102
|
+
def navigate_to(self):
|
|
103
|
+
"""
|
|
104
|
+
Navigate to the Create DataSource page.
|
|
105
|
+
|
|
106
|
+
Returns:
|
|
107
|
+
self: Returns the page object for method chaining
|
|
108
|
+
"""
|
|
109
|
+
self.page.goto(self.page_url)
|
|
110
|
+
self.wait_for_page_load()
|
|
111
|
+
|
|
112
|
+
return self
|
|
113
|
+
|
|
114
|
+
# -------------------------------
|
|
115
|
+
# Git DataSource Type Elements
|
|
116
|
+
# -------------------------------
|
|
117
|
+
|
|
118
|
+
@property
|
|
119
|
+
def summarization_method_input(self):
|
|
120
|
+
return self.page.locator('span#repoIndexType input[type="text"]')
|
|
121
|
+
|
|
122
|
+
@property
|
|
123
|
+
def summarization_method_dropdown(self):
|
|
124
|
+
return self.page.locator("span#repoIndexType button")
|
|
125
|
+
|
|
126
|
+
@property
|
|
127
|
+
def repo_link_input(self):
|
|
128
|
+
return self.page.locator("input#repoLink")
|
|
129
|
+
|
|
130
|
+
@property
|
|
131
|
+
def error_repo_link_input(self):
|
|
132
|
+
return self.page.locator(
|
|
133
|
+
'label:has(input[name="repoLink"]) .input-error-message'
|
|
134
|
+
)
|
|
135
|
+
|
|
136
|
+
@property
|
|
137
|
+
def branch_input(self):
|
|
138
|
+
return self.page.locator("input#repoBranch")
|
|
139
|
+
|
|
140
|
+
@property
|
|
141
|
+
def error_branch_input(self):
|
|
142
|
+
return self.page.locator('label:has(input[name="branch"]) .input-error-message')
|
|
143
|
+
|
|
144
|
+
@property
|
|
145
|
+
def files_filter_input(self):
|
|
146
|
+
return self.page.locator("textarea#filesFilter")
|
|
147
|
+
|
|
148
|
+
@property
|
|
149
|
+
def embeddings_model_input(self):
|
|
150
|
+
return self.page.locator('span#embeddingsModel input[type="text"]')
|
|
151
|
+
|
|
152
|
+
@property
|
|
153
|
+
def embeddings_model_dropdown(self):
|
|
154
|
+
return self.page.locator("span#embeddingsModel button")
|
|
155
|
+
|
|
156
|
+
# -------------------------------
|
|
157
|
+
# Confluence DataSource Type Elements
|
|
158
|
+
# -------------------------------
|
|
159
|
+
|
|
160
|
+
@property
|
|
161
|
+
def cql_query_input(self):
|
|
162
|
+
return self.page.locator("input#cql")
|
|
163
|
+
|
|
164
|
+
@property
|
|
165
|
+
def error_cql_query_input(self):
|
|
166
|
+
return self.page.locator('label:has(input[name="cql"]) .input-error-message')
|
|
167
|
+
|
|
168
|
+
# -------------------------------
|
|
169
|
+
# Jira DataSource Type Elements
|
|
170
|
+
# -------------------------------
|
|
171
|
+
|
|
172
|
+
@property
|
|
173
|
+
def jql_query_input(self):
|
|
174
|
+
return self.page.locator("input#jql")
|
|
175
|
+
|
|
176
|
+
@property
|
|
177
|
+
def error_jql_query_input(self):
|
|
178
|
+
return self.page.locator('label:has(input[name="jql"]) .input-error-message')
|
|
179
|
+
|
|
180
|
+
# -------------------------------
|
|
181
|
+
# File DataSource Type Elements
|
|
182
|
+
# -------------------------------
|
|
183
|
+
|
|
184
|
+
@property
|
|
185
|
+
def select_file_button(self):
|
|
186
|
+
return self.page.locator("button:has-text('Select file')")
|
|
187
|
+
|
|
188
|
+
@property
|
|
189
|
+
def input_file(self):
|
|
190
|
+
return self.page.locator('input[type="file"]')
|
|
191
|
+
|
|
192
|
+
@property
|
|
193
|
+
def remove_file_icon(self):
|
|
194
|
+
return self.page.locator("svg.cursor-pointer")
|
|
195
|
+
|
|
196
|
+
@property
|
|
197
|
+
def add_file_button(self):
|
|
198
|
+
return self.page.locator("button:has-text('Add file')")
|
|
199
|
+
|
|
200
|
+
@property
|
|
201
|
+
def files_info_text(self):
|
|
202
|
+
return self.page.locator(".mb-4 div.flex.text-text-secondary.text-xs span")
|
|
203
|
+
|
|
204
|
+
@property
|
|
205
|
+
def error_files_info_text(self):
|
|
206
|
+
return self.page.locator(".mb-4 .text-fire-50")
|
|
207
|
+
|
|
208
|
+
@property
|
|
209
|
+
def file_input_field(self):
|
|
210
|
+
return self.page.locator("div.text-text-secondary.ml-2 ")
|
|
211
|
+
|
|
212
|
+
@property
|
|
213
|
+
def csv_separator_input(self):
|
|
214
|
+
return self.page.locator(
|
|
215
|
+
"span.p-autocomplete[id^='pr_id_'] input[name='csvSeparator']"
|
|
216
|
+
)
|
|
217
|
+
|
|
218
|
+
@property
|
|
219
|
+
def csv_separator_dropdown_button(self):
|
|
220
|
+
return self.page.locator(
|
|
221
|
+
"span.p-autocomplete[id^='pr_id_'] button[aria-label='Choose']"
|
|
222
|
+
)
|
|
223
|
+
|
|
224
|
+
@property
|
|
225
|
+
def csv_start_row_input(self):
|
|
226
|
+
return self.page.locator("input[name='csvStartRow']")
|
|
227
|
+
|
|
228
|
+
@property
|
|
229
|
+
def csv_rows_per_document_input(self):
|
|
230
|
+
return self.page.locator("input[name='csvRowsPerDocument']")
|
|
231
|
+
|
|
232
|
+
# -------------------------------
|
|
233
|
+
# Google DataSource Type Elements
|
|
234
|
+
# -------------------------------
|
|
235
|
+
|
|
236
|
+
@property
|
|
237
|
+
def google_query_input(self):
|
|
238
|
+
return self.page.locator("input#googleDoc")
|
|
239
|
+
|
|
240
|
+
@property
|
|
241
|
+
def error_google_query_input(self):
|
|
242
|
+
return self.page.locator(
|
|
243
|
+
'label:has(input[name="googleDoc"]) .input-error-message'
|
|
244
|
+
)
|
|
245
|
+
|
|
246
|
+
@property
|
|
247
|
+
def google_instructions(self):
|
|
248
|
+
return self.page.locator(".mb-4 div.flex.text-text-secondary.text-xs span")
|
|
249
|
+
|
|
250
|
+
# -----------------
|
|
251
|
+
# Action Methods
|
|
252
|
+
# -----------------
|
|
253
|
+
@step
|
|
254
|
+
def fill_name(self, value: str):
|
|
255
|
+
self.name_input.fill(value)
|
|
256
|
+
return self
|
|
257
|
+
|
|
258
|
+
@step
|
|
259
|
+
def fill_description(self, value: str):
|
|
260
|
+
self.description_input.fill(value)
|
|
261
|
+
return self
|
|
262
|
+
|
|
263
|
+
@step
|
|
264
|
+
def select_project(self, value: str):
|
|
265
|
+
self.project_multiselect.click()
|
|
266
|
+
self.dropdown_values(value).click()
|
|
267
|
+
return self
|
|
268
|
+
|
|
269
|
+
@step
|
|
270
|
+
def toggle_shared_with_project(self):
|
|
271
|
+
self.shared_with_project_switch.click()
|
|
272
|
+
return self
|
|
273
|
+
|
|
274
|
+
@step
|
|
275
|
+
def select_datasource_type(self, value: str):
|
|
276
|
+
self.datasource_type_dropdown.click()
|
|
277
|
+
self.dropdown_values(value).click()
|
|
278
|
+
return self
|
|
279
|
+
|
|
280
|
+
@step
|
|
281
|
+
def select_integration(self, value: str):
|
|
282
|
+
self.integration_dropdown.click()
|
|
283
|
+
self.dropdown_values(value).click()
|
|
284
|
+
return self
|
|
285
|
+
|
|
286
|
+
@step
|
|
287
|
+
def click_create(self):
|
|
288
|
+
self.create_button.click()
|
|
289
|
+
return self
|
|
290
|
+
|
|
291
|
+
@step
|
|
292
|
+
def click_cancel(self):
|
|
293
|
+
self.cancel_button.click()
|
|
294
|
+
return self
|
|
295
|
+
|
|
296
|
+
def _base_create_datasource(
|
|
297
|
+
self,
|
|
298
|
+
name: Optional[str],
|
|
299
|
+
project_name: Optional[str],
|
|
300
|
+
description: Optional[str],
|
|
301
|
+
datasource_type: DataSourceType,
|
|
302
|
+
shared: bool = False,
|
|
303
|
+
integration: Optional[str] = None,
|
|
304
|
+
):
|
|
305
|
+
"""
|
|
306
|
+
Fills common fields for any DataSource type
|
|
307
|
+
(name, description, project, type, shared, integration) but does not click 'Create'.
|
|
308
|
+
|
|
309
|
+
Args:
|
|
310
|
+
name: Optional[name], defaults to random if not provided
|
|
311
|
+
project_name: Optional[str], selects a project if provided
|
|
312
|
+
description: Optional[str], defaults to random if empty
|
|
313
|
+
datasource_type: DataSourceType enum member
|
|
314
|
+
shared: If True, enable 'Shared with project' toggle
|
|
315
|
+
integration: Optionally select integration string
|
|
316
|
+
|
|
317
|
+
Returns:
|
|
318
|
+
The name used for the datasource
|
|
319
|
+
"""
|
|
320
|
+
name = name or get_random_name()
|
|
321
|
+
description = description or get_random_name()
|
|
322
|
+
self.fill_name(name)
|
|
323
|
+
self.fill_description(description)
|
|
324
|
+
if project_name:
|
|
325
|
+
self.selector.search_and_select_project(project_name)
|
|
326
|
+
self.select_datasource_type(datasource_type)
|
|
327
|
+
if shared:
|
|
328
|
+
self.toggle_shared_with_project()
|
|
329
|
+
if integration:
|
|
330
|
+
self.select_integration(integration)
|
|
331
|
+
return name
|
|
332
|
+
|
|
333
|
+
@step
|
|
334
|
+
def create_git_datasource(
|
|
335
|
+
self,
|
|
336
|
+
name: Optional[str] = None,
|
|
337
|
+
project_name: Optional[str] = None,
|
|
338
|
+
description: Optional[str] = None,
|
|
339
|
+
shared: bool = False,
|
|
340
|
+
repo_link: Optional[str] = None,
|
|
341
|
+
branch: Optional[str] = None,
|
|
342
|
+
summarization_method: Optional[str] = None,
|
|
343
|
+
embeddings_model: Optional[str] = None,
|
|
344
|
+
integration: Optional[str] = None,
|
|
345
|
+
):
|
|
346
|
+
"""
|
|
347
|
+
Creates a Git DataSource with required and optional fields.
|
|
348
|
+
"""
|
|
349
|
+
name = self._base_create_datasource(
|
|
350
|
+
name, project_name, description, DataSourceType.GIT, shared, integration
|
|
351
|
+
)
|
|
352
|
+
if repo_link:
|
|
353
|
+
self.fill_repo_link(repo_link)
|
|
354
|
+
if branch:
|
|
355
|
+
self.fill_branch(branch)
|
|
356
|
+
if summarization_method:
|
|
357
|
+
self.select_summarization_method(summarization_method)
|
|
358
|
+
if embeddings_model:
|
|
359
|
+
self.select_embeddings_model(embeddings_model)
|
|
360
|
+
self.click_create()
|
|
361
|
+
return name
|
|
362
|
+
|
|
363
|
+
@step
|
|
364
|
+
def create_confluence_datasource(
|
|
365
|
+
self,
|
|
366
|
+
name: Optional[str] = None,
|
|
367
|
+
project_name: Optional[str] = None,
|
|
368
|
+
description: Optional[str] = None,
|
|
369
|
+
shared: bool = False,
|
|
370
|
+
cql_query: Optional[str] = None,
|
|
371
|
+
integration: Optional[str] = None,
|
|
372
|
+
):
|
|
373
|
+
"""
|
|
374
|
+
Creates a Confluence DataSource with required and optional fields.
|
|
375
|
+
"""
|
|
376
|
+
name = self._base_create_datasource(
|
|
377
|
+
name,
|
|
378
|
+
project_name,
|
|
379
|
+
description,
|
|
380
|
+
DataSourceType.CONFLUENCE,
|
|
381
|
+
shared,
|
|
382
|
+
integration,
|
|
383
|
+
)
|
|
384
|
+
if cql_query:
|
|
385
|
+
self.fill_cql_query(cql_query)
|
|
386
|
+
self.click_create()
|
|
387
|
+
return name
|
|
388
|
+
|
|
389
|
+
@step
|
|
390
|
+
def create_jira_datasource(
|
|
391
|
+
self,
|
|
392
|
+
name: Optional[str] = None,
|
|
393
|
+
project_name: Optional[str] = None,
|
|
394
|
+
description: Optional[str] = None,
|
|
395
|
+
shared: bool = False,
|
|
396
|
+
jql_query: Optional[str] = None,
|
|
397
|
+
integration: Optional[str] = None,
|
|
398
|
+
):
|
|
399
|
+
"""
|
|
400
|
+
Creates a Jira DataSource with required and optional fields.
|
|
401
|
+
"""
|
|
402
|
+
name = self._base_create_datasource(
|
|
403
|
+
name, project_name, description, DataSourceType.JIRA, shared, integration
|
|
404
|
+
)
|
|
405
|
+
if jql_query:
|
|
406
|
+
self.fill_jql_query(jql_query)
|
|
407
|
+
self.click_create()
|
|
408
|
+
return name
|
|
409
|
+
|
|
410
|
+
@step
|
|
411
|
+
def create_file_datasource(
|
|
412
|
+
self,
|
|
413
|
+
name: Optional[str] = None,
|
|
414
|
+
project_name: Optional[str] = None,
|
|
415
|
+
description: Optional[str] = None,
|
|
416
|
+
shared: bool = False,
|
|
417
|
+
file_path: Optional[str] = None,
|
|
418
|
+
integration: Optional[str] = None,
|
|
419
|
+
):
|
|
420
|
+
"""
|
|
421
|
+
Creates a File DataSource with required and optional fields.
|
|
422
|
+
"""
|
|
423
|
+
name = self._base_create_datasource(
|
|
424
|
+
name, project_name, description, DataSourceType.FILE, shared, integration
|
|
425
|
+
)
|
|
426
|
+
if file_path:
|
|
427
|
+
self.select_file(file_path)
|
|
428
|
+
self.click_create()
|
|
429
|
+
return name
|
|
430
|
+
|
|
431
|
+
@step
|
|
432
|
+
def create_google_datasource(
|
|
433
|
+
self,
|
|
434
|
+
name: Optional[str] = None,
|
|
435
|
+
project_name: Optional[str] = None,
|
|
436
|
+
description: Optional[str] = None,
|
|
437
|
+
shared: bool = False,
|
|
438
|
+
google_doc_link: Optional[str] = None,
|
|
439
|
+
integration: Optional[str] = None,
|
|
440
|
+
):
|
|
441
|
+
"""
|
|
442
|
+
Creates a Google DataSource with required and optional fields.
|
|
443
|
+
"""
|
|
444
|
+
name = self._base_create_datasource(
|
|
445
|
+
name, project_name, description, DataSourceType.GOOGLE, shared, integration
|
|
446
|
+
)
|
|
447
|
+
if google_doc_link:
|
|
448
|
+
self.fill_google_doc_link(google_doc_link)
|
|
449
|
+
self.click_create()
|
|
450
|
+
return name
|
|
451
|
+
|
|
452
|
+
# -------------------------------
|
|
453
|
+
# Git DataSource Type Methods
|
|
454
|
+
# -------------------------------
|
|
455
|
+
|
|
456
|
+
@step
|
|
457
|
+
def select_summarization_method(self, value: str):
|
|
458
|
+
self.summarization_method_dropdown.click()
|
|
459
|
+
self.dropdown_values(value).click()
|
|
460
|
+
return self
|
|
461
|
+
|
|
462
|
+
@step
|
|
463
|
+
def fill_repo_link(self, value: str):
|
|
464
|
+
self.repo_link_input.fill(value)
|
|
465
|
+
return self
|
|
466
|
+
|
|
467
|
+
@step
|
|
468
|
+
def fill_branch(self, value: str):
|
|
469
|
+
self.branch_input.fill(value)
|
|
470
|
+
return self
|
|
471
|
+
|
|
472
|
+
@step
|
|
473
|
+
def fill_files_filter(self, value: str):
|
|
474
|
+
self.files_filter_input.fill(value)
|
|
475
|
+
return self
|
|
476
|
+
|
|
477
|
+
@step
|
|
478
|
+
def select_embeddings_model(self, value: str):
|
|
479
|
+
self.embeddings_model_dropdown.click()
|
|
480
|
+
self.dropdown_values(value).click()
|
|
481
|
+
return self
|
|
482
|
+
|
|
483
|
+
# -------------------------------
|
|
484
|
+
# Confluence DataSource Type Methods
|
|
485
|
+
# -------------------------------
|
|
486
|
+
|
|
487
|
+
@step
|
|
488
|
+
def fill_cql_query(self, cql: str):
|
|
489
|
+
self.cql_query_input.fill(cql)
|
|
490
|
+
return self
|
|
491
|
+
|
|
492
|
+
# -------------------------------
|
|
493
|
+
# Jira DataSource Type Methods
|
|
494
|
+
# -------------------------------
|
|
495
|
+
|
|
496
|
+
@step
|
|
497
|
+
def fill_jql_query(self, jql: str):
|
|
498
|
+
self.jql_query_input.fill(jql)
|
|
499
|
+
return self
|
|
500
|
+
|
|
501
|
+
# -------------------------------
|
|
502
|
+
# File DataSource Type Methods
|
|
503
|
+
# -------------------------------
|
|
504
|
+
|
|
505
|
+
@step
|
|
506
|
+
def select_file(self, path: str):
|
|
507
|
+
self.input_file.set_input_files(path)
|
|
508
|
+
return self
|
|
509
|
+
|
|
510
|
+
@step
|
|
511
|
+
def add_file(self):
|
|
512
|
+
self.add_file_button.click()
|
|
513
|
+
return self
|
|
514
|
+
|
|
515
|
+
# -------------------------------
|
|
516
|
+
# Google DataSource Type Methods
|
|
517
|
+
# -------------------------------
|
|
518
|
+
|
|
519
|
+
@step
|
|
520
|
+
def fill_google_doc_link(self, link: str):
|
|
521
|
+
self.google_query_input.fill(link)
|
|
522
|
+
return self
|
|
523
|
+
|
|
524
|
+
# -----------------
|
|
525
|
+
# Verification Methods
|
|
526
|
+
# -----------------
|
|
527
|
+
|
|
528
|
+
@step
|
|
529
|
+
def should_see_name_input(self):
|
|
530
|
+
expect(self.name_input).to_be_visible()
|
|
531
|
+
return self
|
|
532
|
+
|
|
533
|
+
@step
|
|
534
|
+
def should_see_disabled_name_input(self, name: str):
|
|
535
|
+
expect(self.disabled_name_input).to_be_visible()
|
|
536
|
+
expect(self.disabled_name_input).to_have_value(name)
|
|
537
|
+
return self
|
|
538
|
+
|
|
539
|
+
@step
|
|
540
|
+
def should_see_description_input(self):
|
|
541
|
+
expect(self.description_input).to_be_visible()
|
|
542
|
+
return self
|
|
543
|
+
|
|
544
|
+
@step
|
|
545
|
+
def should_see_shared_with_project_switch(self):
|
|
546
|
+
expect(self.shared_with_project_switch).to_be_visible()
|
|
547
|
+
return self
|
|
548
|
+
|
|
549
|
+
@step
|
|
550
|
+
def should_see_datasource_type_input(self):
|
|
551
|
+
expect(self.datasource_type_selector).to_be_visible()
|
|
552
|
+
# default value is Git
|
|
553
|
+
expect(self.datasource_type_selector).to_have_value("Git")
|
|
554
|
+
return self
|
|
555
|
+
|
|
556
|
+
@step
|
|
557
|
+
def should_see_datasource_type_dropdown_values(self):
|
|
558
|
+
self.datasource_type_dropdown.click()
|
|
559
|
+
for type in DATA_SOURCE_TYPES_LIST:
|
|
560
|
+
expect(self.dropdown_values(type)).to_be_visible()
|
|
561
|
+
|
|
562
|
+
@step
|
|
563
|
+
def should_see_create_button(self):
|
|
564
|
+
expect(self.create_button).to_be_visible()
|
|
565
|
+
return self
|
|
566
|
+
|
|
567
|
+
@step
|
|
568
|
+
def should_see_cancel_button(self):
|
|
569
|
+
expect(self.cancel_button).to_be_visible()
|
|
570
|
+
return self
|
|
571
|
+
|
|
572
|
+
@step
|
|
573
|
+
def should_see_save_reindex_button(self):
|
|
574
|
+
expect(self.save_reindex_button).to_be_visible()
|
|
575
|
+
return self
|
|
576
|
+
|
|
577
|
+
@step
|
|
578
|
+
def should_see_integration_input(self):
|
|
579
|
+
expect(self.integration_input).to_be_visible()
|
|
580
|
+
return self
|
|
581
|
+
|
|
582
|
+
@step
|
|
583
|
+
def should_see_add_integration_button(self):
|
|
584
|
+
expect(self.add_integration_button).to_be_visible()
|
|
585
|
+
return self
|
|
586
|
+
|
|
587
|
+
@step
|
|
588
|
+
def should_see_integration_input_or_button(self):
|
|
589
|
+
"""
|
|
590
|
+
Verifies that either the integration input OR the add integration button is visible.
|
|
591
|
+
"""
|
|
592
|
+
try:
|
|
593
|
+
self.should_see_integration_input()
|
|
594
|
+
except AssertionError:
|
|
595
|
+
self.should_see_add_integration_button()
|
|
596
|
+
return self
|
|
597
|
+
|
|
598
|
+
@step
|
|
599
|
+
def should_see_selected_integration(self, integration: str):
|
|
600
|
+
expect(self.integration_input).to_have_text(integration)
|
|
601
|
+
return self
|
|
602
|
+
|
|
603
|
+
@step
|
|
604
|
+
def should_see_main_fields(self):
|
|
605
|
+
self.should_see_name_input()
|
|
606
|
+
self.should_see_description_input()
|
|
607
|
+
self.selector.should_see_multiselect()
|
|
608
|
+
self.should_see_shared_with_project_switch()
|
|
609
|
+
self.should_see_datasource_type_input()
|
|
610
|
+
self.should_see_create_button()
|
|
611
|
+
self.should_see_cancel_button()
|
|
612
|
+
self.should_see_datasource_type_dropdown_values()
|
|
613
|
+
return self
|
|
614
|
+
|
|
615
|
+
@step
|
|
616
|
+
def should_see_error_for_empty_main_fields(self):
|
|
617
|
+
expect(self.error_name_input).to_be_visible()
|
|
618
|
+
expect(self.error_name_input).to_have_text(EMPTY_NAME_ERROR)
|
|
619
|
+
expect(self.error_description_input).to_be_visible()
|
|
620
|
+
expect(self.error_description_input).to_have_text(EMPTY_DESCRIPTION_ERROR)
|
|
621
|
+
return self
|
|
622
|
+
|
|
623
|
+
@step
|
|
624
|
+
def should_see_error_for_empty_git_fields(self):
|
|
625
|
+
expect(self.error_repo_link_input).to_be_visible()
|
|
626
|
+
expect(self.error_repo_link_input).to_have_text(EMPTY_REPO_LINK_ERROR)
|
|
627
|
+
expect(self.error_branch_input).to_be_visible()
|
|
628
|
+
expect(self.error_branch_input).to_have_text(EMPTY_BRANCH_ERROR)
|
|
629
|
+
return self
|
|
630
|
+
|
|
631
|
+
@step
|
|
632
|
+
def should_see_error_for_empty_confluence_fields(self):
|
|
633
|
+
expect(self.error_cql_query_input).to_be_visible()
|
|
634
|
+
expect(self.error_cql_query_input).to_have_text(EMPTY_CQL_ERROR)
|
|
635
|
+
return self
|
|
636
|
+
|
|
637
|
+
@step
|
|
638
|
+
def should_see_error_for_empty_jira_fields(self):
|
|
639
|
+
expect(self.error_jql_query_input).to_be_visible()
|
|
640
|
+
expect(self.error_jql_query_input).to_have_text(EMPTY_JQL_ERROR)
|
|
641
|
+
return self
|
|
642
|
+
|
|
643
|
+
@step
|
|
644
|
+
def should_see_error_for_empty_file_fields(self):
|
|
645
|
+
expect(self.error_files_info_text).to_be_visible()
|
|
646
|
+
expect(self.error_files_info_text).to_have_text(EMPTY_FILE_ERROR)
|
|
647
|
+
return self
|
|
648
|
+
|
|
649
|
+
@step
|
|
650
|
+
def should_see_error_for_empty_google_fields(self):
|
|
651
|
+
expect(self.error_google_query_input).to_be_visible()
|
|
652
|
+
expect(self.error_google_query_input).to_have_text(EMPTY_GOOGLE_LINK_ERROR)
|
|
653
|
+
return self
|
|
654
|
+
|
|
655
|
+
# -------------------------------
|
|
656
|
+
# Git DataSource Type Verification Methods
|
|
657
|
+
# -------------------------------
|
|
658
|
+
|
|
659
|
+
@step
|
|
660
|
+
def should_see_summarization_fields(self):
|
|
661
|
+
expect(self.summarization_method_input).to_be_visible()
|
|
662
|
+
expect(self.summarization_method_dropdown).to_be_visible()
|
|
663
|
+
return self
|
|
664
|
+
|
|
665
|
+
@step
|
|
666
|
+
def should_see_summarization_dropdown_values(self):
|
|
667
|
+
self.summarization_method_dropdown.click()
|
|
668
|
+
for method in SUMMARIZATION_METHODS_LIST:
|
|
669
|
+
expect(self.dropdown_values(method)).to_be_visible()
|
|
670
|
+
|
|
671
|
+
@step
|
|
672
|
+
def should_see_repo_fields(self):
|
|
673
|
+
expect(self.repo_link_input).to_be_visible()
|
|
674
|
+
expect(self.branch_input).to_be_visible()
|
|
675
|
+
return self
|
|
676
|
+
|
|
677
|
+
@step
|
|
678
|
+
def should_see_files_filter_textarea(self):
|
|
679
|
+
expect(self.files_filter_input).to_be_visible()
|
|
680
|
+
return self
|
|
681
|
+
|
|
682
|
+
@step
|
|
683
|
+
def should_see_embeddings_model_field(self):
|
|
684
|
+
expect(self.embeddings_model_input).to_be_visible()
|
|
685
|
+
expect(self.embeddings_model_dropdown).to_be_visible()
|
|
686
|
+
return self
|
|
687
|
+
|
|
688
|
+
@step
|
|
689
|
+
def should_see_embeddings_model_dropdown_values(self):
|
|
690
|
+
self.embeddings_model_dropdown.click()
|
|
691
|
+
for model in EMBEDDING_MODELS_LIST:
|
|
692
|
+
expect(self.dropdown_values(model)).to_be_visible()
|
|
693
|
+
self.page.click("body")
|
|
694
|
+
return self
|
|
695
|
+
|
|
696
|
+
@step
|
|
697
|
+
def should_see_git_fields(self):
|
|
698
|
+
self.should_see_summarization_fields()
|
|
699
|
+
self.should_see_embeddings_model_dropdown_values()
|
|
700
|
+
self.should_see_repo_fields()
|
|
701
|
+
self.should_see_files_filter_textarea()
|
|
702
|
+
self.should_see_embeddings_model_field()
|
|
703
|
+
self.should_see_embeddings_model_dropdown_values()
|
|
704
|
+
self.should_see_integration_input_or_button()
|
|
705
|
+
return self
|
|
706
|
+
|
|
707
|
+
# -------------------------------
|
|
708
|
+
# Confluence DataSource Type Verification Methods
|
|
709
|
+
# -------------------------------
|
|
710
|
+
|
|
711
|
+
@step
|
|
712
|
+
def should_see_confluence_cql_field(self):
|
|
713
|
+
expect(self.cql_query_input).to_be_visible()
|
|
714
|
+
return self
|
|
715
|
+
|
|
716
|
+
# -------------------------------
|
|
717
|
+
# Jira DataSource Type Verification Methods
|
|
718
|
+
# -------------------------------
|
|
719
|
+
|
|
720
|
+
@step
|
|
721
|
+
def should_see_jira_jql_field(self):
|
|
722
|
+
expect(self.jql_query_input).to_be_visible()
|
|
723
|
+
return self
|
|
724
|
+
|
|
725
|
+
# -------------------------------
|
|
726
|
+
# File DataSource Type Verification Methods
|
|
727
|
+
# -------------------------------
|
|
728
|
+
|
|
729
|
+
@step
|
|
730
|
+
def should_see_file_fields(self):
|
|
731
|
+
expect(self.select_file_button).to_be_visible()
|
|
732
|
+
expect(self.add_file_button).to_be_visible()
|
|
733
|
+
expect(self.files_info_text).to_be_visible()
|
|
734
|
+
expect(self.files_info_text).to_have_text(FILE_INSTRUCTIONS)
|
|
735
|
+
return self
|
|
736
|
+
|
|
737
|
+
@step
|
|
738
|
+
def should_see_uploaded_file(self, file_name: str):
|
|
739
|
+
expect(self.file_input_field).to_be_visible()
|
|
740
|
+
expect(self.file_input_field).to_have_text(file_name)
|
|
741
|
+
return self
|
|
742
|
+
|
|
743
|
+
@step
|
|
744
|
+
def should_see_csv_config(self):
|
|
745
|
+
expect(self.csv_separator_input).to_be_visible()
|
|
746
|
+
expect(self.csv_separator_input).to_have_value("; (selmicolor)")
|
|
747
|
+
expect(self.csv_separator_dropdown_button).to_be_visible()
|
|
748
|
+
expect(self.csv_start_row_input).to_be_visible()
|
|
749
|
+
expect(self.csv_start_row_input).to_have_text("1")
|
|
750
|
+
expect(self.csv_rows_per_document_input).to_be_visible()
|
|
751
|
+
expect(self.csv_rows_per_document_input).to_have_value("1")
|
|
752
|
+
return self
|
|
753
|
+
|
|
754
|
+
# -------------------------------
|
|
755
|
+
# Google DataSource Type Verification Methods
|
|
756
|
+
# -------------------------------
|
|
757
|
+
|
|
758
|
+
@step
|
|
759
|
+
def should_see_google_fields(self):
|
|
760
|
+
expect(self.google_query_input).to_be_visible()
|
|
761
|
+
expect(self.google_instructions.nth(0)).to_be_visible()
|
|
762
|
+
expect(self.google_instructions.nth(1)).to_be_visible()
|
|
763
|
+
expect(self.google_instructions.nth(0)).to_have_text(GOOGLE_INSTRUCTIONS)
|
|
764
|
+
expect(self.google_instructions.nth(0).locator("a")).to_have_attribute(
|
|
765
|
+
"href", GOOGLE_GUIDE_URL
|
|
766
|
+
)
|
|
767
|
+
expect(self.google_instructions.nth(1)).to_have_text(GOOGLE_EXAMPLE)
|
|
768
|
+
expect(self.google_instructions.nth(1).locator("a")).to_have_attribute(
|
|
769
|
+
"href", GOOGLE_DOC_URL
|
|
770
|
+
)
|
|
771
|
+
return self
|