From 32369cb805e531a47c021543fc68c9c38a10d4d4 Mon Sep 17 00:00:00 2001 From: hemanik Date: Fri, 27 Oct 2017 00:23:59 +0530 Subject: [PATCH] Updates test to verify absence of banner on new announcement. --- .../org/arquillian/tests/pagetests/BlogPageTest.java | 10 +++++++--- .../tests/pom/fragmentObjects/BlogFragment.java | 12 ++++++++++++ 2 files changed, 19 insertions(+), 3 deletions(-) diff --git a/src/test/java/org/arquillian/tests/pagetests/BlogPageTest.java b/src/test/java/org/arquillian/tests/pagetests/BlogPageTest.java index a8e3fe89b24..ac7a096de74 100644 --- a/src/test/java/org/arquillian/tests/pagetests/BlogPageTest.java +++ b/src/test/java/org/arquillian/tests/pagetests/BlogPageTest.java @@ -75,14 +75,18 @@ public void should_be_able_to_go_to_jacoco_blog_from_cloud_tag() { @Test public void should_redirect_to_new_announcement_if_banner_is_present() throws Exception { - mainPage.menu() .navigate().to("Blog"); + blogPage.blogContent() + .verify() + .hasAnnouncementBanner(true); + blogPage.newAnnouncementBanner() .navigate().to("Check our latest announcement"); - fetchedBlogPage.verify().hasContent(); - + blogPage.blogContent() + .verify() + .hasAnnouncementBanner(false); } } diff --git a/src/test/java/org/arquillian/tests/pom/fragmentObjects/BlogFragment.java b/src/test/java/org/arquillian/tests/pom/fragmentObjects/BlogFragment.java index 5ddef16a363..081c02bd40c 100644 --- a/src/test/java/org/arquillian/tests/pom/fragmentObjects/BlogFragment.java +++ b/src/test/java/org/arquillian/tests/pom/fragmentObjects/BlogFragment.java @@ -48,6 +48,18 @@ public BlogVerifier hasReleaseNotes() { return this; } + public BlogVerifier hasAnnouncementBanner(boolean status) { + try { + WebElement announcementBanner = contentRoot.findElement(By.partialLinkText("Check our latest announcement")); + assertThat(announcementBanner.isDisplayed()).isEqualTo(status); + } catch (NoSuchElementException e) { + if(status) { + throw new NoSuchElementException("Missing announcement banner for the blog post.", e); + } + } + return this; + } + private WebElement getBlogTitle(WebElement blog) { return blog.findElement(By.cssSelector("[class='title'] a")); }