Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

LPS-21554 Playwright test use link - Execute only one playwright test #549

Open
wants to merge 6 commits into
base: master
Choose a base branch
from
Open
70 changes: 1 addition & 69 deletions modules/test/playwright/playwright.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,82 +5,14 @@

import {defineConfig} from '@playwright/test';

import {wemSiteSetup, wemSiteTeardown} from './setup/wem-site/config';
import {config as accountAdminWebConfig} from './tests/account-admin-web/config';
import {config as analyticsSettingsWebConfig} from './tests/analytics-settings-web/config';
import {config as analyticsWebConfig} from './tests/analytics-web/config';
import {config as announcementsWebConfig} from './tests/announcements-web/config';
import {config as batchPlannerConfig} from './tests/batch-planner/config';
import {config as blogsWebConfig} from './tests/blogs-web/config';
import {config as changeTrackingWebConfig} from './tests/change-tracking-web/config';
import {config as clientExtensionWebConfig} from './tests/client-extension-web/config';
import {config as commerceConfig} from './tests/commerce/config';
import {config as dispatchWebConfig} from './tests/dispatch-web/config';
import {config as documentLibraryWebConfig} from './tests/document-library-web/config';
import {config as exportImportWebConfig} from './tests/export-import-web/config';
import {config as frontendDataSetViewsWebConfig} from './tests/frontend-data-set-views-web/config';
import {config as headlessBuilderImplConfig} from './tests/headless-builder-impl/config';
import {config as headlessBuilderWebConfig} from './tests/headless-builder-web/config';
import {config as journalWebConfig} from './tests/journal-web/config';
import {config as knowledgeBaseWebConfig} from './tests/knowledge-base-web/config';
import {config as layoutAdminWebConfig} from './tests/layout-admin-web/config';
import {config as layoutContentPageEditorWebConfig} from './tests/layout-content-page-editor-web/config';
import {config as layoutSetPrototypeWebConfig} from './tests/layout-set-prototype-web/config';
import {config as layoutTaglib} from './tests/layout-taglib/config';
import {config as lockedItemsConfig} from './tests/locked-items-web/config';
import {config as loginWebConfig} from './tests/login-web/config';
import {config as objectWebConfig} from './tests/object-web/config';
import {config as osbFaroWebConfig} from './tests/osb-faro-web/config';
import {config as portalWorkflowKaleoDesignerWebConfig} from './tests/portal-workflow-kaleo-designer-web/config';
import {config as productNavigationControlMenuWebConfig} from './tests/product-navigation-control-menu-web/config';
import {config as productNavigationProductMenuWebConfig} from './tests/product-navigation-product-menu-web/config';
import {config as productNavigationUserPersonalBarWebConfig} from './tests/product-navigation-user-personal-bar-web/config';
import {config as stableConfig} from './tests/stable/config';
import {config as stylebookConfig} from './tests/style-book-web/config';
import {config as usersAdminWebConfig} from './tests/users-admin-web/config';

const setupProjects = [wemSiteSetup, wemSiteTeardown];

export default defineConfig({
expect: {
timeout: 15 * 1000,
},
forbidOnly: !!process.env.CI,
projects: [
accountAdminWebConfig,
analyticsWebConfig,
analyticsSettingsWebConfig,
announcementsWebConfig,
batchPlannerConfig,
blogsWebConfig,
changeTrackingWebConfig,
clientExtensionWebConfig,
commerceConfig,
dispatchWebConfig,
documentLibraryWebConfig,
exportImportWebConfig,
frontendDataSetViewsWebConfig,
headlessBuilderImplConfig,
headlessBuilderWebConfig,
journalWebConfig,
knowledgeBaseWebConfig,
layoutAdminWebConfig,
layoutContentPageEditorWebConfig,
layoutSetPrototypeWebConfig,
layoutTaglib,
lockedItemsConfig,
loginWebConfig,
objectWebConfig,
osbFaroWebConfig,
portalWorkflowKaleoDesignerWebConfig,
productNavigationControlMenuWebConfig,
productNavigationProductMenuWebConfig,
productNavigationUserPersonalBarWebConfig,
stableConfig,
stylebookConfig,
usersAdminWebConfig,
...setupProjects,
],
projects: [layoutAdminWebConfig],
reporter: [
[
'html',
Expand Down
126 changes: 0 additions & 126 deletions modules/test/playwright/tests/layout-admin-web/millerColumns.spec.ts

This file was deleted.

Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
/**
* SPDX-FileCopyrightText: (c) 2000 Liferay, Inc. https://liferay.com
* SPDX-License-Identifier: LGPL-2.1-or-later OR LicenseRef-Liferay-DXP-EULA-2.0.0-2023-06
*/

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

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

export const test = mergeTests(
apiHelpersTest,
featureFlagsTest({
'LPS-178052': true,
}),
loginTest()
);

test('This is a test for LPD-21554. Some page names result in 404 friendly URLs.', async ({
apiHelpers,
page,
}) => {
const company = await apiHelpers.jsonWebServicesCompany.getCompanyByWebId(
'liferay.com'
);

const group = await apiHelpers.jsonWebServicesGroup.getGroupByKey(
company.companyId,
'Guest'
);

// Create a page in Guest site with name matching a supported locale which
// is not an available locale for the site

const pageName = 'th';

const sitePage = await apiHelpers.headlessDelivery.createSitePage({
pageDefinition: getPageDefinition([
getFragmentDefinition(getRandomString(), 'BASIC_COMPONENT-heading'),
]),
siteId: group.groupId,
title: pageName,
});

await page.goto(liferayConfig.environment.baseUrl);

if (await page.getByText(pageName, {exact: true}).isVisible()) {
await page.getByText(pageName, {exact: true}).click();
}

await expect.soft(page.getByText('Heading Example')).toBeVisible();

await apiHelpers.jsonWebServicesLayout.deleteLayout(String(sitePage.id));
});

This file was deleted.

1 change: 1 addition & 0 deletions modules/test/playwright/types/content-page.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ type FragmentField = {

type Layout = {
friendlyUrlPath: string;
id: number;
};

type PageDefinition = {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,7 @@
import com.liferay.portal.kernel.util.comparator.LayoutPriorityComparator;
import com.liferay.portal.model.impl.LayoutImpl;
import com.liferay.portal.util.LayoutTypeControllerTracker;
import com.liferay.portal.util.PropsValues;

import java.util.HashMap;
import java.util.List;
Expand Down Expand Up @@ -523,13 +524,14 @@ public void validateFriendlyURLKeyword(String friendlyURL)
}
}

for (Locale locale : LanguageUtil.getAvailableLocales()) {
String languageId = StringUtil.toLowerCase(
LocaleUtil.toLanguageId(locale));
for (String languageId : PropsValues.LOCALES) {
languageId = StringUtil.toLowerCase(languageId);

String i18nPathLanguageId =
StringPool.SLASH +
PortalUtil.getI18nPathLanguageId(locale, languageId);
PortalUtil.getI18nPathLanguageId(
LocaleUtil.fromLanguageId(languageId, false),
languageId);

String underlineI18nPathLanguageId = StringUtil.replace(
i18nPathLanguageId, CharPool.DASH, CharPool.UNDERLINE);
Expand Down