package Ġorg . dit 1 1 3 group 3 . android app Ċ Ċ import Ġandroidx . test . core . app . Activity Scenario Ċ import Ġandroidx . test . espress o . Esp ress o . on View Ċ import Ġandroidx . test . espress o . action . View Actions Ċ import Ġandroidx . test . espress o . assertion . View Assertions . matches Ċ import Ġandroidx . test . espress o . matcher . View Matchers .* Ċ import Ġandroidx . test . espress o . matcher . View Matchers . with Id Ċ import Ġandroidx . test . internal . runner . junit 4 . Android JUnit 4 Class Runner Ċ import Ġorg . junit . Test Ċ import Ġorg . junit . runner . RunWith Ċ Ċ @ RunWith Ġ( Android JUnit 4 Class Runner :: class ) Ċ class ĠRules Activity Test Ġ{ ĊĊĠĠĠ Ġval Ġsleep Ġ= ĠThread . sleep ( 2 0 0 0 ) ĊĊĠĠĠ Ġ@ Test ĠĠ Ġ// Checks Ġif ĠRules Ġactivity Ġis Ġlaunch ing ĊĠĠĠ Ġfun Ġtest _ is Rules Activity In View () Ġ{ ĊĠĠĠĠĠĠĠ Ġval Ġactivity Scenario Ġ= ĠActivity Scenario . launch ( Rules Activity :: class . java ) ĊĠĠĠĠĠĠĠ Ġon View ( with Id ( R . id . rules Layout )). check ( matches ( is Displayed ())) ĊĠĠĠĠĠĠĠ Ġsleep ĊĠĠĠ Ġ} ĊĊĠĠĠ Ġ@ Test ĠĠ Ġ// Checks Ġif Ġinitially Ġvisible ĠRules Ġactivity Ġelements Ġare Ġpresent ĊĠĠĠ Ġfun Ġtest _ visibility _ titles _ on _ rules Screen () Ġ{ ĊĠĠĠĠĠĠĠ Ġval Ġactivity Scenario Ġ= ĠActivity Scenario . launch ( Rules Activity :: class . java ) ĊĠĠĠĠĠĠĠ Ġon View ( with Id ( R . id . rules Title )). check ( matches ( is Displayed ())) ĊĠĠĠĠĠĠĠ Ġon View ( with Id ( R . id . rules Intro Text )). check ( matches ( is Displayed ())) ĊĠĠĠĠĠĠĠ Ġsleep ĊĠĠĠ Ġ} ĊĊĠĠĠ Ġ@ Test ĠĠ Ġ// Checks Ġif Ġtitle Ġtext Ġis Ġdisplayed Ġcorrectly Ġon ĠRules Ġscreen ĊĠĠĠ Ġfun Ġtest _ is Expected Text Displayed _ title () Ġ{ ĊĠĠĠĠĠĠĠ Ġval Ġactivity Scenario Ġ= ĠActivity Scenario . launch ( Rules Activity :: class . java ) ĊĠĠĠĠĠĠĠ Ġon View ( with Id ( R . id . rules Title )). check ( matches ( with Text ( R . string . rules Title ))) ĊĠĠĠĠĠĠĠ Ġsleep ĊĠĠĠ Ġ} ĊĊĠĠĠ Ġ@ Test ĠĠ Ġ// Checks Ġif Ġintroduction Ġtext Ġis Ġdisplayed Ġcorrectly Ġon ĠRules Ġscreen ĊĠĠĠ Ġfun Ġtest _ is Expected Text Displayed _ intro () Ġ{ ĊĠĠĠĠĠĠĠ Ġval Ġactivity Scenario Ġ= ĠActivity Scenario . launch ( Rules Activity :: class . java ) ĊĠĠĠĠĠĠĠ Ġon View ( with Id ( R . id . rules Intro Text )). check ( matches ( with Text ( R . string . rules Intro Text ))) ĊĠĠĠĠĠĠĠ Ġsleep ĊĠĠĠ Ġ} ĊĊĠĠĠ Ġ@ Test ĠĠ Ġ// Checks Ġif Ġtitle Ġand Ġtext Ġfor Ġcontrolling Ġthe Ġtank Ġare Ġdisplayed Ġcorrectly Ġon ĠRules Ġscreen ĊĠĠĠ Ġfun Ġtest _ is Expected Text Displayed _ control () Ġ{ ĊĠĠĠĠĠĠĠ Ġval Ġactivity Scenario Ġ= ĠActivity Scenario . launch ( Rules Activity :: class . java ) ĊĠĠĠĠĠĠĠ Ġon View ( with Id ( R . id . tank Controls Title )). check ( matches ( with Text ( R . string . tank Controls Title ))) ĊĠĠĠĠĠĠĠ Ġon View ( with Id ( R . id . tank Control Text )). check ( matches ( with Text ( R . string . tank Control Text ))) ĊĠĠĠĠĠĠĠ Ġsleep ĊĠĠĠ Ġ} ĊĊĠĠĠ Ġ@ Test ĠĠ Ġ// Checks Ġif Ġtitle Ġand Ġtext Ġfor Ġshoot ing Ġare Ġdisplayed Ġcorrectly Ġon ĠRules Ġscreen ĊĠĠĠ Ġfun Ġtest _ is Expected Text Displayed _ shoot ing () Ġ{ ĊĠĠĠĠĠĠĠ Ġval Ġactivity Scenario Ġ= ĠActivity Scenario . launch ( Rules Activity :: class . java ) ĊĠĠĠĠĠĠĠ Ġon View ( with Id ( R . id . shoot ing Title )). check ( matches ( with Text ( R . string . shoot ing Title ))) ĊĠĠĠĠĠĠĠ Ġon View ( with Id ( R . id . shoot ing Text )). check ( matches ( with Text ( R . string . shoot ing Text ))) ĊĠĠĠĠĠĠĠ Ġsleep ĊĠĠĠ Ġ} ĊĊĠĠĠ Ġ@ Test ĠĠ Ġ// Checks Ġif Ġtitle Ġand Ġtext Ġfor Ġexit Ġare Ġdisplayed Ġcorrectly Ġon ĠRules Ġscreen ĊĠĠĠ Ġfun Ġtest _ is Expected Text Displayed _ exit () Ġ{ ĊĠĠĠĠĠĠĠ Ġval Ġactivity Scenario Ġ= ĠActivity Scenario . launch ( Rules Activity :: class . java ) ĊĠĠĠĠĠĠĠ Ġon View ( with Id ( R . id . exit Title )). check ( matches ( with Text ( R . string . exit Title ))) ĊĠĠĠĠĠĠĠ Ġon View ( with Id ( R . id . exit Text )). check ( matches ( with Text ( R . string . exit Text ))) ĊĠĠĠĠĠĠĠ Ġsleep ĊĠĠĠ Ġ} ĊĊĠĠĠ Ġ@ Test ĠĠ Ġ// Checks Ġif Ġcon clusion Ġtext Ġfor Ġexit Ġis Ġdisplayed Ġcorrectly Ġon ĠRules Ġscreen ĊĠĠĠ Ġfun Ġtest _ is Expected Text Displayed _ con clusion () Ġ{ ĊĠĠĠĠĠĠĠ Ġval Ġactivity Scenario Ġ= ĠActivity Scenario . launch ( Rules Activity :: class . java ) ĊĠĠĠĠĠĠĠ Ġon View ( with Id ( R . id . con clusion )). check ( matches ( with Text ( R . string . con clusion ))) ĊĠĠĠĠĠĠĠ Ġsleep ĊĠĠĠ Ġ} ĊĊĠĠĠ Ġ@ Test ĠĠ Ġ// Checks Ġif Ġbutton ĠEXIT Ġhas Ġcorrect Ġnavigation ĊĠĠĠ Ġfun Ġtest _ exit _ button _ navigation () Ġ{ ĊĠĠĠĠĠĠĠ Ġval Ġactivity Scenario Ġ= ĠActivity Scenario . launch ( Rules Activity :: class . java ) ĊĠĠĠĠĠĠĠ Ġon View ( with Id ( R . id . exit )). perform ( View Actions . click ()) ĊĠĠĠĠĠĠĠ Ġon View ( with Id ( R . id . main Menu )). check ( matches ( is Displayed ())) ĊĠĠĠĠĠĠĠ Ġsleep ĊĠĠĠ Ġ} ĊĊĠĠĠ Ġ@ Test ĠĠ Ġ// Checks Ġif Ġrotation Ġfrom Ġpor trait Ġmode Ġchanges Ġto Ġlandscape ĊĠĠĠ Ġfun Ġtest _ land scape Mode () Ġ{ ĊĠĠĠĠĠĠĠ Ġval Ġactivity Scenario Ġ= ĠActivity Scenario . launch ( Rules Activity :: class . java ) ĊĠĠĠĠĠĠĠ Ġon View ( is Root ()). perform ( Screen Orientation Change . orientation Land scape ()) ĊĠĠĠĠĠĠĠ Ġsleep ĊĠĠĠĠĠĠĠ Ġon View ( with Id ( R . id . rules Layout )). check ( matches ( is Displayed ())) ĊĠĠĠĠĠĠĠ Ġsleep ĊĠĠĠ Ġ} Ċ }