Skip to content

Commit

Permalink
LPD-31506 Migrate ShowSpecificErrorMessageWhenImportMastersPageTempla…
Browse files Browse the repository at this point in the history
…teWithInvalidValue to integration test
  • Loading branch information
ealonso authored and brianchandotcom committed Aug 15, 2024
1 parent e51b18b commit 9a26328
Show file tree
Hide file tree
Showing 4 changed files with 21 additions and 35 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@
import com.liferay.portal.kernel.model.Group;
import com.liferay.portal.kernel.model.User;
import com.liferay.portal.kernel.service.ServiceContextThreadLocal;
import com.liferay.portal.kernel.test.TestInfo;
import com.liferay.portal.kernel.test.rule.AggregateTestRule;
import com.liferay.portal.kernel.test.rule.DeleteAfterTestRun;
import com.liferay.portal.kernel.test.util.GroupTestUtil;
Expand Down Expand Up @@ -234,6 +235,26 @@ public void testImportMasterLayouts() throws Exception {
actualLayoutPageTemplateEntryNames.toArray(new String[0]));
}

@Test
@TestInfo("LPS-102207")
public void testImportMastersLayoutsWithInvalidValue() throws Exception {
List<LayoutsImporterResultEntry> layoutsImporterResultEntries =
_getLayoutsImporterResultEntries("master-page-invalid-value");

Assert.assertEquals(
layoutsImporterResultEntries.toString(), 1,
layoutsImporterResultEntries.size());

LayoutsImporterResultEntry layoutsImporterResultEntry =
layoutsImporterResultEntries.get(0);

Assert.assertEquals(
"Custom Master Page Template could not be imported because its " +
"page definition is invalid.",
layoutsImporterResultEntry.getErrorMessage(
LocaleUtil.getSiteDefault()));
}

private void _addZipWriterEntry(ZipWriter zipWriter, URL url)
throws IOException {

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -655,41 +655,6 @@ definition {
}
}

@description = "This is a use case for LPS-102207. The specific error message should be shown when import a master page template with invalid value in json file."
@priority = 4
test ShowSpecificErrorMessageWhenImportMastersPageTemplateWithInvalidValue {
task ("Import masters page template with invalid value") {
MastersPageTemplatesAdmin.openMastersAdmin(siteURLKey = "test-site-name");

Click.waitForMenuToggleJSClick(locator1 = "Icon#HEADER_VERTICAL_ELLIPSIS");

MenuItem.click(menuItem = "Import");

WaitForPageLoad();

UploadDependencyFile.uploadArchiveFile(fileName = "master-page-invalid-value.zip");

Button.clickImport();
}

task ("Assert the specific error message is shown on Import popup") {
AssertTextEquals(
locator1 = "Message#ERROR_IMPORT",
value1 = "1 item could not be imported.");

AssertTextEquals.assertPartialText(
itemName = "Custom Master Page Template",
locator1 = "Message#ERROR_IMPORT_SUBTEXT",
value1 = "master-page.json could not be imported because its page definition is invalid.");
}

task ("Assert custom master is not imported") {
Button.clickDone();

LexiconCard.viewCardNotPresent(card = "Custom Master Page Template");
}
}

@description = "This is a test for LPS-173150. Assert new import master page templates works."
@priority = 5
test UploadAnotherFile {
Expand Down

0 comments on commit 9a26328

Please sign in to comment.