From 160bfa25360164cbc286b35a531ca9a90cc2f4cc Mon Sep 17 00:00:00 2001 From: Eudaldo Alonso Date: Mon, 14 Oct 2024 17:20:32 +0200 Subject: [PATCH] LPD-39283 Migrates ConfigureTimeWithoutAutosaveUnderInstanceSettings test to playwright --- .../lockedPages.spec.ts | 30 ++++- .../layout/lockedpages/LockedPages.testcase | 112 ------------------ 2 files changed, 29 insertions(+), 113 deletions(-) delete mode 100644 portal-web/test/functional/com/liferay/portalweb/tests/enduser/wem/layout/lockedpages/LockedPages.testcase diff --git a/modules/test/playwright/tests/layout-locked-layouts-web/lockedPages.spec.ts b/modules/test/playwright/tests/layout-locked-layouts-web/lockedPages.spec.ts index edd0a1e0d1dcfe..0801769c0a785c 100644 --- a/modules/test/playwright/tests/layout-locked-layouts-web/lockedPages.spec.ts +++ b/modules/test/playwright/tests/layout-locked-layouts-web/lockedPages.spec.ts @@ -7,6 +7,7 @@ import {expect, mergeTests} from '@playwright/test'; import {apiHelpersTest} from '../../fixtures/apiHelpersTest'; import {featureFlagsTest} from '../../fixtures/featureFlagsTest'; +import {instanceSettingsPagesTest} from '../../fixtures/instanceSettingsPagesTest'; import {isolatedSiteTest} from '../../fixtures/isolatedSiteTest'; import {loginTest} from '../../fixtures/loginTest'; import {pageEditorPagesTest} from '../../fixtures/pageEditorPagesTest'; @@ -16,7 +17,7 @@ import {PORTLET_URLS} from '../../utils/portletUrls'; export const test = mergeTests( apiHelpersTest, - isolatedSiteTest, + instanceSettingsPagesTest, featureFlagsTest({ 'LPS-178052': true, }), @@ -24,7 +25,34 @@ export const test = mergeTests( loginTest() ); +const testWithIsolatedSite = mergeTests(test, isolatedSiteTest); + test( + 'Time without autosave is a number between 1 and 99999', + { + tag: ['@LPS-182060'], + }, + async ({instanceSettingsPage, page}) => { + + // Go to locked pages in instance settings + + await instanceSettingsPage.goToInstanceSetting('Pages', 'Locked Pages'); + + // Assert time without autosave is a number between 1 and 999999 + + await fillAndClickOutside( + page, + page.getByLabel('Time Without Autosave'), + '200000' + ); + + await expect( + page.getByText('Please enter a value less than or equal to 99999.') + ).toBeVisible(); + } +); + +testWithIsolatedSite( 'User can search locked pages', { tag: ['@LPS-182024', '@LPS-194499'], diff --git a/portal-web/test/functional/com/liferay/portalweb/tests/enduser/wem/layout/lockedpages/LockedPages.testcase b/portal-web/test/functional/com/liferay/portalweb/tests/enduser/wem/layout/lockedpages/LockedPages.testcase deleted file mode 100644 index 33852711699e7c..00000000000000 --- a/portal-web/test/functional/com/liferay/portalweb/tests/enduser/wem/layout/lockedpages/LockedPages.testcase +++ /dev/null @@ -1,112 +0,0 @@ -@component-name = "portal-page-management" -definition { - - property ci.retries.disabled = "true"; - property portal.release = "true"; - property portal.upstream = "true"; - property testray.main.component.name = "Content Pages"; - - setUp { - task ("Set up virtual instance") { - TestCase.setUpPortalInstance(); - } - - task ("Sign in") { - User.firstLoginPG(); - } - - task ("Add a site") { - HeadlessSite.addSite(siteName = "Test Site Name"); - } - } - - @description = "This is a test for LPS-182060. Time without autosave is a number between 1 and 99999." - @priority = 3 - test ConfigureTimeWithoutAutosaveUnderInstanceSettings { - task ("Given the configuration of locked pages in instance settings") { - ApplicationsMenu.gotoPortlet( - category = "Configuration", - panel = "Control Panel", - portlet = "Instance Settings"); - - SystemSettings.gotoConfiguration( - configurationCategory = "Pages", - configurationName = "Locked Pages", - configurationScope = "Virtual Instance Scope"); - } - - task ("When trying to leave the field blank") { - Type( - key_fieldLabel = "Time Without Autosave", - locator1 = "TextInput#GENERIC_NUMBER_INPUT", - value1 = ""); - - Click( - key_fieldLabel = "Time Without Autosave", - locator1 = "FormFields#LABEL"); - } - - task ("Then an error message is displayed") { - AssertVisible( - key_alertMessage = "The Time Without Autosave field is required.", - locator1 = "Message#ERROR_ENTER_A_VALID_VALUE"); - } - - task ("When type letters and special characters") { - Type.sendKeys( - key_fieldLabel = "Time Without Autosave", - locator1 = "TextInput#GENERIC_NUMBER_INPUT", - value1 = "WbContntTitl@!&#n_USs_Sxlf"); - - Click( - key_fieldLabel = "Time Without Autosave", - locator1 = "FormFields#LABEL"); - } - - task ("Then the Time Without Autosave field should be empty") { - AssertTextEquals( - key_fieldLabel = "Time Without Autosave", - locator1 = "TextInput#GENERIC_NUMBER_INPUT", - value1 = ""); - - AssertVisible( - key_alertMessage = "The Time Without Autosave field is required.", - locator1 = "Message#ERROR_ENTER_A_VALID_VALUE"); - } - - task ("When trying to fill the Time Without Autosave field with 0") { - Type( - key_fieldLabel = "Time Without Autosave", - locator1 = "TextInput#GENERIC_NUMBER_INPUT", - value1 = 0); - - Click( - key_fieldLabel = "Time Without Autosave", - locator1 = "FormFields#LABEL"); - } - - task ("Then an error message is displayed") { - AssertVisible( - key_alertMessage = "Please enter a value greater than or equal to 1.", - locator1 = "Message#ERROR_ENTER_A_VALID_VALUE"); - } - - task ("When trying to fill in the Time Without Autosave field with a number greater than 99999") { - Type( - key_fieldLabel = "Time Without Autosave", - locator1 = "TextInput#GENERIC_NUMBER_INPUT", - value1 = 200000); - - Click( - key_fieldLabel = "Time Without Autosave", - locator1 = "FormFields#LABEL"); - } - - task ("Then an error message is displayed") { - AssertVisible( - key_alertMessage = "Please enter a value less than or equal to 99999.", - locator1 = "Message#ERROR_ENTER_A_VALID_VALUE"); - } - } - -} \ No newline at end of file