cucu 1.2.0__py3-none-any.whl → 1.2.1__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 cucu might be problematic. Click here for more details.

cucu/browser/selenium.py CHANGED
@@ -215,7 +215,6 @@ class Selenium(Browser):
215
215
 
216
216
  if window_handle_index == len(window_handles) - 1:
217
217
  raise RuntimeError("no next browser tab available")
218
-
219
218
  self.driver.switch_to.window(window_handles[window_handle_index + 1])
220
219
 
221
220
  def switch_to_previous_tab(self):
@@ -225,7 +224,6 @@ class Selenium(Browser):
225
224
 
226
225
  if window_handle_index == 0:
227
226
  raise RuntimeError("no previous browser tab available")
228
-
229
227
  self.driver.switch_to.window(window_handles[window_handle_index - 1])
230
228
 
231
229
  def back(self):
cucu/environment.py CHANGED
@@ -10,7 +10,7 @@ from functools import partial
10
10
  from cucu import config, init_scenario_hook_variables, logger
11
11
  from cucu.config import CONFIG
12
12
  from cucu.page_checks import init_page_checks
13
- from cucu.utils import ellipsize_filename, take_screenshot
13
+ from cucu.utils import ellipsize_filename, get_tab_information, take_screenshot
14
14
 
15
15
  CONFIG.define(
16
16
  "FEATURE_RESULTS_DIR",
@@ -24,7 +24,7 @@ CONFIG.define(
24
24
  )
25
25
  CONFIG.define(
26
26
  "SCENARIO_DOWNLOADS_DIR",
27
- "the browser downloads directory for the currently " "executing scenario",
27
+ "the browser downloads directory for the currently executing scenario",
28
28
  default=None,
29
29
  )
30
30
 
@@ -264,6 +264,21 @@ def after_step(ctx, step):
264
264
  if ctx.browser is not None and ctx.current_step.has_substeps is False:
265
265
  take_screenshot(ctx, step.name, label=f"After {step.name}")
266
266
 
267
+ tab_info = get_tab_information(ctx)
268
+ total_tabs = tab_info["window_count"]
269
+ current_tab = tab_info["current_index"] + 1
270
+ title = tab_info["current_title"]
271
+ url = tab_info["current_url"]
272
+ log_message = (
273
+ f"\ntab({current_tab} of {total_tabs}): {title}\nurl: {url}\n"
274
+ )
275
+ logger.debug(log_message)
276
+
277
+ # Add tab info to step.stdout so it shows up in the HTML report
278
+ step.stdout += (
279
+ f"\ntab({current_tab} of {total_tabs}): {title}\nurl: {url}\n"
280
+ )
281
+
267
282
  # if the step has substeps from using `run_steps` then we already moved
268
283
  # the step index in the run_steps method and shouldn't do it here
269
284
  if not step.has_substeps:
cucu/utils.py CHANGED
@@ -271,3 +271,16 @@ def take_screenshot(ctx, step_name, label="", element=None):
271
271
  shutil.copyfile(filepath, CONFIG["CUCU_MONITOR_PNG"])
272
272
 
273
273
  CONFIG["__STEP_SCREENSHOT_COUNT"] += 1
274
+
275
+
276
+ def get_tab_information(ctx):
277
+ driver = ctx.browser.driver
278
+ window_handles = driver.window_handles
279
+ current_window = driver.current_window_handle
280
+ window_handle_index = window_handles.index(current_window)
281
+ return {
282
+ "window_count": len(window_handles),
283
+ "current_index": window_handle_index,
284
+ "current_title": driver.title,
285
+ "current_url": driver.current_url,
286
+ }
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: cucu
3
- Version: 1.2.0
3
+ Version: 1.2.1
4
4
  Summary: Easy BDD web testing
5
5
  Project-URL: Homepage, https://github.com/dominodatalab/cucu/wiki
6
6
  Project-URL: Download, https://pypi.org/project/cucu/
@@ -2,16 +2,16 @@ cucu/__init__.py,sha256=YtuajsJBj3_DgNoygHen9gKojeQF523Oc27kyCUzoG0,1013
2
2
  cucu/ansi_parser.py,sha256=_yTlqr6KruLsqgWR6BkpJUC3bmlQy_9JbkuxFx6Jrbo,2213
3
3
  cucu/behave_tweaks.py,sha256=MqIL9BDHMvmyXyzkVGbD3wd8IP38_8pgp3NPGDWudm8,6873
4
4
  cucu/config.py,sha256=12SXNtBSnD3N6K9DnCDYHZDA4_Wrh4g7whdgHDKSuPw,14022
5
- cucu/environment.py,sha256=n5FyAq2T8t_dl1YdM38Wdp6yx9h0bL0pHyP5mAlhl00,9429
5
+ cucu/environment.py,sha256=Glhs2Gq2YGHYaIbhozljZse9Q2QkXK0jzPxnychBLGU,9996
6
6
  cucu/helpers.py,sha256=l_YMmbuXjtBRo-MER-qe6soUIyjt0ey2BoSgWs4zYwA,36285
7
7
  cucu/hooks.py,sha256=3Z1mavU42XMQ0DZ7lVWwTB-BJYHRyYUOzzOtmkdIsow,7117
8
8
  cucu/logger.py,sha256=Y4eHmNFCphqXEzUQD-DJ8dsaqTNtqxmaKSCdo66Oc-g,3349
9
9
  cucu/page_checks.py,sha256=CW1AqIxZ7rrLxpkf8nEFwcw6amnoN3Tb-acoN8dq3g0,2179
10
- cucu/utils.py,sha256=608b28WVWgzmFMAMLXpFWeXe3NjRZEhpEfcTnYy2JRM,8611
10
+ cucu/utils.py,sha256=gLeVT9Vo7rBwCXMVUzhhex854NjCFy05rUDDGG23mqY,9023
11
11
  cucu/browser/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
12
12
  cucu/browser/core.py,sha256=YAHhj6AMf7kpZR57thQaPHVHVHwnMBzCI0yofIYtfaY,2355
13
13
  cucu/browser/frames.py,sha256=IW7kzRJn5PkbMaovIelAeCWO-T-2sOTwqaYBw-0-LKU,3545
14
- cucu/browser/selenium.py,sha256=IOLzSyxNDUxEccc10qXV8hf817hNgUBRCHz1PbCEKhs,11605
14
+ cucu/browser/selenium.py,sha256=oyXnf8jNPX3EqvaFYDhZuxoxGnK8cw__7CxMZTG1hfU,11603
15
15
  cucu/browser/selenium_tweaks.py,sha256=oUIhWVhBZbc9qsmQUJMpIr9uUWKxtgZBcnySWU6Yttk,879
16
16
  cucu/cli/__init__.py,sha256=uXX5yVG1konJ_INdlrcfMg-Tt_5_cSx29Ed8R8v908A,62
17
17
  cucu/cli/core.py,sha256=Lh6kRFuzQkuPo01oYfZNedn6PM4F4p1qtUKgDwh4K1I,25334
@@ -86,8 +86,8 @@ cucu/steps/tables.js,sha256=Os2a7Fo-cg03XVli7USvcnBVad4N7idXr-HBuzdLvVQ,945
86
86
  cucu/steps/text_steps.py,sha256=Jj_GHoHeemNwVdUOdqcehArNp7WM-WMjljA4w0pLXuw,2576
87
87
  cucu/steps/variable_steps.py,sha256=WSctH3_xcxjijGPYZlxp-foC_SIAAKtF__saNtgZJbk,2966
88
88
  cucu/steps/webserver_steps.py,sha256=wWkpSvcSMdiskPkh4cqlepWx1nkvEpTU2tRXQmPDbyo,1410
89
- cucu-1.2.0.dist-info/METADATA,sha256=NT6AMiexib9zaO0UZUlDeWRJPgE1jMRP2kV7hIPMuuM,16535
90
- cucu-1.2.0.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
91
- cucu-1.2.0.dist-info/entry_points.txt,sha256=YEXTyEfIZbcV0GJ9R3Gfu3j6DcOJJK7_XHkJqE3Yiao,39
92
- cucu-1.2.0.dist-info/licenses/LICENSE,sha256=WfgJYF9EaQoL_OeWr2Qd0MxhhFegDfzWSUmvDTwFxis,1721
93
- cucu-1.2.0.dist-info/RECORD,,
89
+ cucu-1.2.1.dist-info/METADATA,sha256=TdZuQu4Kz2AroxSSPxfqB9HKatZpOYm1XRC_OA2qVPs,16535
90
+ cucu-1.2.1.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
91
+ cucu-1.2.1.dist-info/entry_points.txt,sha256=YEXTyEfIZbcV0GJ9R3Gfu3j6DcOJJK7_XHkJqE3Yiao,39
92
+ cucu-1.2.1.dist-info/licenses/LICENSE,sha256=WfgJYF9EaQoL_OeWr2Qd0MxhhFegDfzWSUmvDTwFxis,1721
93
+ cucu-1.2.1.dist-info/RECORD,,
File without changes