a', `a\\a`, 'a/a', 'a?a', 'a:a', 'a|a'];
-
- for (const name of namesWithSpecialChars) {
- await createFromTemplateDialog.enterName(name);
- expect(await createFromTemplateDialog.isCreateButtonEnabled()).toBe(false, 'Create button is not disabled');
- expect(await createFromTemplateDialog.getValidationMessage()).toContain(`Name can't contain these characters`);
- }
- });
-
- it('[C325033] File name ending with a dot', async () => {
- await createFromTemplateDialog.enterName('file-name.');
-
- expect(await createFromTemplateDialog.isCreateButtonEnabled()).toBe(false, 'Create button is not disabled');
- expect(await createFromTemplateDialog.getValidationMessage()).toMatch(`Name can't end with a period .`);
- });
-
- it('[C325034] File name containing only spaces', async () => {
- await createFromTemplateDialog.enterName(' ');
-
- expect(await createFromTemplateDialog.isCreateButtonEnabled()).toBe(false, 'Create button is not disabled');
- expect(await createFromTemplateDialog.getValidationMessage()).toMatch(`Name can't contain only spaces`);
- });
-
- it('[C290146] Title too long', async () => {
- await createFromTemplateDialog.enterTitle(Utils.string257);
- await Utils.pressTab();
-
- expect(await createFromTemplateDialog.isCreateButtonEnabled()).toBe(false, 'Create button is not disabled');
- expect(await createFromTemplateDialog.getValidationMessage()).toMatch(`Use 256 characters or less for title`);
- });
-
- it('[C290142] Description too long', async () => {
- await createFromTemplateDialog.enterDescription(Utils.string513);
- await Utils.pressTab();
-
- expect(await createFromTemplateDialog.isCreateButtonEnabled()).toBe(false, 'Create button is not disabled');
- expect(await createFromTemplateDialog.getValidationMessage()).toMatch(`Use 512 characters or less for description`);
- });
- });
-
- describe('On Personal Files', () => {
- beforeEach(async () => {
- try {
- await page.clickPersonalFilesAndWait();
- await page.dataTable.doubleClickOnRowByName(parent);
- await toolbar.openCreateFileFromTemplateDialog();
- await selectTemplateDialog.waitForDialogToOpen();
- await selectTemplateDialog.dataTable.selectItem(template1InRootFolder);
- await selectTemplateDialog.clickNext();
- await createFromTemplateDialog.waitForDialogToOpen();
- } catch (error) {
- Logger.error(`----- beforeEach failed : ${error}`);
- }
- });
-
- it('[C325030] Create a file from a template - with a new Name', async () => {
- await createFromTemplateDialog.enterName(file1.name);
- await BrowserActions.click(createFromTemplateDialog.createButton);
- await createFromTemplateDialog.waitForDialogToClose();
- await page.dataTable.waitForHeader();
-
- expect(await page.dataTable.isItemPresent(file1.name)).toBe(true, 'File not displayed in list view');
- });
-
- it('[C325026] Create a file from a template - with a Name, Title and Description', async () => {
- await createFromTemplateDialog.enterName(file2.name);
- await createFromTemplateDialog.enterTitle(file2.title);
- await createFromTemplateDialog.enterDescription(file2.description);
-
- await BrowserActions.click(createFromTemplateDialog.createButton);
- await createFromTemplateDialog.waitForDialogToClose();
- await page.dataTable.waitForHeader();
-
- expect(await page.dataTable.isItemPresent(file2.name)).toBe(true, 'File not displayed in list view');
- const desc = await userApi.nodes.getNodeDescription(file2.name, parentId);
- expect(desc).toEqual(file2.description);
- const title = await userApi.nodes.getNodeTitle(file2.name, parentId);
- expect(title).toEqual(file2.title);
- });
-
- it('[C325028] Create a file with a duplicate name', async () => {
- await createFromTemplateDialog.enterName(duplicateFileName);
- await BrowserActions.click(createFromTemplateDialog.createButton);
-
- expect(await page.getSnackBarMessage()).toEqual(`This name is already in use, try a different name.`);
- expect(await createFromTemplateDialog.isDialogOpen()).toBe(true, 'dialog is not present');
- });
-
- it('[C325027] Cancel file creation', async () => {
- await createFromTemplateDialog.enterName('test');
- await createFromTemplateDialog.clickCancel();
-
- expect(await createFromTemplateDialog.isDialogOpen()).not.toBe(true, 'dialog is not closed');
- expect(await page.dataTable.isItemPresent('test')).toBe(false, 'File should not appear in the list');
- });
-
- it('[C325042] Trim spaces from file Name', async () => {
- await createFromTemplateDialog.enterName(nameWithSpaces);
- await BrowserActions.click(createFromTemplateDialog.createButton);
- await createFromTemplateDialog.waitForDialogToClose();
- await page.dataTable.waitForHeader();
-
- expect(await page.dataTable.isItemPresent(nameWithSpaces.trim())).toBe(true, 'File not displayed in list view');
- });
- });
-
- describe('On File Libraries', () => {
- const fileLibrariesPage = new BrowsingPage();
-
- beforeEach(async () => {
- try {
- await fileLibrariesPage.goToMyLibrariesAndWait();
- await page.dataTable.doubleClickOnRowByName(siteName);
- await toolbar.openCreateFileFromTemplateDialog();
- await selectTemplateDialog.waitForDialogToOpen();
- await selectTemplateDialog.dataTable.selectItem(template1InRootFolder);
- await selectTemplateDialog.clickNext();
- await createFromTemplateDialog.waitForDialogToOpen();
- } catch (error) {
- Logger.error(`----- beforeEach failed : ${error}`);
- }
- });
-
- it('[C325023] Create a file from a template - with Name, Title and Description', async () => {
- await createFromTemplateDialog.enterName(fileSite.name);
- await createFromTemplateDialog.enterTitle(fileSite.title);
- await createFromTemplateDialog.enterDescription(fileSite.description);
-
- await BrowserActions.click(createFromTemplateDialog.createButton);
- await createFromTemplateDialog.waitForDialogToClose();
- await page.dataTable.waitForHeader();
-
- expect(await page.dataTable.isItemPresent(fileSite.name)).toBe(true, 'File not displayed in list view');
- const desc = await userApi.nodes.getNodeDescription(fileSite.name, docLibUserSite);
- expect(desc).toEqual(fileSite.description);
- const title = await userApi.nodes.getNodeTitle(fileSite.name, docLibUserSite);
- expect(title).toEqual(fileSite.title);
- });
-
- it('[C325024] Cancel file creation', async () => {
- await createFromTemplateDialog.enterName('test');
- await createFromTemplateDialog.clickCancel();
-
- expect(await createFromTemplateDialog.isDialogOpen()).not.toBe(true, 'dialog is not closed');
- expect(await page.dataTable.isItemPresent('test')).toBe(false, 'File should not appear in the list');
- });
-
- it('[C325025] Create a file with a duplicate name', async () => {
- await createFromTemplateDialog.enterName(duplicateFileSite);
- await BrowserActions.click(createFromTemplateDialog.createButton);
-
- expect(await page.getSnackBarMessage()).toEqual(`This name is already in use, try a different name.`);
- expect(await createFromTemplateDialog.isDialogOpen()).toBe(true, 'dialog is not present');
- });
- });
- });
-});
diff --git a/projects/aca-content/src/lib/dialogs/node-template/create-from-template.dialog.html b/projects/aca-content/src/lib/dialogs/node-template/create-from-template.dialog.html
index e3f007132b..a2f375368f 100644
--- a/projects/aca-content/src/lib/dialogs/node-template/create-from-template.dialog.html
+++ b/projects/aca-content/src/lib/dialogs/node-template/create-from-template.dialog.html
@@ -42,7 +42,7 @@
-