Class | Line # | Actions | |||||
---|---|---|---|---|---|---|---|
ReleaseTest | 37 | 13 | 0% | 1 | 0 |
1 | /* | |
2 | * See the NOTICE file distributed with this work for additional | |
3 | * information regarding copyright ownership. | |
4 | * | |
5 | * This is free software; you can redistribute it and/or modify it | |
6 | * under the terms of the GNU Lesser General Public License as | |
7 | * published by the Free Software Foundation; either version 2.1 of | |
8 | * the License, or (at your option) any later version. | |
9 | * | |
10 | * This software is distributed in the hope that it will be useful, | |
11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | |
12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | |
13 | * Lesser General Public License for more details. | |
14 | * | |
15 | * You should have received a copy of the GNU Lesser General Public | |
16 | * License along with this software; if not, write to the Free | |
17 | * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA | |
18 | * 02110-1301 USA, or see the FSF site: http://www.fsf.org. | |
19 | */ | |
20 | package org.xwiki.release.test.ui; | |
21 | ||
22 | import org.junit.Assert; | |
23 | import org.junit.Test; | |
24 | import org.xwiki.panels.test.po.ApplicationsPanel; | |
25 | import org.xwiki.release.test.po.ReleaseEntryEditPage; | |
26 | import org.xwiki.release.test.po.ReleaseHomePage; | |
27 | import org.xwiki.test.ui.AbstractTest; | |
28 | import org.xwiki.test.ui.po.LiveTableElement; | |
29 | import org.xwiki.test.ui.po.ViewPage; | |
30 | ||
31 | /** | |
32 | * UI tests for the Release application. | |
33 | * | |
34 | * @version $Id: 3d256fe63d71eeebbf2646250820a9a42cf0f8b1 $ | |
35 | * @since 5.0M1 | |
36 | */ | |
37 | public class ReleaseTest extends AbstractTest | |
38 | { | |
39 | /** | |
40 | * Note: we use a dot in the release version name to verify it's supported by the Release application | |
41 | */ | |
42 | private static final String RELEASE_VERSION = "4.5.1"; | |
43 | ||
44 | /** | |
45 | * Name of the Release page that will be created. | |
46 | */ | |
47 | private static final String RELEASE_PAGE_NAME = "Release" + RELEASE_VERSION.replaceAll("\\.", ""); | |
48 | ||
49 | 1 | @Test |
50 | public void testRelease() | |
51 | { | |
52 | // Create a user and log in with it so that we test the application with a standard user | |
53 | // Note that using the superadmin user would also fail since the uservatar macro doesn't work with it. | |
54 | 1 | getUtil().createUserAndLogin(getTestClassName() + "User", "password"); |
55 | ||
56 | // Delete pages that we create in the test (we have to be logged in). | |
57 | 1 | getUtil().deletePage("Release", RELEASE_PAGE_NAME); |
58 | ||
59 | // Navigate to the Release app by clicking in the Application Panel. | |
60 | // This verifies that the Release application is registered in the Applications Panel. | |
61 | // It also verifies that the Translation is registered properly. | |
62 | 1 | ApplicationsPanel applicationPanel = ApplicationsPanel.gotoPage(); |
63 | 1 | ViewPage vp = applicationPanel.clickApplication("Release"); |
64 | ||
65 | // Verify we're on the right page! | |
66 | 1 | Assert.assertEquals(ReleaseHomePage.getSpace(), vp.getMetaDataValue("space")); |
67 | 1 | Assert.assertEquals(ReleaseHomePage.getPage(), vp.getMetaDataValue("page")); |
68 | 1 | ReleaseHomePage homePage = new ReleaseHomePage(); |
69 | ||
70 | // Add new Release | |
71 | 1 | ReleaseEntryEditPage entryPage = homePage.addRelease(RELEASE_VERSION); |
72 | 1 | vp = entryPage.waitUntilPageIsLoaded().clickSaveAndView(); |
73 | ||
74 | // Go back to the home page by clicking in the breadcrumb | |
75 | 1 | vp.clickBreadcrumbLink("Releases"); |
76 | 1 | homePage.waitUntilPageIsLoaded(); |
77 | ||
78 | // Assert Livetable: | |
79 | // - verify that the Translation has been applied by checking the Translated livetable column name | |
80 | // - verify that the Livetable contains our new Release entry | |
81 | 1 | LiveTableElement lt = homePage.getReleaseLiveTable(); |
82 | 1 | Assert.assertTrue(lt.hasRow("Version", RELEASE_VERSION)); |
83 | } | |
84 | } |