1. Project Clover database Tue Dec 20 2016 21:24:09 CET
  2. Package org.xwiki.flamingo.test.ui

File RestoreDeletedPageTest.java

 
restore: expected:<[2].1> but was:<[3].1>
 

Code metrics

0
16
1
1
86
37
1
0.06
16
1
1

Classes

Class Line # Actions
RestoreDeletedPageTest 41 16 0% 1 17
0.00%
 

Contributing tests

This file is covered by 1 test. .

Source view

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.flamingo.test.ui;
21   
22    import org.junit.Assert;
23    import org.junit.Rule;
24    import org.junit.Test;
25    import org.openqa.selenium.By;
26    import org.xwiki.test.ui.AbstractTest;
27    import org.xwiki.test.ui.SuperAdminAuthenticationRule;
28    import org.xwiki.test.ui.po.AttachmentsPane;
29    import org.xwiki.test.ui.po.DeletingPage;
30    import org.xwiki.test.ui.po.HistoryPane;
31    import org.xwiki.test.ui.po.ViewPage;
32   
33    import static org.junit.Assert.assertEquals;
34   
35    /**
36    * Functional tests for restoring a deleted document from recycle bin.
37    *
38    * @version $Id: ceab7237eb4c31a16b9ed01cb00fb4d3bb9f4689 $
39    * @since 5.2M2
40    */
 
41    public class RestoreDeletedPageTest extends AbstractTest
42    {
43    @Rule
44    public SuperAdminAuthenticationRule authenticationRule = new SuperAdminAuthenticationRule(getUtil());
45   
46    /**
47    * @see "XWIKI-9421: Attachment version is incremented when a document is restored from recycle bin"
48    */
 
49  0 toggle @Test
50    public void restore() throws Exception
51    {
52    // Clean up.
53  0 getUtil().rest().deletePage(getTestClassName(), getTestMethodName());
54   
55    // Create a new page.
56  0 ViewPage page = getUtil().createPage(getTestClassName(), getTestMethodName(), "Once upon a time..", "A story");
57   
58    // Add an attachment.
59  0 page.openAttachmentsDocExtraPane().setFileToUpload(getClass().getResource("/SmallAttachment.txt").getPath());
60   
61    // Delete the page.
62  0 page.delete().clickYes();
63  0 DeletingPage deletingPage = new DeletingPage();
64  0 deletingPage.waitUntilIsTerminated();
65   
66    // Restore the page.
67  0 page = deletingPage.getDeletePageOutcomePage().clickRestore();
68   
69    // Check the page title and content.
70  0 assertEquals("A story", page.getDocumentTitle());
71  0 assertEquals("Once upon a time..", page.getContent());
72   
73    // Check document version/history.
74  0 HistoryPane historyPane = page.openHistoryDocExtraPane();
75  0 Test failure here assertEquals("2.1", historyPane.getCurrentVersion());
76   
77    // Check the attachment.
78  0 AttachmentsPane attachmentsPane = page.openAttachmentsDocExtraPane();
79  0 assertEquals(1, attachmentsPane.getNumberOfAttachments());
80  0 assertEquals("1.1", attachmentsPane.getLatestVersionOfAttachment("SmallAttachment.txt"));
81   
82    // Check the attachment content.
83  0 attachmentsPane.getAttachmentLink("SmallAttachment.txt").click();
84  0 Assert.assertEquals("This is a small attachment.", getDriver().findElement(By.tagName("html")).getText());
85    }
86    }