
    5                        S r SSKJr  SSKJr  SSKJr  SSKJr  SSKJr  SSKJr  SSKJ	r	  SS	KJ
r
  SS
KJr  SSKJr  SSKJr  SSKJr  SSKJr  SSKJr  SSKJr  SSKJr  SSKrSr\R0                  \R2                  " \R4                  R6                  5       " S S\R8                  5      5       5       rS r\R2                  " \R4                  R>                  \R4                  R@                  5       " S S\5      5       r!g)z+The 'gcloud firebase test ios run' command.    )absolute_import)division)unicode_literals)arg_util)ctrl_c_handler	exit_code)history_picker)
matrix_ops)results_bucket)results_summary)tool_results)util)arg_manager)matrix_creator)base)logNzapplication/octet-streamc                   8    \ rS rSrSrSSS.r\S 5       rS rSr	g	)
Run'   AInvoke a test in Firebase Test Lab for iOS and view test results.a            *{command}* invokes and monitors tests in Firebase Test Lab for iOS.

          The currently supported iOS test frameworks are XCTest and XCUITest.
          Other iOS testing frameworks which are built upon XCTest and XCUITest
          should also work.

          The XCTEST_ZIP test package is a zip file built using Apple's Xcode
          and supporting tools. For a detailed description of the process to
          create your XCTEST_ZIP file, see
          https://firebase.google.com/docs/test-lab/ios/command-line.

          All arguments for *{command}* may be specified on the command line
          and/or within an argument file. Run *$ gcloud topic arg-files* for
          more information about argument files.
          a            To invoke an XCTest lasting up to five minutes against the default
          device environment, run:

            $ {command} --test=XCTEST_ZIP --timeout=5m

          To invoke an XCTest against an iPad 5 running iOS 11.2, run:

            $ {command} --test=XCTEST_ZIP --device=model=ipad5,version=11.2

          To run your tests against multiple iOS devices simultaneously, specify
          the *--device* flag more than once:

            $ {command} --test=XCTEST_ZIP --device=model=iphone7 --device=model=ipadmini4,version=11.2 --device=model=iphonese

          To run your XCTest using a specific version of Xcode, say 9.4.1, run:

            $ {command} --test=XCTEST_ZIP --xcode-version=9.4.1

          To help you identify and locate your test matrix in the Firebase
          console, run:

            $ {command} --test=XCTEST_ZIP --client-details=matrixLabel="Example matrix label"

          All test arguments for a given test may alternatively be stored in an
          argument group within a YAML-formatted argument file. The _ARG_FILE_
          may contain one or more named argument groups, and argument groups may
          be combined using the `include:` attribute (Run *$ gcloud topic
          arg-files* for more information). The ARG_FILE can easily be shared
          with colleagues or placed under source control to ensure consistent
          test executions.

          To run a test using arguments loaded from an ARG_FILE named
          *excelsior_app_args*, which contains an argument group named
          *ios-args:*, use the following syntax:

            $ {command} path/to/excelsior_app_args:ios-args
          DESCRIPTIONEXAMPLESc                     [         R                  " U 5        [         R                  " U 5        [        R                  R                  U 5        U R                  R                  [        R                  5        g)zMethod called by Calliope to register flags for this command.

Args:
  parser: An argparse parser used to add arguments that follow this command
    in the CLI. Positional arguments are allowed.
N)
r   AddCommonTestRunArgsAddIosTestArgsr   URI_FLAGRemoveFromParserdisplay_info	AddFormatr   OUTCOMES_FORMAT)parsers    $lib/surface/firebase/test/ios/run.pyArgsRun.Argse   sL     !!&)F#MM""6*
!!$"6"67    c           
      	   UR                   (       a  UR                  S5      (       d  SUl        [        R                  R                  S5        [        R                  " 5       R                  U5        [        R                  " 5       nU R                  S   nU R                  S   nU R                  S   n[        R                  " X!R                  UR                  UXE5      nUR                  (       a   UR!                  UR                  ["        5        UR$                  (       a  UR!                  UR$                  S5        UR&                  (       a  UR!                  UR&                  S5        [)        US	S
5      =(       d    / nU H  nUR!                  U["        5        M     [)        US0 5      =(       d    0 n	[*        R,                  " U	5       HH  u  pU
nSU;   a  XR/                  S5      S-   S
 nUR!                  US
[        R0                  " U5      S9  MJ     [)        USS
5      (       a  UR!                  UR2                  S5        UR5                  5         [6        R8                  " X#U5      n[;        U5      nUR=                  U5      n[>        R@                  " XR                  UURB                  [*        RD                  " U RG                  5       5      5      n[H        RJ                  " URL                  URN                  U R                  5      n[P        RR                  " U5         URU                  U5      n[V        RX                  " UU5      n[V        RZ                  " UU5      n[        R                  R                  S5        UR                   (       a  UsS
S
S
5        $ [        R                  R                  SR                  U5      5        []        U5      S:X  a/  UR^                  S:X  a  URa                  US   Rb                  5        OURe                  5         S
S
S
5        [        R                  R                  SR                  W5      5        [f        Rh                  " X#UWURL                  5      n[j        Rl                  " URo                  5       URp                  Rr                  5      U l5        URu                  5       $ ! , (       d  f       N= f)a}  Run the 'firebase test ios run' command to invoke a test in Test Lab.

Args:
  args: an argparse namespace. All the arguments that were provided to this
    command invocation (i.e. group and command arguments combined).

Returns:
  One of:
    - a list of TestOutcome tuples (if ToolResults are available).
    - a URL string pointing to the user's results in ToolResults or GCS.
formatzW
          value(format('Final test results will be available at [ {0} ].', []))
      z]
Have questions, feedback, or issues? Get support by emailing:
  ftl-ios-feedback@google.com
toolresults_clienttoolresults_messagesstorage_clientzapplication/zipztext/xmladditional_ipasNother_files:   )destination_objectrobo_scriptzapplication/json z)Test results will be streamed to [ {0} ].r   z'
More details are available at [ {0} ].);async_IsSpecifiedr)   r   statusPrintr   IosArgsManagerPreparer   
GetProjectcontextr   ResultsBucketOpsresults_dirappUploadFileToGcs_IPA_MIME_TYPEtestxctestrun_filegetattrsix	iteritemsfindGetRelativeDevicePathr2   LogGcsResultsUrlr
   ToolResultsHistoryPickerPickHistoryNameGetToolResultsHistoryIdr   CreateMatrixgcs_results_root	text_typeReleaseTrackr   MatrixMonitortestMatrixIdtyper   CancellableTestSectionHandleUnsupportedExecutionsr   GetToolResultsIdsCreateToolResultsUiUrllennum_flaky_test_attemptsMonitorTestExecutionProgressidMonitorTestMatrixProgressr   ToolResultsSummaryFetcherr	   ExitCodeFromRollupOutcomeFetchMatrixRollupOutcomeOutcomeSummaryValueValuesEnum+CreateMatrixOutcomeSummaryUsingEnvironments)selfargsproject	tr_clienttr_messagesr,   
bucket_opsr-   additional_ipar.   device_pathfile_to_uploadpathtr_history_pickerhistory_name
history_idmatrixmonitorsupported_executionstr_idsurlsummary_fetchers                         r$   r   Run.Runr   s    {{4++H55
dk JJ B C  ((.ooG12I,,56K\\"23N00:M:M151A1A91<NJ xx  >:yy  ,=>  !4!4jAd$5t<BO)  @ *$r28bK'*}}['A#d	IIcNQ&'(  

!77= ! ?	 (B t]D))  !1!13EF!&??K)"4(L"::<HJ((||Z)3)D)D),t7H7H7J)KMF &&v':':DII'+||5G 
	.	.w	7$@@H--fg>f//@c	jjr	 
8	7 
jjBII#NO 
!	"a	'D,H,HA,M,,-A!-D-G-GH))+ 
8  JJ?FFsKL &??K1D1DFO88002224DN FFHH1 
8	7s   %A1S A<S
Sr   N)
__name__
__module____qualname____firstlineno____doc__detailed_helpstaticmethodr%   r   __static_attributes__ r'   r$   r   r   '   s5     J %#7-r 
8 
8WIr'   r   c                 >    U R                   (       a  U R                   $ g)aC  Returns the results history name to use to look up a history ID.

The history ID corresponds to a history name. If the user provides their own
history name, we use that to look up the history ID; Otherwise, we punt and
let the Testing service determine the appropriate history ID to publish to.

Args:
  args: an argparse namespace. All the arguments that were provided to the
    command invocation (i.e. group and command arguments combined).

Returns:
  Either a string containing a history name derived from user-supplied data,
  or None if we lack the required information.
N)results_history_name)rc   s    r$   rJ   rJ      s     
$$$	r'   c                   @   ^  \ rS rSrSrSSS.r\U 4S j5       rSrU =r	$ )RunBeta   r   a            *{command}* invokes and monitors tests in Firebase Test Lab for iOS.

          Two types of iOS tests are currently supported:
          - *xctest*: corresponds to the XCTest and XCUITest frameworks. Other
            iOS testing frameworks which are built upon XCTest and XCUITest
            should also work. The XCTEST_ZIP test package is a zip file built
            using Apple's Xcode and supporting tools. For a detailed
            description of the process to create your XCTEST_ZIP file, see
            https://firebase.google.com/docs/test-lab/ios/command-line.
          - *game-loop*: launches the game app through a custom URL scheme to
            execute a "demo mode" built into the game app that simulates
            actions of a real player. This test type can include multiple
            game loops (also called "scenarios") indicated by positive
            numbers.

          The type of test to run can be specified with the *--type* flag,
          which defaults to `xctest`.

          All arguments for *{command}* may be specified on the command line
          and/or within an argument file. Run *$ gcloud topic arg-files* for
          more information about argument files.
        a	            To help you identify and locate your test matrix in the Firebase
          console, run:

            $ {command} --test=XCTEST_ZIP --client-details=matrixLabel="Example matrix label"

          To invoke an XCTest lasting up to five minutes against the default
          device environment, run:

            $ {command} --test=XCTEST_ZIP --timeout=5m

          To invoke an XCTest against an iPad 5 running iOS 11.2, run:

            $ {command} --test=XCTEST_ZIP --device=model=ipad5,version=11.2

          To run your tests against multiple iOS devices simultaneously, specify
          the *--device* flag more than once:

            $ {command} --test=XCTEST_ZIP --device=model=iphone7 --device=model=ipadmini4,version=11.2 --device=model=iphonese

          To run your XCTest using a specific version of Xcode, say 9.4.1, run:

            $ {command} --test=XCTEST_ZIP --xcode-version=9.4.1

          To help you identify and locate your test matrix in the Firebase
          console, run:

            $ {command} --test=XCTEST_ZIP --client-details=matrixLabel="Example matrix label"

          To run an iOS game loop, specify the *--type* and *--app* flags:

            $ {command} --type=game-loop --app=app.ipa

          To run an iOS game loop with specific scenario(s), use the
          *--scenario-numbers* flag:

            $ {command} --type=game-loop --app=app.ipa --scenario-numbers=1,2,3

          To run a test that pushes a local file onto the device before testing,
          use the *--other-files* flag:

            $ {command} --type=game-loop --app=app.ipa --scenario-numbers=1 --other-files=/private/var/mobile/Media/file.txt=/path/to/file.txt

          All test arguments for a given test may alternatively be stored in an
          argument group within a YAML-formatted argument file. The _ARG_FILE_
          may contain one or more named argument groups, and argument groups may
          be combined using the `include:` attribute (Run *$ gcloud topic
          arg-files* for more information). The ARG_FILE can easily be shared
          with colleagues or placed under source control to ensure consistent
          test executions.

          To run a test using arguments loaded from an ARG_FILE named
          *excelsior_app_args*, which contains an argument group named
          *ios-args:*, use the following syntax:

            $ {command} path/to/excelsior_app_args:ios-args

          r   c                    > [         [        [        ]  U 5        [        R                  " U 5        [        R
                  " U 5        g )N)superr   r%   r   AddIosBetaArgsAddBetaArgs)r#   	__class__s    r$   r%   RunBeta.Args7  s.    	'7 (F# r'   r~   )
rv   rw   rx   ry   rz   r{   r|   r%   r}   __classcell__)r   s   @r$   r   r      s-    I.91R-h ! !r'   r   )"rz   
__future__r   r   r   $googlecloudsdk.api_lib.firebase.testr   r   r	   r
   r   r   r   r   r   (googlecloudsdk.api_lib.firebase.test.iosr   r   googlecloudsdk.callioper   googlecloudsdk.corer   rD   r@   UnicodeIsSupportedReleaseTracksrO   GAListCommandr   rJ   ALPHABETAr   r~   r'   r$   <module>r      s    2 &  ' 9 ? : ? ; ? @ = 5 @ C ( # 
+ D%%(()`I$

 `I * `IF( D%%++T->->-C-CDZ!c Z! EZ!r'   