codemie-test-harness 0.1.176__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.

Files changed (25) hide show
  1. codemie_test_harness/tests/assistant/tools/mcp/test_single_assistant_dual_time_plugins.py +8 -2
  2. codemie_test_harness/tests/conftest.py +6 -6
  3. codemie_test_harness/tests/llm/assistants/test_lite_llm.py +5 -4
  4. codemie_test_harness/tests/test_data/google_datasource_test_data.py +4 -1
  5. codemie_test_harness/tests/ui/_test_data/datasource_test_data.py +125 -0
  6. codemie_test_harness/tests/ui/datasource/__init__.py +0 -0
  7. codemie_test_harness/tests/ui/datasource/test_create_datasource.py +188 -0
  8. codemie_test_harness/tests/ui/datasource/test_datasource_page.py +61 -0
  9. codemie_test_harness/tests/ui/datasource/test_edit_datasource.py +180 -0
  10. codemie_test_harness/tests/ui/datasource/test_view_datasource.py +220 -0
  11. codemie_test_harness/tests/ui/pageobject/assistants/assistants_page.py +1 -1
  12. codemie_test_harness/tests/ui/pageobject/base_page.py +31 -5
  13. codemie_test_harness/tests/ui/pageobject/components/project_selector.py +116 -0
  14. codemie_test_harness/tests/ui/pageobject/components/workflow_sidebar.py +1 -1
  15. codemie_test_harness/tests/ui/pageobject/datasources/__init__.py +0 -0
  16. codemie_test_harness/tests/ui/pageobject/datasources/create_edit_datasource_page.py +771 -0
  17. codemie_test_harness/tests/ui/pageobject/datasources/datasource_page.py +233 -0
  18. codemie_test_harness/tests/ui/pageobject/datasources/datasource_sidebar.py +303 -0
  19. codemie_test_harness/tests/ui/pageobject/datasources/view_datasource_page.py +335 -0
  20. codemie_test_harness/tests/utils/datasource_utils.py +13 -18
  21. {codemie_test_harness-0.1.176.dist-info → codemie_test_harness-0.1.178.dist-info}/METADATA +2 -2
  22. {codemie_test_harness-0.1.176.dist-info → codemie_test_harness-0.1.178.dist-info}/RECORD +24 -13
  23. codemie_test_harness/tests/ui/pytest.ini +0 -18
  24. {codemie_test_harness-0.1.176.dist-info → codemie_test_harness-0.1.178.dist-info}/WHEEL +0 -0
  25. {codemie_test_harness-0.1.176.dist-info → codemie_test_harness-0.1.178.dist-info}/entry_points.txt +0 -0
@@ -115,10 +115,16 @@ def dual_time_plugins(integration_utils):
115
115
  credential_type=CredentialTypes.PLUGIN, credential_values=credential_values
116
116
  )
117
117
 
118
- # Download codemie-tools
119
- download_process = subprocess.Popen(["uvx", "codemie-tools"])
118
+ # Download codemie-plugins and wait for completion
119
+ download_process = subprocess.Popen(["uvx", "codemie-plugins"])
120
120
  processes.append(download_process)
121
121
 
122
+ return_code = download_process.wait()
123
+ if return_code != 0:
124
+ raise RuntimeError(
125
+ f"Failed to download codemie-plugins, exit code: {return_code}"
126
+ )
127
+
122
128
  # Find paths and configure servers
123
129
  servers_json_path, codemie_plugins_path = find_cache_paths()
124
130
  configure_mcp_servers(servers_json_path)
@@ -253,7 +253,7 @@ def conversation_utils(client):
253
253
  return ConversationUtils(client)
254
254
 
255
255
 
256
- @pytest.fixture(scope="function")
256
+ @pytest.fixture(scope="session")
257
257
  def git_integration(integration_utils):
258
258
  integration = integration_utils.create_integration(
259
259
  credential_type=CredentialTypes.GIT,
@@ -264,7 +264,7 @@ def git_integration(integration_utils):
264
264
  integration_utils.delete_integration(integration)
265
265
 
266
266
 
267
- @pytest.fixture(scope="function")
267
+ @pytest.fixture(scope="session")
268
268
  def github_integration(integration_utils):
269
269
  integration = integration_utils.create_integration(
270
270
  credential_type=CredentialTypes.GIT,
@@ -275,7 +275,7 @@ def github_integration(integration_utils):
275
275
  integration_utils.delete_integration(integration)
276
276
 
277
277
 
278
- @pytest.fixture(scope="function")
278
+ @pytest.fixture(scope="session")
279
279
  def gitlab_integration(integration_utils):
280
280
  integration = integration_utils.create_integration(
281
281
  credential_type=CredentialTypes.GIT,
@@ -438,7 +438,7 @@ def general_integration(integration_utils):
438
438
  pass
439
439
 
440
440
 
441
- @pytest.fixture(scope="function")
441
+ @pytest.fixture(scope="session")
442
442
  def code_datasource(
443
443
  datasource_utils, gitlab_integration, github_integration, default_embedding_llm
444
444
  ):
@@ -458,7 +458,7 @@ def code_datasource(
458
458
  datasource_utils.delete_datasource(datasource)
459
459
 
460
460
 
461
- @pytest.fixture(scope="function")
461
+ @pytest.fixture(scope="session")
462
462
  def gitlab_datasource(datasource_utils, gitlab_integration, default_embedding_llm):
463
463
  datasource = datasource_utils.create_gitlab_datasource(
464
464
  setting_id=gitlab_integration.id,
@@ -469,7 +469,7 @@ def gitlab_datasource(datasource_utils, gitlab_integration, default_embedding_ll
469
469
  datasource_utils.delete_datasource(datasource)
470
470
 
471
471
 
472
- @pytest.fixture(scope="function")
472
+ @pytest.fixture(scope="session")
473
473
  def github_datasource(datasource_utils, github_integration, default_embedding_llm):
474
474
  datasource = datasource_utils.create_github_datasource(
475
475
  setting_id=github_integration.id,
@@ -13,6 +13,11 @@ from codemie_test_harness.tests.utils.env_resolver import (
13
13
  )
14
14
  from codemie_test_harness.tests.utils.pytest_utils import check_mark
15
15
 
16
+ pytestmark = pytest.mark.skipif(
17
+ EnvironmentResolver.is_sandbox() or EnvironmentResolver.is_localhost(),
18
+ reason="Skipping this tests on sandbox environments",
19
+ )
20
+
16
21
 
17
22
  @pytest.fixture(scope="module")
18
23
  def lite_llm_integration(integration_utils):
@@ -66,10 +71,6 @@ def pytest_generate_tests(metafunc):
66
71
  @pytest.mark.assistant
67
72
  @pytest.mark.lite_llm
68
73
  @pytest.mark.regression
69
- @pytest.mark.skipif(
70
- EnvironmentResolver.is_sandbox(),
71
- reason="Skipping this tests on sandbox environments",
72
- )
73
74
  def test_assistant_with_different_models_in_lite_llm(
74
75
  llm_utils,
75
76
  lite_llm_integration,
@@ -1,6 +1,9 @@
1
1
  """Test data constants for Google Datasource tests"""
2
2
 
3
- GOOGLE_DOC_URL = "https://docs.google.com/document/d/19EXgnFCgJontz0ToCAH6zMGwBTdhi5X97P9JIby4wHs/edit#heading=h.b01c2ig0adfg"
3
+ GOOGLE_DOC_URL = "https://docs.google.com/document/d/19EXgnFCgJontz0ToCAH6zMGwBTdhi5X97P9JIby4wHs/edit?tab=t.0#heading=h.b01c2ig0adfg"
4
+ GOOGLE_GUIDE_URL = (
5
+ "https://docs.google.com/document/d/1ZNWwxN8ukpJZyTbYjWQPym3Bc1-bQvBxBpTL0yfVF-w"
6
+ )
4
7
 
5
8
  USER_PROMPT = 'Tell context of the What is "Platform A"? section?'
6
9
 
@@ -0,0 +1,125 @@
1
+ """
2
+ Test Data for Data Source UI – used for parametrized testing and test validation
3
+ """
4
+
5
+ from enum import Enum
6
+
7
+
8
+ # ==================== ENUMS ====================
9
+ class DataSourceFilterType(str, Enum):
10
+ CODE = "Code"
11
+ CONFLUENCE = "Confluence"
12
+ JIRA = "Jira"
13
+ FILE = "File"
14
+ GOOGLE = "Google"
15
+ PROVIDER = "Provider"
16
+
17
+ def __str__(self):
18
+ return self.value
19
+
20
+
21
+ class DataSourceType(str, Enum):
22
+ GIT = "Git"
23
+ CONFLUENCE = "Confluence"
24
+ JIRA = "Jira"
25
+ FILE = "File"
26
+ GOOGLE = "Google"
27
+
28
+ def __str__(self):
29
+ return self.value
30
+
31
+
32
+ class DataSourceFilterStatus(str, Enum):
33
+ COMPLETED = "Completed"
34
+ FAILED = "Failed"
35
+ IN_PROGRESS = "In Progress"
36
+
37
+ def __str__(self):
38
+ return self.value
39
+
40
+
41
+ class DataSourceStatus(str, Enum):
42
+ COMPLETED = "Completed"
43
+ ERROR = "Error"
44
+ FETCHING = "Fetching"
45
+
46
+ def __str__(self):
47
+ return self.value
48
+
49
+
50
+ class SummarizationMethod(str, Enum):
51
+ WHOLE_CODEBASE = "Whole Codebase"
52
+ PER_FILE = "Summarization per file"
53
+ PER_CHUNKS = "Summarization per chunks"
54
+
55
+ def __str__(self):
56
+ return self.value
57
+
58
+
59
+ class EmbeddingModel(str, Enum):
60
+ ADA = "Text Embedding Ada"
61
+ GECKO = "Text Embedding Gecko"
62
+ TITAN_V2 = "Titan Embed Text v2.0"
63
+
64
+ def __str__(self):
65
+ return self.value
66
+
67
+
68
+ class DataSourceColumnName(str, Enum):
69
+ NAME = "Name"
70
+ PROJECT = "Project"
71
+ TYPE = "Type"
72
+ CREATED_BY = "Created By"
73
+ CREATED = "Created"
74
+ UPDATED = "Updated"
75
+ SHARED = "Shared"
76
+ STATUS = "Status"
77
+ ACTIONS = "Actions"
78
+
79
+ def __str__(self):
80
+ return self.value
81
+
82
+
83
+ # ==================== CONSTANTS ====================
84
+
85
+ DATA_SOURCE_FILTER_TYPES_LIST = [t for t in DataSourceFilterType]
86
+ DATA_SOURCE_TYPES_LIST = [t for t in DataSourceType]
87
+ DATA_SOURCE_FILTER_STATUSES_LIST = [s for s in DataSourceFilterStatus]
88
+ DATA_SOURCE_STATUSES_LIST = [s for s in DataSourceStatus]
89
+ DATAS_SOURCE_COLUMN_LIST = [c for c in DataSourceColumnName]
90
+ SUMMARIZATION_METHODS_LIST = [m for m in SummarizationMethod]
91
+ EMBEDDING_MODELS_LIST = [m for m in EmbeddingModel]
92
+
93
+ PROJECT_LABEL = "Project"
94
+ STATUS_LABEL = "Status"
95
+
96
+ MAIN_TITLE_DATASOURCE = "Data Sources"
97
+ MAIN_SUBTITLE_DATASOURCE = "Connect and manage your data sources in one place"
98
+ TITLE_CREATE_DATASOURCE = "New DataSource"
99
+ SUBTITLE_CREATE_DATASOURCE = "Start indexing your data source"
100
+ TITLE_VIEW_DATASOURCE = "View DataSource"
101
+ SUBTITLE_VIEW_DATASOURCE = "View your data source datails"
102
+ UPDATE_TITLE_DATASOURCE = "Update DataSource"
103
+ UPDATE_SUBTITLE_DATASOURCE = "Update your data source and start re-indexing"
104
+
105
+ FILE_INSTRUCTIONS = (
106
+ "Max size: 100Mb. Formats: .yml, .yaml, .json, .pptx, .csv, .txt, "
107
+ ".pdf, .docx, .xlsx, .xml"
108
+ )
109
+ GOOGLE_INSTRUCTIONS = (
110
+ "Please ensure your Google document is properly formatted and shared with the"
111
+ " service account. For detailed instructions, refer to the Guide"
112
+ )
113
+ GOOGLE_EXAMPLE = "Google documents must follow a specific format for LLM routing: View Format Example"
114
+
115
+ EMPTY_NAME_ERROR = "Data source name is required"
116
+ EMPTY_DESCRIPTION_ERROR = "description is a required field"
117
+ EMPTY_REPO_LINK_ERROR = "Repo Link is required"
118
+ EMPTY_BRANCH_ERROR = "Branch is required"
119
+ EMPTY_CQL_ERROR = "cql is a required field"
120
+ EMPTY_JQL_ERROR = "jql is a required field"
121
+ EMPTY_FILE_ERROR = (
122
+ "Invalid file type found, only .yml, .yaml, .json, .pptx, .csv, .txt, .pdf, "
123
+ ".docx, .xlsx, .xml are allowed"
124
+ )
125
+ EMPTY_GOOGLE_LINK_ERROR = "Google Docs link is required"
File without changes
@@ -0,0 +1,188 @@
1
+ import pytest
2
+ from tests import CredentialsManager, PROJECT, TEST_USER
3
+ from tests.test_data.google_datasource_test_data import GOOGLE_DOC_URL
4
+ from tests.ui._test_data.datasource_test_data import (
5
+ DataSourceType,
6
+ DataSourceFilterType,
7
+ DataSourceStatus,
8
+ )
9
+ from tests.ui._test_data.datasource_test_data import (
10
+ TITLE_CREATE_DATASOURCE,
11
+ SUBTITLE_CREATE_DATASOURCE,
12
+ )
13
+ from tests.ui.pageobject.datasources.create_edit_datasource_page import (
14
+ CreateEditDatasourcePage,
15
+ )
16
+ from tests.ui.pageobject.datasources.datasource_page import DataSourcePage
17
+ from tests.utils.constants import FILES_PATH
18
+
19
+
20
+ @pytest.mark.datasource_ui
21
+ @pytest.mark.ui
22
+ def test_open_create_datasource_page_and_elements(page):
23
+ """Open Create Datasource page and verify critical elements."""
24
+ create_page = CreateEditDatasourcePage(page)
25
+
26
+ create_page.navigate_to()
27
+ create_page.sidebar.should_see_title_subtitle(
28
+ TITLE_CREATE_DATASOURCE, SUBTITLE_CREATE_DATASOURCE
29
+ )
30
+ create_page.should_see_main_fields()
31
+
32
+ create_page.select_datasource_type(DataSourceType.GIT)
33
+ create_page.should_see_git_fields()
34
+
35
+ create_page.select_datasource_type(DataSourceFilterType.CONFLUENCE)
36
+ create_page.should_see_confluence_cql_field()
37
+ create_page.should_see_integration_input_or_button()
38
+
39
+ create_page.select_datasource_type(DataSourceFilterType.JIRA)
40
+ create_page.should_see_jira_jql_field()
41
+ create_page.should_see_integration_input_or_button()
42
+
43
+ create_page.select_datasource_type(DataSourceFilterType.FILE)
44
+ create_page.should_see_file_fields()
45
+ create_page.select_datasource_type(DataSourceFilterType.GOOGLE)
46
+ create_page.should_see_google_fields()
47
+
48
+
49
+ @pytest.mark.datasource_ui
50
+ @pytest.mark.ui
51
+ def test_datasource_creation_validation(page):
52
+ """Test create datasource without data and observing errors."""
53
+ create_page = CreateEditDatasourcePage(page)
54
+
55
+ create_page.navigate_to()
56
+ create_page.select_datasource_type(DataSourceType.GIT).click_create()
57
+ create_page.should_see_error_for_empty_main_fields()
58
+ create_page.should_see_error_for_empty_git_fields()
59
+
60
+ create_page.select_datasource_type(DataSourceFilterType.CONFLUENCE).click_create()
61
+ create_page.should_see_error_for_empty_main_fields()
62
+ create_page.should_see_error_for_empty_confluence_fields()
63
+
64
+ create_page.select_datasource_type(DataSourceFilterType.JIRA).click_create()
65
+ create_page.should_see_error_for_empty_main_fields()
66
+ create_page.should_see_error_for_empty_jira_fields()
67
+
68
+ create_page.select_datasource_type(DataSourceFilterType.FILE).click_create()
69
+ create_page.should_see_error_for_empty_main_fields()
70
+ create_page.should_see_error_for_empty_file_fields()
71
+
72
+ create_page.select_datasource_type(DataSourceFilterType.GOOGLE).click_create()
73
+ create_page.should_see_error_for_empty_main_fields()
74
+ create_page.should_see_error_for_empty_google_fields()
75
+
76
+
77
+ @pytest.mark.datasource_ui
78
+ @pytest.mark.ui
79
+ def test_create_git_datasource(page, git_integration):
80
+ """Test creating a new datasource with all required fields."""
81
+ datasource_page = DataSourcePage(page)
82
+ create_page = CreateEditDatasourcePage(page)
83
+
84
+ create_page.navigate_to()
85
+ datasource = create_page.create_git_datasource(
86
+ project_name=PROJECT,
87
+ repo_link=CredentialsManager.get_parameter("GITLAB_PROJECT"),
88
+ branch="main",
89
+ integration=git_integration.alias,
90
+ )
91
+
92
+ datasource_page.should_see_table_row_with_values(
93
+ name=datasource,
94
+ status=DataSourceStatus.COMPLETED,
95
+ project=PROJECT,
96
+ type_=DataSourceFilterType.CODE,
97
+ created_by=TEST_USER,
98
+ )
99
+
100
+
101
+ @pytest.mark.datasource_ui
102
+ @pytest.mark.ui
103
+ def test_create_confluence_datasource(page, confluence_integration):
104
+ """Test creating a new datasource with all required fields."""
105
+ datasource_page = DataSourcePage(page)
106
+ create_page = CreateEditDatasourcePage(page)
107
+
108
+ create_page.navigate_to()
109
+ datasource = create_page.create_confluence_datasource(
110
+ project_name=PROJECT,
111
+ cql_query=CredentialsManager.confluence_cql(),
112
+ integration=confluence_integration.alias,
113
+ )
114
+
115
+ datasource_page.should_see_table_row_with_values(
116
+ name=datasource,
117
+ status=DataSourceStatus.COMPLETED,
118
+ project=PROJECT,
119
+ type_=DataSourceFilterType.CONFLUENCE,
120
+ created_by=TEST_USER,
121
+ )
122
+
123
+
124
+ @pytest.mark.datasource_ui
125
+ @pytest.mark.ui
126
+ def test_create_jira_datasource(page, jira_integration):
127
+ """Test creating a new datasource with all required fields."""
128
+ datasource_page = DataSourcePage(page)
129
+ create_page = CreateEditDatasourcePage(page)
130
+
131
+ create_page.navigate_to()
132
+ datasource = create_page.create_jira_datasource(
133
+ project_name=PROJECT,
134
+ jql_query=CredentialsManager.jira_jql(),
135
+ integration=jira_integration.alias,
136
+ )
137
+
138
+ datasource_page.should_see_table_row_with_values(
139
+ name=datasource,
140
+ status=DataSourceStatus.COMPLETED,
141
+ project=PROJECT,
142
+ type_=DataSourceFilterType.JIRA,
143
+ created_by=TEST_USER,
144
+ )
145
+
146
+
147
+ @pytest.mark.datasource_ui
148
+ @pytest.mark.ui
149
+ def test_create_file_datasource(page):
150
+ """Test creating a new datasource with all required fields."""
151
+ datasource_page = DataSourcePage(page)
152
+ create_page = CreateEditDatasourcePage(page)
153
+
154
+ create_page.navigate_to()
155
+ datasource = create_page.create_file_datasource(
156
+ project_name=PROJECT,
157
+ file_path=[str(FILES_PATH / "test.txt")],
158
+ )
159
+
160
+ datasource_page.should_see_table_row_with_values(
161
+ name=datasource,
162
+ status=DataSourceStatus.COMPLETED,
163
+ project=PROJECT,
164
+ type_=DataSourceFilterType.FILE,
165
+ created_by=TEST_USER,
166
+ )
167
+
168
+
169
+ @pytest.mark.datasource_ui
170
+ @pytest.mark.ui
171
+ def test_create_google_datasource(page):
172
+ """Test creating a new datasource with all required fields."""
173
+ datasource_page = DataSourcePage(page)
174
+ create_page = CreateEditDatasourcePage(page)
175
+
176
+ create_page.navigate_to()
177
+ datasource = create_page.create_google_datasource(
178
+ project_name=PROJECT,
179
+ google_doc_link=GOOGLE_DOC_URL,
180
+ )
181
+
182
+ datasource_page.should_see_table_row_with_values(
183
+ name=datasource,
184
+ status=DataSourceStatus.COMPLETED,
185
+ project=PROJECT,
186
+ type_=DataSourceFilterType.GOOGLE,
187
+ created_by=TEST_USER,
188
+ )
@@ -0,0 +1,61 @@
1
+ import pytest
2
+
3
+ from codemie_test_harness.tests.ui.pageobject.datasources.datasource_page import (
4
+ DataSourcePage,
5
+ )
6
+ from codemie_test_harness.tests.utils.base_utils import get_random_name
7
+ from tests import TEST_USER
8
+ from tests.ui._test_data.datasource_test_data import (
9
+ MAIN_TITLE_DATASOURCE,
10
+ MAIN_SUBTITLE_DATASOURCE,
11
+ )
12
+
13
+
14
+ @pytest.mark.datasource_ui
15
+ @pytest.mark.ui
16
+ def test_datasource_sidebar_interaction(page):
17
+ """Test sidebar filters interactions."""
18
+ search_input = get_random_name()
19
+ datasource_page = DataSourcePage(page)
20
+
21
+ datasource_page.navigate_to()
22
+ datasource_page.sidebar.should_see_title_subtitle(
23
+ MAIN_TITLE_DATASOURCE, MAIN_SUBTITLE_DATASOURCE
24
+ )
25
+ datasource_page.sidebar.input_data_search(search_input).should_see_search_input(
26
+ search_input
27
+ )
28
+ datasource_page.sidebar.should_see_selected_checkboxes()
29
+ datasource_page.sidebar.toggle_created_by_me().should_see_created_by_me_value(
30
+ TEST_USER
31
+ )
32
+ datasource_page.sidebar.should_see_project_filter()
33
+ datasource_page.sidebar.should_see_status_dropdown()
34
+ datasource_page.sidebar.should_select_status_dropdown()
35
+ datasource_page.sidebar.click_clear_all_button().should_see_cleared_filters()
36
+
37
+
38
+ @pytest.mark.datasource_ui
39
+ @pytest.mark.ui
40
+ def test_datasource_sidebar_hiding_elements(page):
41
+ """Test sidebar filters hiding."""
42
+ datasource_page = DataSourcePage(page)
43
+
44
+ datasource_page.navigate_to()
45
+ datasource_page.sidebar.click_type_filter_hide_button().should_not_see_type_filters()
46
+ datasource_page.sidebar.click_project_filter_hide_button().should_not_see_project_filters()
47
+ datasource_page.sidebar.click_created_by_filter_hide_button().should_not_see_created_by_filters()
48
+ datasource_page.sidebar.click_status_filter_hide_button().should_not_see_status_filters()
49
+
50
+
51
+ @pytest.mark.datasource_ui
52
+ @pytest.mark.ui
53
+ def test_datasource_page_elements_visibility(page):
54
+ """Test DataSource index page and sidebar elements are visible."""
55
+ datasource_page = DataSourcePage(page)
56
+
57
+ datasource_page.navigate_to()
58
+ datasource_page.should_see_create_datasource_button()
59
+ datasource_page.should_see_table_rows(minimum_count=10)
60
+ datasource_page.should_see_table_column_names()
61
+ datasource_page.should_see_pagination()
@@ -0,0 +1,180 @@
1
+ import pytest
2
+ from tests import PROJECT, TEST_USER
3
+ from tests.test_data.google_datasource_test_data import GOOGLE_DOC_URL
4
+ from tests.ui._test_data.datasource_test_data import (
5
+ DataSourceStatus,
6
+ DataSourceFilterType,
7
+ UPDATE_SUBTITLE_DATASOURCE,
8
+ UPDATE_TITLE_DATASOURCE,
9
+ )
10
+ from tests.ui.pageobject.datasources.create_edit_datasource_page import (
11
+ CreateEditDatasourcePage,
12
+ )
13
+ from tests.ui.pageobject.datasources.datasource_page import DataSourcePage
14
+ from tests.utils.constants import FILES_PATH
15
+
16
+
17
+ @pytest.mark.datasource_ui
18
+ @pytest.mark.ui
19
+ def test_edit_git_datasource(
20
+ page, datasource_utils, git_integration, default_embedding_llm
21
+ ):
22
+ """Test that all main Edit Datasource page elements are visible."""
23
+ datasource_page = DataSourcePage(page)
24
+ edit_page = CreateEditDatasourcePage(page)
25
+
26
+ datasource = datasource_utils.create_gitlab_datasource(
27
+ setting_id=git_integration.id,
28
+ embeddings_model=default_embedding_llm.base_name,
29
+ )
30
+
31
+ datasource_page.navigate_to()
32
+ datasource_page.should_see_table_row_with_values(
33
+ name=datasource.name,
34
+ status=DataSourceStatus.COMPLETED,
35
+ project=PROJECT,
36
+ type_=DataSourceFilterType.CODE,
37
+ created_by=TEST_USER,
38
+ )
39
+
40
+ datasource_page.open_row_action_menu(datasource.name)
41
+ datasource_page.should_see_edit_dropdown_values()
42
+ datasource_page.should_see_edit_dropdown_full_reindex_value()
43
+ datasource_page.click_row_action("Edit")
44
+
45
+ edit_page.sidebar.should_see_title_subtitle(
46
+ UPDATE_TITLE_DATASOURCE, UPDATE_SUBTITLE_DATASOURCE
47
+ )
48
+ edit_page.selector.should_see_disabled_multiselect(PROJECT)
49
+ edit_page.should_see_disabled_name_input(datasource.name)
50
+ edit_page.should_see_save_reindex_button()
51
+
52
+
53
+ @pytest.mark.datasource_ui
54
+ @pytest.mark.ui
55
+ def test_edit_confluence_datasource(page, datasource_utils, confluence_integration):
56
+ """Test that all main Edit Datasource page elements are visible."""
57
+ datasource_page = DataSourcePage(page)
58
+ edit_page = CreateEditDatasourcePage(page)
59
+
60
+ datasource = datasource_utils.create_confluence_datasource(
61
+ setting_id=confluence_integration.id,
62
+ )
63
+
64
+ datasource_page.navigate_to()
65
+ datasource_page.should_see_table_row_with_values(
66
+ name=datasource.name,
67
+ status=DataSourceStatus.COMPLETED,
68
+ project=PROJECT,
69
+ type_=DataSourceFilterType.CONFLUENCE,
70
+ created_by=TEST_USER,
71
+ )
72
+
73
+ datasource_page.open_row_action_menu(datasource.name)
74
+ datasource_page.should_see_edit_dropdown_values()
75
+ datasource_page.should_see_edit_dropdown_full_reindex_value()
76
+ datasource_page.click_row_action("Edit")
77
+
78
+ edit_page.sidebar.should_see_title_subtitle(
79
+ UPDATE_TITLE_DATASOURCE, UPDATE_SUBTITLE_DATASOURCE
80
+ )
81
+ edit_page.selector.should_see_disabled_multiselect(PROJECT)
82
+ edit_page.should_see_disabled_name_input(datasource.name)
83
+ edit_page.should_see_save_reindex_button()
84
+
85
+
86
+ @pytest.mark.datasource_ui
87
+ @pytest.mark.ui
88
+ def test_edit_jira_datasource(page, datasource_utils, jira_integration):
89
+ """Test that all main Edit Datasource page elements are visible."""
90
+ datasource_page = DataSourcePage(page)
91
+ edit_page = CreateEditDatasourcePage(page)
92
+
93
+ datasource = datasource_utils.create_jira_datasource(
94
+ setting_id=jira_integration.id,
95
+ )
96
+
97
+ datasource_page.navigate_to()
98
+ datasource_page.should_see_table_row_with_values(
99
+ name=datasource.name,
100
+ status=DataSourceStatus.COMPLETED,
101
+ project=PROJECT,
102
+ type_=DataSourceFilterType.JIRA,
103
+ created_by=TEST_USER,
104
+ )
105
+
106
+ datasource_page.open_row_action_menu(datasource.name)
107
+ datasource_page.should_see_edit_dropdown_values()
108
+ datasource_page.should_see_edit_dropdown_index_values()
109
+ datasource_page.click_row_action("Edit")
110
+
111
+ edit_page.sidebar.should_see_title_subtitle(
112
+ UPDATE_TITLE_DATASOURCE, UPDATE_SUBTITLE_DATASOURCE
113
+ )
114
+ edit_page.selector.should_see_disabled_multiselect(PROJECT)
115
+ edit_page.should_see_disabled_name_input(datasource.name)
116
+ edit_page.should_see_save_reindex_button()
117
+
118
+
119
+ @pytest.mark.datasource_ui
120
+ @pytest.mark.ui
121
+ def test_edit_file_datasource(page, datasource_utils):
122
+ """Test that all main Edit Datasource page elements are visible."""
123
+ datasource_page = DataSourcePage(page)
124
+ edit_page = CreateEditDatasourcePage(page)
125
+
126
+ datasource = datasource_utils.create_file_datasource(
127
+ files=[str(FILES_PATH / "test.txt")],
128
+ )
129
+
130
+ datasource_page.navigate_to()
131
+ datasource_page.should_see_table_row_with_values(
132
+ name=datasource.name,
133
+ status=DataSourceStatus.COMPLETED,
134
+ project=PROJECT,
135
+ type_=DataSourceFilterType.FILE,
136
+ created_by=TEST_USER,
137
+ )
138
+
139
+ datasource_page.open_row_action_menu(datasource.name)
140
+ datasource_page.should_see_edit_dropdown_values()
141
+ datasource_page.click_row_action("Edit")
142
+
143
+ edit_page.sidebar.should_see_title_subtitle(
144
+ UPDATE_TITLE_DATASOURCE, UPDATE_SUBTITLE_DATASOURCE
145
+ )
146
+ edit_page.selector.should_see_disabled_multiselect(PROJECT)
147
+ edit_page.should_see_disabled_name_input(datasource.name)
148
+
149
+
150
+ @pytest.mark.datasource_ui
151
+ @pytest.mark.ui
152
+ def test_edit_google_datasource(page, datasource_utils):
153
+ """Test that all main Edit Datasource page elements are visible."""
154
+ datasource_page = DataSourcePage(page)
155
+ edit_page = CreateEditDatasourcePage(page)
156
+
157
+ datasource = datasource_utils.create_google_doc_datasource(
158
+ google_doc=GOOGLE_DOC_URL
159
+ )
160
+
161
+ datasource_page.navigate_to()
162
+ datasource_page.should_see_table_row_with_values(
163
+ name=datasource.name,
164
+ status=DataSourceStatus.COMPLETED,
165
+ project=PROJECT,
166
+ type_=DataSourceFilterType.GOOGLE,
167
+ created_by=TEST_USER,
168
+ )
169
+
170
+ datasource_page.open_row_action_menu(datasource.name)
171
+ datasource_page.should_see_edit_dropdown_values()
172
+ datasource_page.should_see_edit_dropdown_full_reindex_value()
173
+ datasource_page.click_row_action("Edit")
174
+
175
+ edit_page.sidebar.should_see_title_subtitle(
176
+ UPDATE_TITLE_DATASOURCE, UPDATE_SUBTITLE_DATASOURCE
177
+ )
178
+ edit_page.selector.should_see_disabled_multiselect(PROJECT)
179
+ edit_page.should_see_disabled_name_input(datasource.name)
180
+ edit_page.should_see_save_reindex_button()