/*******************************************************************************
 * Copyright (c) 2015 IBH SYSTEMS GmbH.
 * All rights reserved. This program and the accompanying materials
 * are made available under the terms of the Eclipse Public License v1.0
 * which accompanies this distribution, and is available at
 * http://www.eclipse.org/legal/epl-v10.html
 *
 * Contributors:
 *     IBH SYSTEMS GmbH - initial API and implementation
 *******************************************************************************/
package org.eclipse.packagedrone.testing.server;

import org.junit.Assert;
import org.junit.Test;

public class SimplePageTest extends AbstractServerTest
{

    @Test
    public void testBase ()
    {
        simpleTest ( "/" );
    }

    @Test
    public void testAbout ()
    {
        simpleTest ( "/about" );
    }

    @Test
    public void testChannels ()
    {
        simpleTest ( "/channel" );
    }

    @Test
    public void testMailConfig ()
    {
        simpleTest ( "/default.mail/config" );
    }

    @Test
    public void testSignConfig ()
    {
        simpleTest ( "/pgp.sign" );
    }

    @Test
    public void testDeployKeys ()
    {
        simpleTest ( "/deploy/auth/group" );
    }

    @Test
    public void testCoreView ()
    {
        simpleTest ( "/config/core/list" );
    }

    @Test
    public void testCoreSite ()
    {
        simpleTest ( "/config/core/site" );
    }

    @Test
    public void testTasks ()
    {
        simpleTest ( "/tasks" );
    }

    @Test
    public void testSystemBackup ()
    {
        simpleTest ( "/system/backup" );
    }

    @Test
    public void testSystemInfo ()
    {
        simpleTest ( "/system/info" );
    }

    @Test
    public void testSystemAnalytics ()
    {
        simpleTest ( "/system/extend/analytics" );
    }

    protected void simpleTest ( final String url )
    {
        final String full = resolve ( url );
        driver.get ( full );
        Assert.assertEquals ( full, driver.getCurrentUrl () );

        final String title = driver.getTitle ();
        System.out.println ( "Page title: " + title );
        Assert.assertTrue ( "Page title suffix", title.contains ( "| Eclipse Package Drone" ) );
    }
}

@@ -95,16 +95,22 @@
 (c) 2015
+, 2016
  IBH SYS
@@ -120,16 +120,16 @@
 S GmbH.%0A
-
  * All r
@@ -575,16 +575,49 @@
 erver;%0A%0A
+import java.util.regex.Pattern;%0A%0A
 import o
@@ -655,16 +655,86 @@
 it.Test;
+%0Aimport org.openqa.selenium.By;%0Aimport org.openqa.selenium.WebElement;
 %0A%0Apublic
@@ -938,16 +938,325 @@
 %22/about%22
+, () -%3E %7B%0A            final WebElement buildIdEle = getWebContext ().findElement ( By.className ( %22about-build-id%22 ) );%0A            final String text = buildIdEle.getText ();%0A%0A            Assert.assertNotNull ( text );%0A            Assert.assertTrue ( Pattern.matches ( %22%5B0-9%5D%7B8%7D-%5B0-9%5D%7B4%7D%22, text ) );%0A        %7D
  );%0A    
@@ -2288,32 +2288,163 @@
 ing url )%0A    %7B%0A
+        simpleTest ( url, null );%0A    %7D%0A%0A    protected void simpleTest ( final String url, final Runnable additionalChecks )%0A    %7B%0A
         final St
@@ -2665,24 +2665,24 @@
  + title );%0A
-
         Asse
@@ -2761,21 +2761,119 @@
  Drone%22 ) );
+%0A%0A        if ( additionalChecks != null )%0A        %7B%0A            additionalChecks.run ();%0A        %7D
 %0A    %7D%0A%7D%0A

test for version