From 05be3aa62a53654708cab795c05f1accdf15783b Mon Sep 17 00:00:00 2001 From: Michael Krasnov Date: Tue, 21 May 2024 08:40:32 -0400 Subject: [PATCH] TECH-654 - added workspace argument to deleteNode --- fixtures/graphql/jcr/mutation/deleteNode.graphql | 4 ++-- src/utils/JCRHelper.ts | 9 ++++++--- 2 files changed, 8 insertions(+), 5 deletions(-) diff --git a/fixtures/graphql/jcr/mutation/deleteNode.graphql b/fixtures/graphql/jcr/mutation/deleteNode.graphql index 61a5312..11c292d 100644 --- a/fixtures/graphql/jcr/mutation/deleteNode.graphql +++ b/fixtures/graphql/jcr/mutation/deleteNode.graphql @@ -1,5 +1,5 @@ -mutation deleteNode($pathOrId: String!) { - jcr(workspace: EDIT) { +mutation deleteNode($pathOrId: String!, $workspace: Workspace!) { + jcr(workspace: $workspace) { deleteNode(pathOrId: $pathOrId) } } \ No newline at end of file diff --git a/src/utils/JCRHelper.ts b/src/utils/JCRHelper.ts index dc8b90f..beeb6ca 100644 --- a/src/utils/JCRHelper.ts +++ b/src/utils/JCRHelper.ts @@ -1,3 +1,5 @@ +type Workspace = 'EDIT' | 'LIVE'; + export const setNodeProperty = (pathOrId: string, property: string, value: string | Array, language: string): Cypress.Chainable => { let mutationFile = 'graphql/jcr/mutation/setProperty.graphql'; if (value instanceof Array) { @@ -15,10 +17,11 @@ export const setNodeProperty = (pathOrId: string, property: string, value: strin }); }; -export const deleteNode = (pathOrId: string): Cypress.Chainable => { +export const deleteNode = (pathOrId: string, workspace: Workspace = 'EDIT'): Cypress.Chainable => { return cy.apollo({ variables: { - pathOrId: pathOrId + pathOrId: pathOrId, + workspace }, mutationFile: 'graphql/jcr/mutation/deleteNode.graphql' }); @@ -43,7 +46,7 @@ export const addNode = (variables: { parentPathOrId: string, primaryNodeType: st }); }; -export const getNodeByPath = (path: string, properties?: string[], language?: string, childrenTypes: string[] = [], workspace: 'EDIT' | 'LIVE' = 'EDIT'): Cypress.Chainable => { +export const getNodeByPath = (path: string, properties?: string[], language?: string, childrenTypes: string[] = [], workspace: Workspace = 'EDIT'): Cypress.Chainable => { return cy.apollo({ variables: { path: path,