Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
cy.saveContent(rootContentNode).then((contentNode) => {
// Add an item under root node
const childContentNode = new ContentBuilder()
.withContentTypeAlias(createdChildDocType["alias"])
.withAction("saveNew")
.withParent(contentNode["id"])
.addVariant()
.withName(childNodeName)
.withSave(true)
.done()
.build();
cy.saveContent(childContentNode);
});
const anotherRootContentNode = new ContentBuilder()
.withContentTypeAlias(rootDocTypeAlias)
.withAction("saveNew")
.addVariant()
.withName(anotherNodeName)
.withSave(true)
.done()
.build();
cy.saveContent(anotherRootContentNode);
});
});
it('Rollback content', () => {
const rootDocTypeName = "Test document type";
const initialNodeName = "Home node";
const nodeName = "Home";
const rootDocType = new DocumentTypeBuilder()
.withName(rootDocTypeName)
.withAllowAsRoot(true)
.build();
cy.deleteAllContent();
cy.umbracoEnsureDocumentTypeNameNotExists(rootDocTypeName);
cy.saveDocumentType(rootDocType).then((generatedRootDocType) => {
const rootContentNode = new ContentBuilder()
.withContentTypeAlias(generatedRootDocType["alias"])
.addVariant()
.withName(initialNodeName)
.withSave(true)
.done()
.build();
it('Delete document type', () => {
const name = "Test document type";
cy.umbracoEnsureDocumentTypeNameNotExists(name);
const dataType = new DocumentTypeBuilder()
.withName(name)
.build();
cy.saveDocumentType(dataType);
cy.umbracoSection('settings');
cy.get('li .umb-tree-root:contains("Settings")').should("be.visible");
cy.umbracoTreeItem("settings", ["Document Types", name]).rightclick();
cy.umbracoContextMenuAction("action-delete").click();
cy.get('label.checkbox').click();
cy.umbracoButtonByLabelKey("general_ok").click();
it('Delete template', () => {
const name = "Test template";
cy.umbracoEnsureTemplateNameNotExists(name);
const template = new TemplateBuilder()
.withName(name)
.build();
cy.saveTemplate(template);
cy.umbracoSection('settings');
cy.get('li .umb-tree-root:contains("Settings")').should("be.visible");
cy.umbracoTreeItem("settings", ["Templates", name]).rightclick();
cy.umbracoContextMenuAction("action-delete").click();
cy.umbracoButtonByLabelKey("general_ok").click();
cy.contains(name).should('not.exist');
cy.umbracoEnsureTemplateNameNotExists(name);