sample/src/androidTest/java/com/urbanairship/sample/SampleTest.java
@Test
    public void testFullScreenInAppMessageV2() throws Exception {

        // Create the fullscreen in-app message
        FullScreenDisplayContent displayContent = FullScreenDisplayContent.newBuilder()
                                                                          .setHeading(TextInfo.newBuilder()
                                                                                              .setText("Banner heading is bold")
                                                                                              .addStyle(TextInfo.STYLE_BOLD)
                                                                                              .setColor(Color.BLUE)
                                                                                              .setDrawable(R.drawable.ic_menu_home)
                                                                                              .build())
                                                                          .setMedia(MediaInfo.newBuilder()
                                                                                             .setUrl("https://media.giphy.com/media/JYsWwF82EGnpC/giphy.gif")
                                                                                             .setType(MediaInfo.TYPE_IMAGE)
                                                                                             .setDescription("so cool")
                                                                                             .build())
                                                                          .setBody(TextInfo.newBuilder()
                                                                                           .setText("What's in a name? that which we call a rose By any other name would smell as sweet; So Romeo would, were he not Romeo call'd, Retain that dear perfection which he owes Without that title. Romeo, doff thy name, And for that name which is no part of thee Take all myself.")
                                                                                           .setAlignment(TextInfo.ALIGNMENT_CENTER)
                                                                                           .addStyle(TextInfo.STYLE_ITALIC)
                                                                                           .setColor(Color.GREEN)
                                                                                           .addFontFamily("cursive")
                                                                                           .setFontSize(10)
                                                                                           .build())
                                                                          .setFooter(ButtonInfo.newBuilder()
                                                                                               .setLabel(TextInfo.newBuilder()
                                                                                                                 .setText("Footer is lukewarm.")
                                                                                                                 .setColor(Color.RED)
                                                                                                                 .addStyle(TextInfo.STYLE_UNDERLINE)
                                                                                                                 .build())
                                                                                               .setId("footerId")
                                                                                               .build())
                                                                          .setButtonLayout(DisplayContent.BUTTON_LAYOUT_SEPARATE)
                                                                          .addButton(ButtonInfo.newBuilder()
                                                                                               .setId("button-one")
                                                                                               .setBackgroundColor(Color.BLUE)
                                                                                               .setBorderRadius(2)
                                                                                               .setBehavior(ButtonInfo.BEHAVIOR_DISMISS)
                                                                                               .setBorderRadius(10)
                                                                                               .setBorderColor(Color.MAGENTA)
                                                                                               .setLabel(TextInfo.newBuilder()
                                                                                                                 .setText("Button One!")
                                                                                                                 .build())
                                                                                               .addAction("add_tags_action", JsonValue.wrap("button_one!"))
                                                                                               .build())
                                                                          .addButton(ButtonInfo.newBuilder()
                                                                                               .setBackgroundColor(Color.GRAY)
                                                                                               .setBorderRadius(2)
                                                                                               .setId("button-two")
                                                                                               .setLabel(TextInfo.newBuilder()
                                                                                                                 .setText("Button Two!")
                                                                                                                 .setAlignment(TextInfo.ALIGNMENT_RIGHT)
                                                                                                                 .build())
                                                                                               .addAction("add_tags_action", JsonValue.wrap("button_two!"))
                                                                                               .build())
                                                                          .addButton(ButtonInfo.newBuilder()
                                                                                               .setId("button-three")
                                                                                               .setBackgroundColor(Color.BLUE)
                                                                                               .setBorderRadius(2)
                                                                                               .setBehavior(ButtonInfo.BEHAVIOR_DISMISS)
                                                                                               .setBorderRadius(10)
                                                                                               .setBorderColor(Color.MAGENTA)
                                                                                               .setLabel(TextInfo.newBuilder()
                                                                                                                 .setText("Button Three!")
                                                                                                                 .setAlignment(TextInfo.ALIGNMENT_CENTER)
                                                                                                                 .build())
                                                                                               .addAction("add_tags_action", JsonValue.wrap("button_three!"))
                                                                                               .build())
                                                                          .addButton(ButtonInfo.newBuilder()
                                                                                               .setBackgroundColor(Color.GRAY)
                                                                                               .setBorderRadius(2)
                                                                                               .setId("button-four")
                                                                                               .setLabel(TextInfo.newBuilder()
                                                                                                                 .setText("Button Four!")
                                                                                                                 .setAlignment(TextInfo.ALIGNMENT_CENTER)
                                                                                                                 .build())
                                                                                               .addAction("add_tags_action", JsonValue.wrap("button_four!"))
                                                                                               .build())
                                                                          .addButton(ButtonInfo.newBuilder()
                                                                                               .setBackgroundColor(Color.GRAY)
                                                                                               .setBorderRadius(2)
                                                                                               .setId("button-five")
                                                                                               .setLabel(TextInfo.newBuilder()
                                                                                                                 .setText("Button Five!")
                                                                                                                 .setAlignment(TextInfo.ALIGNMENT_CENTER)
                                                                                                                 .build())
                                                                                               .addAction("add_tags_action", JsonValue.wrap("button_five!"))
                                                                                               .build())
                                                                          .setDismissButtonColor(Color.GREEN)
                                                                          .setTemplate(FullScreenDisplayContent.TEMPLATE_MEDIA_HEADER_BODY)
                                                                          .setBackgroundColor(Color.YELLOW)
                                                                          .build();

        // Schedule fullscreen in-app message
        scheduleInAppMessageV2FullScreen(displayContent);

        // Wait for in-app message to be displayed
        Thread.sleep(TimeUnit.SECONDS.toMillis(1));

        clickAndVerifyTagAdded("Button One!", "button_one!");

        // Schedule fullscreen in-app message
        scheduleInAppMessageV2FullScreen(displayContent);

        // Wait for in-app message to be displayed
        Thread.sleep(TimeUnit.SECONDS.toMillis(1));

        clickAndVerifyTagAdded("Button Two!", "button_two!");

        // Schedule fullscreen in-app message
        scheduleInAppMessageV2FullScreen(displayContent);

        // Wait for in-app message to be displayed
        Thread.sleep(TimeUnit.SECONDS.toMillis(1));

        // scroll down
        onView(withText(containsString("Button Three!"))).perform(ViewActions.scrollTo());

        clickAndVerifyTagAdded("Button Three!", "button_three!");

        // Schedule fullscreen in-app message
        scheduleInAppMessageV2FullScreen(displayContent);

        // Wait for in-app message to be displayed
        Thread.sleep(TimeUnit.SECONDS.toMillis(1));

        // scroll down
        onView(withText(containsString("Button Four!"))).perform(ViewActions.scrollTo());

        clickAndVerifyTagAdded("Button Four!", "button_four!");

        // Schedule fullscreen in-app message
        scheduleInAppMessageV2FullScreen(displayContent);

        // Wait for in-app message to be displayed
        Thread.sleep(TimeUnit.SECONDS.toMillis(1));

        // scroll down
        onView(withText(containsString("Button Five!"))).perform(ViewActions.scrollTo());

        clickAndVerifyTagAdded("Button Five!", "button_five!");
    }
/**
     * Test a fullscreen in-app message V2 with media image and five buttons.
     */
Test a fullscreen in-app message V2 with media image and five buttons.
Test a fullscreen in - app message V2 with media image and five buttons .
@Test
    public void testFullScreenInAppMessageV2() throws Exception {
        FullScreenDisplayContent displayContent = FullScreenDisplayContent.newBuilder()
                                                                          .setHeading(TextInfo.newBuilder()
                                                                                              .setText("Banner heading is bold")
                                                                                              .addStyle(TextInfo.STYLE_BOLD)
                                                                                              .setColor(Color.BLUE)
                                                                                              .setDrawable(R.drawable.ic_menu_home)
                                                                                              .build())
                                                                          .setMedia(MediaInfo.newBuilder()
                                                                                             .setUrl("https://media.giphy.com/media/JYsWwF82EGnpC/giphy.gif")
                                                                                             .setType(MediaInfo.TYPE_IMAGE)
                                                                                             .setDescription("so cool")
                                                                                             .build())
                                                                          .setBody(TextInfo.newBuilder()
                                                                                           .setText("What's in a name? that which we call a rose By any other name would smell as sweet; So Romeo would, were he not Romeo call'd, Retain that dear perfection which he owes Without that title. Romeo, doff thy name, And for that name which is no part of thee Take all myself.")
                                                                                           .setAlignment(TextInfo.ALIGNMENT_CENTER)
                                                                                           .addStyle(TextInfo.STYLE_ITALIC)
                                                                                           .setColor(Color.GREEN)
                                                                                           .addFontFamily("cursive")
                                                                                           .setFontSize(10)
                                                                                           .build())
                                                                          .setFooter(ButtonInfo.newBuilder()
                                                                                               .setLabel(TextInfo.newBuilder()
                                                                                                                 .setText("Footer is lukewarm.")
                                                                                                                 .setColor(Color.RED)
                                                                                                                 .addStyle(TextInfo.STYLE_UNDERLINE)
                                                                                                                 .build())
                                                                                               .setId("footerId")
                                                                                               .build())
                                                                          .setButtonLayout(DisplayContent.BUTTON_LAYOUT_SEPARATE)
                                                                          .addButton(ButtonInfo.newBuilder()
                                                                                               .setId("button-one")
                                                                                               .setBackgroundColor(Color.BLUE)
                                                                                               .setBorderRadius(2)
                                                                                               .setBehavior(ButtonInfo.BEHAVIOR_DISMISS)
                                                                                               .setBorderRadius(10)
                                                                                               .setBorderColor(Color.MAGENTA)
                                                                                               .setLabel(TextInfo.newBuilder()
                                                                                                                 .setText("Button One!")
                                                                                                                 .build())
                                                                                               .addAction("add_tags_action", JsonValue.wrap("button_one!"))
                                                                                               .build())
                                                                          .addButton(ButtonInfo.newBuilder()
                                                                                               .setBackgroundColor(Color.GRAY)
                                                                                               .setBorderRadius(2)
                                                                                               .setId("button-two")
                                                                                               .setLabel(TextInfo.newBuilder()
                                                                                                                 .setText("Button Two!")
                                                                                                                 .setAlignment(TextInfo.ALIGNMENT_RIGHT)
                                                                                                                 .build())
                                                                                               .addAction("add_tags_action", JsonValue.wrap("button_two!"))
                                                                                               .build())
                                                                          .addButton(ButtonInfo.newBuilder()
                                                                                               .setId("button-three")
                                                                                               .setBackgroundColor(Color.BLUE)
                                                                                               .setBorderRadius(2)
                                                                                               .setBehavior(ButtonInfo.BEHAVIOR_DISMISS)
                                                                                               .setBorderRadius(10)
                                                                                               .setBorderColor(Color.MAGENTA)
                                                                                               .setLabel(TextInfo.newBuilder()
                                                                                                                 .setText("Button Three!")
                                                                                                                 .setAlignment(TextInfo.ALIGNMENT_CENTER)
                                                                                                                 .build())
                                                                                               .addAction("add_tags_action", JsonValue.wrap("button_three!"))
                                                                                               .build())
                                                                          .addButton(ButtonInfo.newBuilder()
                                                                                               .setBackgroundColor(Color.GRAY)
                                                                                               .setBorderRadius(2)
                                                                                               .setId("button-four")
                                                                                               .setLabel(TextInfo.newBuilder()
                                                                                                                 .setText("Button Four!")
                                                                                                                 .setAlignment(TextInfo.ALIGNMENT_CENTER)
                                                                                                                 .build())
                                                                                               .addAction("add_tags_action", JsonValue.wrap("button_four!"))
                                                                                               .build())
                                                                          .addButton(ButtonInfo.newBuilder()
                                                                                               .setBackgroundColor(Color.GRAY)
                                                                                               .setBorderRadius(2)
                                                                                               .setId("button-five")
                                                                                               .setLabel(TextInfo.newBuilder()
                                                                                                                 .setText("Button Five!")
                                                                                                                 .setAlignment(TextInfo.ALIGNMENT_CENTER)
                                                                                                                 .build())
                                                                                               .addAction("add_tags_action", JsonValue.wrap("button_five!"))
                                                                                               .build())
                                                                          .setDismissButtonColor(Color.GREEN)
                                                                          .setTemplate(FullScreenDisplayContent.TEMPLATE_MEDIA_HEADER_BODY)
                                                                          .setBackgroundColor(Color.YELLOW)
                                                                          .build();
        scheduleInAppMessageV2FullScreen(displayContent);
        Thread.sleep(TimeUnit.SECONDS.toMillis(1));
        clickAndVerifyTagAdded("Button One!", "button_one!");
        scheduleInAppMessageV2FullScreen(displayContent);
        Thread.sleep(TimeUnit.SECONDS.toMillis(1));
        clickAndVerifyTagAdded("Button Two!", "button_two!");
        scheduleInAppMessageV2FullScreen(displayContent);
        Thread.sleep(TimeUnit.SECONDS.toMillis(1));
        onView(withText(containsString("Button Three!"))).perform(ViewActions.scrollTo());
        clickAndVerifyTagAdded("Button Three!", "button_three!");
        scheduleInAppMessageV2FullScreen(displayContent);
        Thread.sleep(TimeUnit.SECONDS.toMillis(1));
        onView(withText(containsString("Button Four!"))).perform(ViewActions.scrollTo());
        clickAndVerifyTagAdded("Button Four!", "button_four!");
        scheduleInAppMessageV2FullScreen(displayContent);
        Thread.sleep(TimeUnit.SECONDS.toMillis(1));
        onView(withText(containsString("Button Five!"))).perform(ViewActions.scrollTo());
        clickAndVerifyTagAdded("Button Five!", "button_five!");
    }
@ Test public void testFullScreenInAppMessageV2 ( ) throws Exception { FullScreenDisplayContent displayContent = FullScreenDisplayContent . newBuilder ( ) . setHeading ( TextInfo . newBuilder ( ) . setText ( "Banner heading is bold" ) . addStyle ( TextInfo . STYLE_BOLD ) . setColor ( Color . BLUE ) . setDrawable ( R . drawable . ic_menu_home ) . build ( ) ) . setMedia ( MediaInfo . newBuilder ( ) . setUrl ( "https://media.giphy.com/media/JYsWwF82EGnpC/giphy.gif" ) . setType ( MediaInfo . TYPE_IMAGE ) . setDescription ( "so cool" ) . build ( ) ) . setBody ( TextInfo . newBuilder ( ) . setText ( "What's in a name? that which we call a rose By any other name would smell as sweet; So Romeo would, were he not Romeo call'd, Retain that dear perfection which he owes Without that title. Romeo, doff thy name, And for that name which is no part of thee Take all myself." ) . setAlignment ( TextInfo . ALIGNMENT_CENTER ) . addStyle ( TextInfo . STYLE_ITALIC ) . setColor ( Color . GREEN ) . addFontFamily ( "cursive" ) . setFontSize ( 10 ) . build ( ) ) . setFooter ( ButtonInfo . newBuilder ( ) . setLabel ( TextInfo . newBuilder ( ) . setText ( "Footer is lukewarm." ) . setColor ( Color . RED ) . addStyle ( TextInfo . STYLE_UNDERLINE ) . build ( ) ) . setId ( "footerId" ) . build ( ) ) . setButtonLayout ( DisplayContent . BUTTON_LAYOUT_SEPARATE ) . addButton ( ButtonInfo . newBuilder ( ) . setId ( "button-one" ) . setBackgroundColor ( Color . BLUE ) . setBorderRadius ( 2 ) . setBehavior ( ButtonInfo . BEHAVIOR_DISMISS ) . setBorderRadius ( 10 ) . setBorderColor ( Color . MAGENTA ) . setLabel ( TextInfo . newBuilder ( ) . setText ( "Button One!" ) . build ( ) ) . addAction ( "add_tags_action" , JsonValue . wrap ( "button_one!" ) ) . build ( ) ) . addButton ( ButtonInfo . newBuilder ( ) . setBackgroundColor ( Color . GRAY ) . setBorderRadius ( 2 ) . setId ( "button-two" ) . setLabel ( TextInfo . newBuilder ( ) . setText ( "Button Two!" ) . setAlignment ( TextInfo . ALIGNMENT_RIGHT ) . build ( ) ) . addAction ( "add_tags_action" , JsonValue . wrap ( "button_two!" ) ) . build ( ) ) . addButton ( ButtonInfo . newBuilder ( ) . setId ( "button-three" ) . setBackgroundColor ( Color . BLUE ) . setBorderRadius ( 2 ) . setBehavior ( ButtonInfo . BEHAVIOR_DISMISS ) . setBorderRadius ( 10 ) . setBorderColor ( Color . MAGENTA ) . setLabel ( TextInfo . newBuilder ( ) . setText ( "Button Three!" ) . setAlignment ( TextInfo . ALIGNMENT_CENTER ) . build ( ) ) . addAction ( "add_tags_action" , JsonValue . wrap ( "button_three!" ) ) . build ( ) ) . addButton ( ButtonInfo . newBuilder ( ) . setBackgroundColor ( Color . GRAY ) . setBorderRadius ( 2 ) . setId ( "button-four" ) . setLabel ( TextInfo . newBuilder ( ) . setText ( "Button Four!" ) . setAlignment ( TextInfo . ALIGNMENT_CENTER ) . build ( ) ) . addAction ( "add_tags_action" , JsonValue . wrap ( "button_four!" ) ) . build ( ) ) . addButton ( ButtonInfo . newBuilder ( ) . setBackgroundColor ( Color . GRAY ) . setBorderRadius ( 2 ) . setId ( "button-five" ) . setLabel ( TextInfo . newBuilder ( ) . setText ( "Button Five!" ) . setAlignment ( TextInfo . ALIGNMENT_CENTER ) . build ( ) ) . addAction ( "add_tags_action" , JsonValue . wrap ( "button_five!" ) ) . build ( ) ) . setDismissButtonColor ( Color . GREEN ) . setTemplate ( FullScreenDisplayContent . TEMPLATE_MEDIA_HEADER_BODY ) . setBackgroundColor ( Color . YELLOW ) . build ( ) ; scheduleInAppMessageV2FullScreen ( displayContent ) ; Thread . sleep ( TimeUnit . SECONDS . toMillis ( 1 ) ) ; clickAndVerifyTagAdded ( "Button One!" , "button_one!" ) ; scheduleInAppMessageV2FullScreen ( displayContent ) ; Thread . sleep ( TimeUnit . SECONDS . toMillis ( 1 ) ) ; clickAndVerifyTagAdded ( "Button Two!" , "button_two!" ) ; scheduleInAppMessageV2FullScreen ( displayContent ) ; Thread . sleep ( TimeUnit . SECONDS . toMillis ( 1 ) ) ; onView ( withText ( containsString ( "Button Three!" ) ) ) . perform ( ViewActions . scrollTo ( ) ) ; clickAndVerifyTagAdded ( "Button Three!" , "button_three!" ) ; scheduleInAppMessageV2FullScreen ( displayContent ) ; Thread . sleep ( TimeUnit . SECONDS . toMillis ( 1 ) ) ; onView ( withText ( containsString ( "Button Four!" ) ) ) . perform ( ViewActions . scrollTo ( ) ) ; clickAndVerifyTagAdded ( "Button Four!" , "button_four!" ) ; scheduleInAppMessageV2FullScreen ( displayContent ) ; Thread . sleep ( TimeUnit . SECONDS . toMillis ( 1 ) ) ; onView ( withText ( containsString ( "Button Five!" ) ) ) . perform ( ViewActions . scrollTo ( ) ) ; clickAndVerifyTagAdded ( "Button Five!" , "button_five!" ) ; }
Test a fullscreen in-app message V2 with media image and five buttons.
Test a fullscreen in - app message V2 with media image and five buttons .
// Create the fullscreen in-app message // Schedule fullscreen in-app message // Wait for in-app message to be displayed // Schedule fullscreen in-app message // Wait for in-app message to be displayed // Schedule fullscreen in-app message // Wait for in-app message to be displayed // scroll down // Schedule fullscreen in-app message // Wait for in-app message to be displayed // scroll down // Schedule fullscreen in-app message // Wait for in-app message to be displayed // scroll down