Skip to content
Snippets Groups Projects
Unverified Commit ff1ff9a0 authored by Michael Hamann's avatar Michael Hamann Committed by GitHub
Browse files

XWIKI-18758: Replace the Livetable from the Data types page with a Live Data (#1697)

- Migrate XWikiClasses to use the Live Data macro
- Update the docker tests accordingly
- Additionally, add a missing runtime dependency to xwiki-platform-localization-macro for the translation macro used in the document
parent 1fd373b4
No related branches found
No related tags found
No related merge requests found
......@@ -31,6 +31,10 @@
<name>XWiki Platform - XClass - Tests - Functional Docker Tests</name>
<packaging>jar</packaging>
<description>Tests for the XClass Application with Docker</description>
<properties>
<!-- Functional tests are allowed to output content to the console -->
<xwiki.surefire.captureconsole.skip>true</xwiki.surefire.captureconsole.skip>
</properties>
<dependencies>
<dependency>
<groupId>org.xwiki.platform</groupId>
......
......@@ -68,11 +68,15 @@ void createClass(TestUtils setup, TestReference reference)
// Make sure the document doesn't exist.
setup.deletePage(spaceName, pageName);
// Create the class document.
DataTypesPage dataTypesPage = DataTypesPage.gotoPage().waitUntilPageIsLoaded();
// Ensure that class listing also works as guest user.
setup.forceGuestUser();
DataTypesPage dataTypesPage = DataTypesPage.gotoPage();
String dataTypesPageTitle = dataTypesPage.getDocumentTitle();
assertTrue(dataTypesPage.isClassListed("XWiki", "XWikiRights"));
assertFalse(dataTypesPage.isClassListed(spaceName, classDocName));
setup.loginAsSuperAdmin();
dataTypesPage = DataTypesPage.gotoPage();
// Create the class document.
ClassSheetPage classSheetPage = dataTypesPage.createClass(spaceName, className).waitUntilPageIsLoaded();
assertEquals(classTitle, classSheetPage.getDocumentTitle());
assertTrue(classSheetPage.hasBreadcrumbContent(dataTypesPageTitle, false));
......
......@@ -41,5 +41,10 @@
<artifactId>xwiki-platform-test-ui</artifactId>
<version>${project.version}</version>
</dependency>
<dependency>
<groupId>org.xwiki.platform</groupId>
<artifactId>xwiki-platform-livedata-test-pageobjects</artifactId>
<version>${project.version}</version>
</dependency>
</dependencies>
</project>
......@@ -21,8 +21,9 @@
import org.openqa.selenium.WebElement;
import org.openqa.selenium.support.FindBy;
import org.xwiki.livedata.test.po.LiveDataElement;
import org.xwiki.livedata.test.po.TableLayoutElement;
import org.xwiki.test.ui.po.DocumentPicker;
import org.xwiki.test.ui.po.LiveTableElement;
import org.xwiki.test.ui.po.ViewPage;
import org.xwiki.test.ui.po.editor.WikiEditPage;
......@@ -37,7 +38,7 @@ public class DataTypesPage extends ViewPage
/**
* The widget used to specify the class to create.
*/
private DocumentPicker documentPicker = new DocumentPicker();
private final DocumentPicker documentPicker = new DocumentPicker();
/**
* The button used to create a new class.
......@@ -46,9 +47,9 @@ public class DataTypesPage extends ViewPage
private WebElement createClassButton;
/**
* The live table that lists the existing classes.
* The Live Data table that lists the existing classes.
*/
private LiveTableElement classesLiveTable = new LiveTableElement("classes");
private final TableLayoutElement classesLiveDataTable = (new LiveDataElement("classes")).getTableLayout();
/**
* Opens the page that list the available data types.
......@@ -93,14 +94,7 @@ public WebElement getCreateClassButton()
public boolean isClassListed(String spaceName, String className)
{
String classReference = spaceName + "." + className;
this.classesLiveTable.filterColumn("xwiki-livetable-classes-filter-2", classReference);
return this.classesLiveTable.getRowCount() > 0;
}
@Override
public DataTypesPage waitUntilPageIsLoaded()
{
this.classesLiveTable.waitUntilReady();
return this;
this.classesLiveDataTable.filterColumn("Location", classReference);
return this.classesLiveDataTable.countRows() > 0;
}
}
......@@ -35,6 +35,12 @@
<xwiki.extension.name>XClass Application</xwiki.extension.name>
</properties>
<dependencies>
<dependency>
<groupId>org.xwiki.platform</groupId>
<artifactId>xwiki-platform-localization-macro</artifactId>
<version>${project.version}</version>
<scope>runtime</scope>
</dependency>
<dependency>
<groupId>org.xwiki.platform</groupId>
<artifactId>xwiki-platform-rendering-macro-velocity</artifactId>
......@@ -66,5 +72,18 @@
<scope>runtime</scope>
<type>xar</type>
</dependency>
<!-- Runtime dependencies for Live Data. -->
<dependency>
<groupId>org.xwiki.platform</groupId>
<artifactId>xwiki-platform-livedata-macro</artifactId>
<version>${project.version}</version>
<scope>runtime</scope>
</dependency>
<dependency>
<groupId>org.xwiki.platform</groupId>
<artifactId>xwiki-platform-livedata-livetable</artifactId>
<version>${project.version}</version>
<scope>runtime</scope>
</dependency>
</dependencies>
</project>
......@@ -20,7 +20,7 @@
* 02110-1301 USA, or see the FSF site: http://www.fsf.org.
-->
<xwikidoc version="1.3" reference="XWiki.XWikiClasses" locale="">
<xwikidoc version="1.4" reference="XWiki.XWikiClasses" locale="">
<web>XWiki</web>
<name>XWikiClasses</name>
<language/>
......@@ -130,24 +130,28 @@
(% id="HClassesLiveTable" %)
= {{translation key="platform.xclass.classes.livetable.heading"/}} =
{{velocity}}
{{html}}
#set ($columns = ['doc.title', 'doc.location', 'doc.date', 'doc.author', 'pageCount', '_actions'])
#set ($columnsProperties = {
'doc.title': {'link': 'view'},
'doc.location': {'html': true},
'doc.author': {'link': 'author'},
'pageCount': {'type': 'numeric', 'filterable': false, 'sortable': false},
'_actions': {'sortable': false, 'filterable': false, 'html': true, 'actions': ['edit', 'delete']}
})
#set ($options = {
'resultPage': 'XWiki.XWikiClassesLiveTableResults',
'translationPrefix' : 'platform.xclass.classes.livetable.',
'rowCount': 10,
'outputOnlyHtml': true,
'queryFilters': []
})
#livetable("classes" $columns $columnsProperties $options)
{{/html}}
{{/velocity}}</content>
{{liveData
id="classes"
properties="doc.title,doc.location,doc.date,doc.author,pageCount,_actions"
source="liveTable"
sourceParameters="resultPage=XWiki.XWikiClassesLiveTableResults&amp;translationPrefix=platform.xclass.classes.livetable.&amp;queryFilters="
}}
{
"meta": {
"propertyDescriptors": [
{
"id": "doc.title",
"editable": false
},
{
"id": "pageCount",
"editable": false,
"filterable": false,
"sortable": false,
"displayer": "number"
}
]
}
}
{{/liveData}}</content>
</xwikidoc>
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment