Skip to content

Commit

Permalink
LPD-40036 Fix broken test, rename new widget so it's not that generic…
Browse files Browse the repository at this point in the history
…, and update test folder infrastructure so it's more accurate to its purpose
  • Loading branch information
antonio-ortega authored and brianchandotcom committed Dec 17, 2024
1 parent 19eaca0 commit f143f2c
Show file tree
Hide file tree
Showing 6 changed files with 26 additions and 21 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -8,12 +8,12 @@
/**
* @author Miguel Arroyo
*/
public class SamplePortletKeys {

public static final String SAMPLE_PORTLET =
"com_liferay_sample_web_portlet_SamplePortlet";
public class TaglibSamplePortletKeys {

public static final String SEARCH_PAGINATOR_DISPLAY_CONTEXT =
"SEARCH_PAGINATOR_DISPLAY_CONTEXT";

public static final String TAGLIB_SAMPLE_PORTLET =
"com_liferay_sample_web_portlet_TaglibSamplePortlet";

}
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@

import com.liferay.frontend.taglib.clay.servlet.taglib.util.DropdownItem;
import com.liferay.frontend.taglib.clay.servlet.taglib.util.DropdownItemBuilder;
import com.liferay.frontend.taglib.sample.web.internal.constants.SamplePortletKeys;
import com.liferay.frontend.taglib.sample.web.internal.constants.TaglibSamplePortletKeys;
import com.liferay.portal.kernel.dao.search.SearchContainer;
import com.liferay.portal.kernel.dao.search.SearchPaginationUtil;
import com.liferay.portal.kernel.portlet.LiferayPortletRequest;
Expand Down Expand Up @@ -51,11 +51,11 @@ public SearchContainer<DropdownItem> getSearchContainer() {
searchContainer.setId("DropdownItemSearchContainer");
searchContainer.setOrderByCol(
SearchOrderByUtil.getOrderByCol(
_renderRequest, SamplePortletKeys.SAMPLE_PORTLET,
_renderRequest, TaglibSamplePortletKeys.TAGLIB_SAMPLE_PORTLET,
"order-by-col", "name"));
searchContainer.setOrderByType(
SearchOrderByUtil.getOrderByType(
_renderRequest, SamplePortletKeys.SAMPLE_PORTLET,
_renderRequest, TaglibSamplePortletKeys.TAGLIB_SAMPLE_PORTLET,
"order-by-type", "asc"));

List<DropdownItem> dropdownItems = new ArrayList<>();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@

package com.liferay.frontend.taglib.sample.web.internal.portlet;

import com.liferay.frontend.taglib.sample.web.internal.constants.SamplePortletKeys;
import com.liferay.frontend.taglib.sample.web.internal.constants.TaglibSamplePortletKeys;
import com.liferay.frontend.taglib.sample.web.internal.display.context.SearchPaginatorDisplayContext;
import com.liferay.portal.kernel.portlet.bridges.mvc.MVCPortlet;
import com.liferay.portal.kernel.util.Portal;
Expand Down Expand Up @@ -37,22 +37,22 @@
"javax.portlet.expiration-cache=0",
"javax.portlet.init-param.template-path=/META-INF/resources/",
"javax.portlet.init-param.view-template=/view.jsp",
"javax.portlet.name=" + SamplePortletKeys.SAMPLE_PORTLET,
"javax.portlet.name=" + TaglibSamplePortletKeys.TAGLIB_SAMPLE_PORTLET,
"javax.portlet.resource-bundle=content.Language",
"javax.portlet.security-role-ref=power-user,user",
"javax.portlet.version=3.0"
},
service = Portlet.class
)
public class SamplePortlet extends MVCPortlet {
public class TaglibSamplePortlet extends MVCPortlet {

@Override
public void doDispatch(
RenderRequest renderRequest, RenderResponse renderResponse)
throws IOException, PortletException {

renderRequest.setAttribute(
SamplePortletKeys.SEARCH_PAGINATOR_DISPLAY_CONTEXT,
TaglibSamplePortletKeys.SEARCH_PAGINATOR_DISPLAY_CONTEXT,
new SearchPaginatorDisplayContext(
_portal, renderRequest, renderResponse));

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ taglib uri="http://liferay.com/tld/theme" prefix="liferay-theme" %><%@
taglib uri="http://liferay.com/tld/ui" prefix="liferay-ui" %><%@
taglib uri="http://liferay.com/tld/util" prefix="liferay-util" %>

<%@ page import="com.liferay.frontend.taglib.sample.web.internal.constants.SamplePortletKeys" %><%@
<%@ page import="com.liferay.frontend.taglib.sample.web.internal.constants.TaglibSamplePortletKeys" %><%@
page import="com.liferay.frontend.taglib.sample.web.internal.display.context.SearchPaginatorDisplayContext" %>
<liferay-theme:defineObjects />
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
<%@ include file="/init.jsp" %>

<%
SearchPaginatorDisplayContext searchPaginatorDisplayContext = (SearchPaginatorDisplayContext)request.getAttribute(SamplePortletKeys.SEARCH_PAGINATOR_DISPLAY_CONTEXT);
SearchPaginatorDisplayContext searchPaginatorDisplayContext = (SearchPaginatorDisplayContext)request.getAttribute(TaglibSamplePortletKeys.SEARCH_PAGINATOR_DISPLAY_CONTEXT);
%>

<clay:container-fluid>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,14 @@

import {Locator, expect, mergeTests} from '@playwright/test';

import {apiHelpersTest} from '../../../fixtures/apiHelpersTest';
import {featureFlagsTest} from '../../../fixtures/featureFlagsTest';
import {isolatedSiteTest} from '../../../fixtures/isolatedSiteTest';
import {loginTest} from '../../../fixtures/loginTest';
import getRandomString from '../../../utils/getRandomString';
import getPageDefinition from '../../layout-content-page-editor-web/utils/getPageDefinition';
import getWidgetDefinition from '../../layout-content-page-editor-web/utils/getWidgetDefinition';
import {apiHelpersTest} from '../../fixtures/apiHelpersTest';
import {featureFlagsTest} from '../../fixtures/featureFlagsTest';
import {isolatedSiteTest} from '../../fixtures/isolatedSiteTest';
import {liferayConfig} from '../../liferay.config';
import {loginTest} from '../../fixtures/loginTest';
import getRandomString from '../../utils/getRandomString';
import getPageDefinition from '../layout-content-page-editor-web/utils/getPageDefinition';
import getWidgetDefinition from '../layout-content-page-editor-web/utils/getWidgetDefinition';

export const test = mergeTests(
apiHelpersTest,
Expand All @@ -31,14 +32,18 @@ test(
await test.step('Create a content site and the frontend taglib sample widget', async () => {
const widgetDefinition = getWidgetDefinition({
id: getRandomString(),
widgetName: 'com_liferay_sample_web_portlet_SamplePortlet',
widgetName: 'com_liferay_sample_web_portlet_TaglibSamplePortlet',
});

await apiHelpers.headlessDelivery.createSitePage({
pageDefinition: getPageDefinition([widgetDefinition]),
siteId: site.id,
title: getRandomString(),
});

await page.goto(
`${liferayConfig.environment.baseUrl}/web${site.friendlyUrlPath}`
);
});

await test.step('Open navigator dropdown', async () => {
Expand Down

0 comments on commit f143f2c

Please sign in to comment.