qase-python-commons 3.1.8__py3-none-any.whl → 3.1.9__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.
@@ -8,6 +8,7 @@ from .. import Logger
8
8
  from .base_api_client import BaseApiClient
9
9
  from ..exceptions.reporter import ReporterException
10
10
  from ..models import Attachment, Result, Step
11
+ from ..models.config.framework import Video, Trace
11
12
  from ..models.config.qaseconfig import QaseConfig
12
13
  from ..models.step import StepType
13
14
 
@@ -137,6 +138,8 @@ class ApiV1Client(BaseApiClient):
137
138
  attached = []
138
139
  if result.attachments:
139
140
  for attachment in result.attachments:
141
+ if self.__should_skip_attachment(attachment, result):
142
+ continue
140
143
  attach_id = self._upload_attachment(project_code, attachment)
141
144
  if attach_id:
142
145
  attached.extend(attach_id)
@@ -278,3 +281,14 @@ class ApiV1Client(BaseApiClient):
278
281
  self.__authors[author] = authors.result.entities[0].author_id
279
282
 
280
283
  return authors.result.entities[0].author_id
284
+
285
+ def __should_skip_attachment(self, attachment, result):
286
+ if (self.config.framework.playwright.video == Video.failed and
287
+ result.execution.status != 'failed' and
288
+ attachment.file_name == 'video.webm'):
289
+ return True
290
+ if (self.config.framework.playwright.trace == Trace.failed and
291
+ result.execution.status != 'failed' and
292
+ attachment.file_name == 'trace.zip'):
293
+ return True
294
+ return False
@@ -1,7 +1,22 @@
1
+ from enum import Enum
2
+ from typing import Type, Union
3
+
1
4
  from ..basemodel import BaseModel
2
5
  from ... import QaseUtils
3
6
 
4
7
 
8
+ class Video(Enum):
9
+ off = "off"
10
+ on = "on"
11
+ failed = "retain-on-failure"
12
+
13
+
14
+ class Trace(Enum):
15
+ off = "off"
16
+ on = "on"
17
+ failed = "retain-on-failure"
18
+
19
+
5
20
  class PytestConfig(BaseModel):
6
21
  capture_logs: bool = None
7
22
 
@@ -12,8 +27,37 @@ class PytestConfig(BaseModel):
12
27
  self.capture_logs = QaseUtils.parse_bool(capture_logs)
13
28
 
14
29
 
30
+ class PlaywrightConfig(BaseModel):
31
+ output_dir: str = None
32
+ video: Video = None
33
+ trace: Trace = None
34
+
35
+ def __init__(self):
36
+ self.output_dir = "test-results"
37
+ self.video = Video.off
38
+ self.trace = Trace.off
39
+
40
+ def set_output_dir(self, output_dir: str):
41
+ self.output_dir = output_dir
42
+
43
+ def set_video(self, value: str):
44
+ self.video = self.__set_mode(Video, value)
45
+
46
+ def set_trace(self, value: str):
47
+ self.trace = self.__set_mode(Trace, value)
48
+
49
+ @staticmethod
50
+ def __set_mode(enum_class: Type[Union[Video, Trace]], value: str):
51
+ for mode in enum_class:
52
+ if mode.value == value:
53
+ return mode
54
+ return None
55
+
56
+
15
57
  class Framework(BaseModel):
16
58
  pytest: PytestConfig = None
59
+ playwright: PlaywrightConfig = None
17
60
 
18
61
  def __init__(self):
19
62
  self.pytest = PytestConfig()
63
+ self.playwright = PlaywrightConfig()
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: qase-python-commons
3
- Version: 3.1.8
3
+ Version: 3.1.9
4
4
  Summary: A library for Qase TestOps and Qase Report
5
5
  Author-email: Qase Team <support@qase.io>
6
6
  Project-URL: Homepage, https://github.com/qase-tms/qase-python/tree/master/qase-python-commons
@@ -3,7 +3,7 @@ qase/commons/config.py,sha256=meRRgDrsA9qQ9fZR4fnP0VdngrKiGcHF9nnJkf3eJpg,8320
3
3
  qase/commons/loader.py,sha256=-MMY4HgSI6q1xq3NaJoq_w4liM73qdFKjYLVCT1E7Pc,1064
4
4
  qase/commons/logger.py,sha256=ka5chQYBXLUB5pM4YHDBo3QCZfBTGMtC3H33tI4NbPQ,1027
5
5
  qase/commons/utils.py,sha256=OOr6kQ5hPZEyHXwbwiTOTkonRxmmtkyZPPGqXQKp5vY,2799
6
- qase/commons/client/api_v1_client.py,sha256=t93-wqb9Rxgsvsk49toRZPeaTtBUVWsDk-UQ8gpy9pU,11880
6
+ qase/commons/client/api_v1_client.py,sha256=jG5rR3yQobn-Vt42z21srXjiZ1OF0ExO0JeBOp6JLiw,12523
7
7
  qase/commons/client/api_v2_client.py,sha256=F3wU_2EKe6eUjNRahvnDmpbx99PwZB6Lxc4VPRj7w58,7247
8
8
  qase/commons/client/base_api_client.py,sha256=H8JnjqSrBFNfghDd3T3zxYOyKYHYe9QiJQXol1JqdQk,2613
9
9
  qase/commons/exceptions/reporter.py,sha256=dP-Mwcq8HKBOjgu3YqhyULDmDGU09BmT6Fh9HjICaUc,45
@@ -19,7 +19,7 @@ qase/commons/models/suite.py,sha256=Z2tlxdeIsuzjIoPnuyVq23pt59Yt6LVmofcew5Njk_s,
19
19
  qase/commons/models/config/api.py,sha256=IyYY2f3ncESUAEGvkE3-meatebBFJdvgo7KNOQnxLE0,288
20
20
  qase/commons/models/config/batch.py,sha256=X0H8SVOCCD2pV6LSMqjI-tIjRcLifnrM5MareK2FhQw,321
21
21
  qase/commons/models/config/connection.py,sha256=wK2fGjc0G0rMVVhPnjw_t_M1YWZwANlhwl-awmI7XSo,516
22
- qase/commons/models/config/framework.py,sha256=upGHFwmJ-i-VA_OLPgJiwgJRjB7vusuk-dhJMhgdYDM,416
22
+ qase/commons/models/config/framework.py,sha256=N4vSS1EAu8LEzYSbpy3Z4rNY2DbpWQ4Mh1mknRfMDRM,1432
23
23
  qase/commons/models/config/plan.py,sha256=JbAY7qfGXYreXOLa32OLxw6z0paeCCf87-2b1m8xkks,137
24
24
  qase/commons/models/config/qaseconfig.py,sha256=-tuTsd6s4YSAkSca7vvNaFZbqhbWkxuw-mjeqhwmjlc,1722
25
25
  qase/commons/models/config/report.py,sha256=g3Z2B3Tewaasjc1TMj2mkXxz0Zc1C39sHeTXH0MRM2Y,497
@@ -34,7 +34,7 @@ qase/commons/reporters/core.py,sha256=0x5G-KVfEOWyXiXaX5__7JBIr3Rxy8vhy0cByUSZUc
34
34
  qase/commons/reporters/report.py,sha256=MPsFv3k2l4652NyXEGFiSmwsSpwZT3Is-lLRXvsniz4,4606
35
35
  qase/commons/reporters/testops.py,sha256=f5BcorFwIK5BSeA4Rv4IKDddkWrAXL_w-Y5Xn--NdYs,6264
36
36
  qase/commons/validators/base.py,sha256=wwSn-4YiuXtfGMGnSKgo9Vm5hAKevVmmfd2Ro6Q7MYQ,173
37
- qase_python_commons-3.1.8.dist-info/METADATA,sha256=6lr1O9vlI3BDkCu9ekgNJ9HqC0Yxl0Cj3PMTMYJ1Tog,1859
38
- qase_python_commons-3.1.8.dist-info/WHEEL,sha256=GV9aMThwP_4oNCtvEC2ec3qUYutgWeAzklro_0m4WJQ,91
39
- qase_python_commons-3.1.8.dist-info/top_level.txt,sha256=Mn5aFk7H7Uia4s1NRDsvebu8vCrFy9nOuRIBfkIY5kQ,5
40
- qase_python_commons-3.1.8.dist-info/RECORD,,
37
+ qase_python_commons-3.1.9.dist-info/METADATA,sha256=5y52aBktDH7Yzj9l8Vb4TRDah9Dscbuf9xrc7nsEkJk,1859
38
+ qase_python_commons-3.1.9.dist-info/WHEEL,sha256=GV9aMThwP_4oNCtvEC2ec3qUYutgWeAzklro_0m4WJQ,91
39
+ qase_python_commons-3.1.9.dist-info/top_level.txt,sha256=Mn5aFk7H7Uia4s1NRDsvebu8vCrFy9nOuRIBfkIY5kQ,5
40
+ qase_python_commons-3.1.9.dist-info/RECORD,,