@@ -45,7 +45,8 @@ def validate_repo_content(repo, content_types, after_sync=True):
4545 )
4646
4747
48- def test_positive_end_to_end (session , module_org , target_sat ):
48+ @pytest .mark .e2e
49+ def test_positive_end_to_end (module_org , module_target_sat ):
4950 """Perform end to end scenario for sync plan component
5051
5152 :id: 39c140a6-ca65-4b6a-a640-4a023a2f0f12
@@ -59,9 +60,8 @@ def test_positive_end_to_end(session, module_org, target_sat):
5960 plan_name = gen_string ('alpha' )
6061 description = gen_string ('alpha' )
6162 new_description = gen_string ('alpha' )
62- with session :
63- # workaround: force session.browser to point to browser object on next line
64- session .contenthost .read_all ('current_user' )
63+ with module_target_sat .ui_session () as session :
64+ session .organization .select (module_org .name )
6565 startdate = session .browser .get_client_datetime () + timedelta (minutes = 10 )
6666 # Create new sync plan and check all values in entity that was created
6767 session .syncplan .create (
@@ -88,8 +88,8 @@ def test_positive_end_to_end(session, module_org, target_sat):
8888 assert syncplan_values ['details' ]['description' ] == new_description
8989 # Create and add two products to sync plan
9090 for _ in range (2 ):
91- product = target_sat .api .Product (organization = module_org ).create ()
92- target_sat .api .Repository (product = product ).create ()
91+ product = module_target_sat .api .Product (organization = module_org ).create ()
92+ module_target_sat .api .Repository (product = product ).create ()
9393 session .syncplan .add_product (plan_name , product .name )
9494 # Remove a product and assert syncplan still searchable
9595 session .syncplan .remove_product (plan_name , product .name )
@@ -99,7 +99,7 @@ def test_positive_end_to_end(session, module_org, target_sat):
9999 assert plan_name not in session .syncplan .search (plan_name )
100100
101101
102- def test_positive_end_to_end_custom_cron (session ):
102+ def test_positive_end_to_end_custom_cron (module_org , module_target_sat ):
103103 """Perform end to end scenario for sync plan component with custom cron
104104
105105 :id: 48c88529-6318-47b0-97bc-eb46aae0294a
@@ -109,9 +109,8 @@ def test_positive_end_to_end_custom_cron(session):
109109 plan_name = gen_string ('alpha' )
110110 description = gen_string ('alpha' )
111111 cron_expression = gen_choice (valid_cron_expressions ())
112- with session :
113- # workaround: force session.browser to point to browser object on next line
114- session .contenthost .read_all ('current_user' )
112+ with module_target_sat .ui_session () as session :
113+ session .organization .select (module_org .name )
115114 startdate = session .browser .get_client_datetime () + timedelta (minutes = 10 )
116115 # Create new sync plan and check all values in entity that was created
117116 session .syncplan .create (
@@ -176,7 +175,7 @@ def test_positive_search_scoped(session, request, target_sat):
176175
177176
178177@pytest .mark .e2e
179- def test_positive_synchronize_custom_product_custom_cron_real_time (session , module_org , target_sat ):
178+ def test_positive_synchronize_custom_product_custom_cron_real_time (module_org , module_target_sat ):
180179 """Create a sync plan with real datetime as a sync date,
181180 add a custom product and verify the product gets synchronized
182181 on the next sync occurrence based on custom cron interval
@@ -186,11 +185,10 @@ def test_positive_synchronize_custom_product_custom_cron_real_time(session, modu
186185 :expectedresults: Product is synchronized successfully.
187186 """
188187 plan_name = gen_string ('alpha' )
189- product = target_sat .api .Product (organization = module_org ).create ()
190- repo = target_sat .api .Repository (product = product ).create ()
191- with session :
192- # workaround: force session.browser to point to browser object on next line
193- session .contenthost .read_all ('current_user' )
188+ product = module_target_sat .api .Product (organization = module_org ).create ()
189+ repo = module_target_sat .api .Repository (product = product ).create ()
190+ with module_target_sat .ui_session () as session :
191+ session .organization .select (module_org .name )
194192 start_date = session .browser .get_client_datetime ()
195193 # forming cron expression sync repo after 5 min
196194 expected_next_run_time = start_date + timedelta (minutes = 5 )
@@ -210,7 +208,7 @@ def test_positive_synchronize_custom_product_custom_cron_real_time(session, modu
210208 session .syncplan .add_product (plan_name , product .name )
211209 # check that product was not synced
212210 with pytest .raises (AssertionError ) as context :
213- target_sat .wait_for_tasks (
211+ module_target_sat .wait_for_tasks (
214212 search_query = 'Actions::Katello::Repository::Sync'
215213 f' and organization_id = { module_org .id } '
216214 f' and resource_id = { repo .id } '
@@ -221,7 +219,7 @@ def test_positive_synchronize_custom_product_custom_cron_real_time(session, modu
221219 assert 'No task was found using query' in str (context .value )
222220 validate_repo_content (repo , ['erratum' , 'rpm' , 'package_group' ], after_sync = False )
223221 # Waiting part of delay that is left and check that product was synced
224- target_sat .wait_for_tasks (
222+ module_target_sat .wait_for_tasks (
225223 search_query = 'Actions::Katello::Repository::Sync'
226224 f' and organization_id = { module_org .id } '
227225 f' and resource_id = { repo .id } '
@@ -239,7 +237,7 @@ def test_positive_synchronize_custom_product_custom_cron_real_time(session, modu
239237
240238
241239def test_positive_synchronize_custom_product_custom_cron_past_sync_date (
242- session , module_org , target_sat
240+ module_org , module_target_sat
243241):
244242 """Create a sync plan with past datetime as a sync date,
245243 add a custom product and verify the product gets synchronized
@@ -250,11 +248,10 @@ def test_positive_synchronize_custom_product_custom_cron_past_sync_date(
250248 :expectedresults: Product is synchronized successfully.
251249 """
252250 plan_name = gen_string ('alpha' )
253- product = target_sat .api .Product (organization = module_org ).create ()
254- repo = target_sat .api .Repository (product = product ).create ()
255- with session :
256- # workaround: force session.browser to point to browser object on next line
257- session .contenthost .read_all ('current_user' )
251+ product = module_target_sat .api .Product (organization = module_org ).create ()
252+ repo = module_target_sat .api .Repository (product = product ).create ()
253+ with module_target_sat .ui_session () as session :
254+ session .organization .select (module_org .name )
258255 start_date = session .browser .get_client_datetime ()
259256 # forming cron expression sync repo after 5 min
260257 expected_next_run_time = start_date + timedelta (minutes = 5 )
@@ -274,7 +271,7 @@ def test_positive_synchronize_custom_product_custom_cron_past_sync_date(
274271 session .syncplan .add_product (plan_name , product .name )
275272 # check that product was not synced
276273 with pytest .raises (AssertionError ) as context :
277- target_sat .wait_for_tasks (
274+ module_target_sat .wait_for_tasks (
278275 search_query = 'Actions::Katello::Repository::Sync'
279276 f' and organization_id = { module_org .id } '
280277 f' and resource_id = { repo .id } '
@@ -285,7 +282,7 @@ def test_positive_synchronize_custom_product_custom_cron_past_sync_date(
285282 assert 'No task was found using query' in str (context .value )
286283 validate_repo_content (repo , ['erratum' , 'rpm' , 'package_group' ], after_sync = False )
287284 # Waiting part of delay that is left and check that product was synced
288- target_sat .wait_for_tasks (
285+ module_target_sat .wait_for_tasks (
289286 search_query = 'Actions::Katello::Repository::Sync'
290287 f' and organization_id = { module_org .id } '
291288 f' and resource_id = { repo .id } '
0 commit comments