/* Ċ Ġ* ĠCopyright Ġ( C ) Ġ 2 0 1 7 ĠThe ĠAndroid ĠOpen ĠSource ĠProject Ċ Ġ* Ċ Ġ* ĠLicensed Ġunder Ġthe ĠApache ĠLicense , ĠVersion Ġ 2 . 0 Ġ( the Ġ" License "); Ċ Ġ* Ġyou Ġmay Ġnot Ġuse Ġthis Ġfile Ġexcept Ġin Ġcompliance Ġwith Ġthe ĠLicense . Ċ Ġ* ĠYou Ġmay Ġobtain Ġa Ġcopy Ġof Ġthe ĠLicense Ġat Ċ Ġ* Ċ Ġ* ĠĠĠĠĠ Ġhttp :// www . apache . org / licenses / LICENSE - 2 . 0 Ċ Ġ* Ċ Ġ* ĠUnless Ġrequired Ġby Ġapplicable Ġlaw Ġor Ġagreed Ġto Ġin Ġwriting , Ġsoftware Ċ Ġ* Ġdistributed Ġunder Ġthe ĠLicense Ġis Ġdistributed Ġon Ġan Ġ" AS ĠIS " ĠBASIS , Ċ Ġ* ĠWITHOUT ĠWARRANTIES ĠOR ĠCONDITIONS ĠOF ĠANY ĠKIND , Ġeither Ġexpress Ġor Ġimplied . Ċ Ġ* ĠSee Ġthe ĠLicense Ġfor Ġthe Ġspecific Ġlanguage Ġgoverning Ġpermissions Ġand Ċ Ġ* Ġlimitations Ġunder Ġthe ĠLicense . Ċ Ġ*/ Ċ package Ġcom . android . tools . idea . tests . gui . framework . fixture . new ps d Ċ Ċ import Ġcom . android . tools . idea . structure . dialog . Side Panel Ċ import Ġcom . android . tools . idea . tests . gui . framework . Dialog Container Fixture Ċ import Ġcom . android . tools . idea . tests . gui . framework . Gui Tests Ċ import Ġcom . android . tools . idea . tests . gui . framework . finder Ċ import Ġcom . android . tools . idea . tests . gui . framework . fixture . Ide Frame Fixture Ċ import Ġcom . android . tools . idea . tests . gui . framework . fix up Waiting Ċ import Ġcom . android . tools . idea . tests . gui . framework . matcher . Matchers Ċ import Ġcom . android . tools . idea . tests . gui . framework . waitFor Idle Ċ import Ġorg . fest . swing . core . Robot Ċ import Ġorg . fest . swing . fixture . J List Fixture Ċ import Ġorg . fest . swing . timing . Wait Ċ import Ġjava . awt . Container Ċ import Ġjavax . swing . J Dialog Ċ Ċ class ĠProject Structure Dialog Fixture ( ĊĠ Ġval Ġcontainer : ĠJ Dialog , ĊĠ Ġprivate Ġval Ġide Frame Fixture : ĠIde Frame Fixture Ċ ) Ġ: ĠDialog Container Fixture Ġ{ ĊĊĠ Ġprivate Ġval Ġrobot Ġ= Ġide Frame Fixture . robot (). fix up Waiting () ĊĠ Ġoverride Ġfun Ġtarget (): ĠJ Dialog Ġ= Ġcontainer ĊĠ Ġoverride Ġfun Ġrobot (): ĠRobot Ġ= Ġrobot ĊĊĠ Ġoverride Ġfun Ġmaybe Restore Lost Focus () Ġ{ ĊĠĠĠ Ġide Frame Fixture . request Focus If Lost () ĊĠ Ġ} ĊĊĠ Ġfun Ġclick Ok () Ġ{ ĊĠĠĠ Ġ// ĠChanging Ġthe Ġproject Ġstructure Ġcan Ġcause Ġa ĠGradle Ġbuild Ġand ĠStudio Ġre - indexing . ĊĠĠĠ ĠwaitFor Sync To Finish Ġ{ Ġclick Ok And Wait Dialog Dis appear () Ġ} ĊĠ Ġ} ĊĊĠ Ġfun Ġclick Ok Expect Confirmation (): ĠErrors Review Confirmation Dialog Fixture Ġ{ ĊĠĠĠ ĠGui Tests . find And Click Ok Button ( this ) ĊĠĠĠ Ġ// ĠChanging Ġthe Ġproject Ġstructure Ġcan Ġcause Ġa ĠGradle Ġbuild Ġand ĠStudio Ġre - indexing . ĊĠĠĠ Ġreturn ĠErrors Review Confirmation Dialog Fixture . find ( robot , Ġ" Problems ĠFound ") ĊĠ Ġ} ĊĊĠ Ġfun Ġclick Cancel (): ĠIde Frame Fixture Ġ{ ĊĠĠĠ Ġclick Cancel And Wait Dialog Dis appear () ĊĠĠĠ Ġreturn Ġide Frame Fixture ĊĠ Ġ} ĊĊĠ Ġfun Ġclick Ok ( waitFor Sync : ĠWait ) Ġ{ ĊĠĠĠ Ġ// ĠChanging Ġthe Ġproject Ġstructure Ġcan Ġcause Ġa ĠGradle Ġbuild Ġand ĠStudio Ġre - indexing . ĊĠĠĠ Ġide Frame Fixture . act And WaitFor Gradle Project Sync To Finish ( waitFor Sync ) Ġ{ Ġclick Ok And Wait Dialog Dis appear () Ġ}. also Ġ{ ĠwaitFor Idle () Ġ} ĊĠ Ġ} ĊĊĠ Ġfun ĠwaitFor Sync To Finish ( actions : Ġ() Ġ-> ĠUnit ) Ġ{ ĊĠĠĠ Ġide Frame Fixture . act And WaitFor Gradle Project Sync To Finish Ġ{ Ġactions () Ġ}. also Ġ{ ĠwaitFor Idle () Ġ} ĊĠ Ġ} ĊĊĠ Ġfun Ġselect Configurable ( view Name : ĠString ): ĠProject Structure Dialog Fixture Ġ{ ĊĠĠĠ Ġval Ġside Panel Ġ= ĠGui Tests . wait Until Found ( robot (), Ġcontainer , ĠMatch ers . by Type ( Side Panel :: class . java )) ĊĠĠĠ Ġval Ġside Panel List Ġ= Ġside Panel . list ĊĠĠĠ Ġval Ġlist Fixture Ġ= ĠJ List Fixture ( robot (), Ġside Panel List ) ĊĠĠĠ Ġlist Fixture . replace Cell Reader Ġ{ Ġlist , Ġindex Ġ-> Ġside Panel . descriptor . getText For ( list . model . getElement At ( index ) Ġas ĠSide Panel . Place Data ) Ġ} ĊĠĠĠ Ġlist Fixture . click Item ( view Name ) ĊĠĠĠ Ġreturn Ġthis ĊĠ Ġ} ĊĊĠ Ġinternal Ġfun Ġfind Configurable ( name : ĠString ): ĠContainer Ġ= ĊĠĠĠĠĠ Ġfinder () ĊĠĠĠĠĠĠĠĠĠ Ġ. find ByName ( container , Ġname ) Ġas ĠContainer ĊĊĊĠ Ġcompanion Ġobject Ġ{ ĊĠĠĠ Ġfun Ġfind ( ide Frame Fixture : ĠIde Frame Fixture ): ĠProject Structure Dialog Fixture Ġ{ ĊĠĠĠĠĠ Ġval Ġdialog Ġ= ĠGui Tests . wait Until Showing ( ide Frame Fixture . robot (), ĠMatch ers . by Title ( J Dialog :: class . java , Ġ" Project ĠStructure ")) ĊĠĠĠĠĠ Ġreturn ĠProject Structure Dialog Fixture ( dialog , Ġide Frame Fixture ) ĊĠĠĠ Ġ} ĊĠ Ġ} Ċ } Ċ Ċ fun ĠIde Frame Fixture . open P sd (): ĠProject Structure Dialog Fixture Ġ{ ĊĠ Ġwait And Invoke Menu Path (" File ", Ġ" Project ĠStructure ...") ĊĠ Ġreturn ĠProject Structure Dialog Fixture . find ( this ) Ċ } Ċ Ċ internal Ġfun ĠDialog Container Fixture . click Ok And Wait Dialog Dis appear () Ġ{ ĊĠ ĠGui Tests . find And Click Ok Button ( this ) ĊĠ ĠwaitFor Dialog To Close () Ċ } Ċ Ċ internal Ġfun ĠDialog Container Fixture . click Cancel And Wait Dialog Dis appear () Ġ{ ĊĠ ĠGui Tests . find And Click Cancel Button ( this ) ĊĠ ĠwaitFor Dialog To Close () Ċ } Ċ Ċ internal Ġfun ĠDialog Container Fixture . click Button And Wait Dialog Dis appear ( text : ĠString ) Ġ{ ĊĠ ĠGui Tests . find And Click Button ( this , Ġtext ) ĊĠ ĠwaitFor Dialog To Close () Ċ } Ċ Ċ fun ĠDialog Container Fixture . waitFor Dialog To Close () Ġ{ ĊĠ ĠWait ĊĠĠĠ Ġ. seconds ( 1 0 ) ĊĠĠĠ Ġ. expect ing (" dialog Ġto Ġdis appear ") ĊĠĠĠ Ġ. until Ġ{ Ġ! target (). is Showing Ġ} ĊĠ ĠwaitFor Idle () ĊĠ Ġmaybe Restore Lost Focus () Ċ } Ċ