Wrap intital navigation in method

This commit is contained in:
Nikolaj
2020-08-04 11:35:12 +02:00
parent 7d045fd0b3
commit 60791fb96f
@@ -5,19 +5,24 @@ context('Partial View Macro Files', () => {
cy.umbracoLogin(Cypress.env('username'), Cypress.env('password'));
});
it('Create new partial view macro', () => {
const name = "TestPartialViewMacro";
const fileName = name + ".cshtml";
cy.umbracoEnsurePartialViewMacroFileNameNotExists(fileName);
cy.umbracoEnsureMacroNameNotExists(name);
function navigateToSettings() {
cy.umbracoSection('settings');
cy.get('li .umb-tree-root:contains("Settings")').should("be.visible");
cy.umbracoTreeItem("settings", ["Partial View Macro Files"]).rightclick();
}
it('Create new partial view macro', () => {
const name = "TestPartialViewMacro";
const fileName = name + ".cshtml";
cy.umbracoEnsureMacroNameNotExists(name);
cy.umbracoEnsurePartialViewMacroFileNameNotExists(fileName);
navigateToSettings();
cy.umbracoContextMenuAction("action-create").click();
cy.get('.menu-label').first().click(); // TODO: Fucked we cant use something like cy.umbracoContextMenuAction("action-label").click();
//Type name
@@ -39,14 +44,12 @@ context('Partial View Macro Files', () => {
const fileName = name + ".cshtml";
cy.umbracoEnsurePartialViewMacroFileNameNotExists(fileName);
cy.umbracoEnsureMacroNameNotExists(fileName);
cy.umbracoEnsureMacroNameNotExists(name);
cy.umbracoSection('settings');
cy.get('li .umb-tree-root:contains("Settings")').should("be.visible");
cy.umbracoTreeItem("settings", ["Partial View Macro Files"]).rightclick();
navigateToSettings();
cy.umbracoContextMenuAction("action-create").click();
cy.get('.menu-label').eq(1).click();
// Type name
@@ -67,15 +70,13 @@ context('Partial View Macro Files', () => {
const name = "TestPartialFromSnippet";
const fileName = name + ".cshtml";
cy.umbracoEnsureMacroNameNotExists(fileName);
cy.umbracoEnsureMacroNameNotExists(fileName);
cy.umbracoEnsureMacroNameNotExists(name);
cy.umbracoEnsurePartialViewMacroFileNameNotExists(fileName);
cy.umbracoSection('settings');
cy.get('li .umb-tree-root:contains("Settings")').should("be.visible");
cy.umbracoTreeItem("settings", ["Partial View Macro Files"]).rightclick();
navigateToSettings();
cy.umbracoContextMenuAction("action-create").click();
cy.get('.menu-label').eq(2).click();
// Select snippet