22import uuid
33from copy import copy
44from datetime import datetime
5- from typing import Optional , Text
5+ from typing import Optional , Text , Union
66
77import attr
8+
89from applitools .common .geometry import RectangleSize
910from applitools .common .match import ImageMatchSettings , MatchLevel
1011from applitools .common .server import FailureReports , SessionType
11- from applitools .common .utils import general_utils , argument_guard
12+ from applitools .common .utils import argument_guard , general_utils
1213from applitools .common .utils .json_utils import JsonInclude
1314
1415__all__ = ("BatchInfo" , "Configuration" )
@@ -28,28 +29,21 @@ class BatchInfo(object):
2829 factory = lambda : os .environ .get ("APPLITOOLS_BATCH_NAME" ),
2930 metadata = {JsonInclude .THIS : True },
3031 ) # type: Optional[Text]
32+ started_at = attr .ib (
33+ factory = lambda : datetime .now (general_utils .UTC ),
34+ metadata = {JsonInclude .THIS : True },
35+ ) # type: Union[datetime, Text]
3136 sequence_name = attr .ib (
37+ init = False ,
3238 factory = lambda : os .environ .get ("APPLITOOLS_BATCH_SEQUENCE" ),
3339 metadata = {JsonInclude .NAME : "batchSequenceName" },
3440 ) # type: Optional[Text]
35- started_at = attr .ib (
36- factory = lambda : datetime .now (general_utils .UTC ),
37- metadata = {JsonInclude .THIS : True },
38- ) # # type: Text
3941 id = attr .ib (
42+ init = False ,
4043 factory = lambda : os .environ .get ("APPLITOOLS_BATCH_ID" , str (uuid .uuid4 ())),
4144 metadata = {JsonInclude .THIS : True },
4245 ) # type: Text
4346
44- @property
45- def id_ (self ):
46- # TODO: Remove in this way of initialization in future
47- return self .id
48-
49- @id_ .setter
50- def id_ (self , value ):
51- self .id = value
52-
5347 def with_batch_id (self , id ):
5448 argument_guard .not_none (id )
5549 self .id = id
@@ -94,7 +88,7 @@ class Configuration(object):
9488 save_failed_tests = attr .ib (default = False )
9589 fail_on_new_test = attr .ib (default = False )
9690 failure_reports = attr .ib (default = FailureReports .ON_CLOSE )
97- send_dom = attr .ib (default = False )
91+ send_dom = attr .ib (default = True )
9892 use_dom = attr .ib (default = False )
9993 enable_patterns = attr .ib (default = False )
10094 default_match_settings = attr .ib (default = ImageMatchSettings ())
0 commit comments