diff --git a/cypress/integration/common/steps.js b/cypress/integration/common/steps.js index f411efa90..412c75e71 100644 --- a/cypress/integration/common/steps.js +++ b/cypress/integration/common/steps.js @@ -238,16 +238,16 @@ Given("we have the following comments in our database:", table => { }); Given("we have the following posts in our database:", table => { - table.hashes().forEach((attributesOrOptions, i) => { - cy.factory().build("post", { - ...attributesOrOptions, - deleted: Boolean(attributesOrOptions.deleted), - disabled: Boolean(attributesOrOptions.disabled), - pinned: Boolean(attributesOrOptions.pinned), - }, { - ...attributesOrOptions, - }); - }) + table.hashes().forEach((attributesOrOptions, i) => { + cy.factory().build("post", { + ...attributesOrOptions, + deleted: Boolean(attributesOrOptions.deleted), + disabled: Boolean(attributesOrOptions.disabled), + pinned: Boolean(attributesOrOptions.pinned), + }, { + ...attributesOrOptions, + }); + }) }) Then("I see a success message:", message => { diff --git a/cypress/support/factories.js b/cypress/support/factories.js index 5fac00759..483a83950 100644 --- a/cypress/support/factories.js +++ b/cypress/support/factories.js @@ -9,13 +9,7 @@ const neo4jConfigs = { } const neodeInstance = getNeode(neo4jConfigs) -export const cleanDatabase = () => { - return new Cypress.Promise((resolve, _reject) => { - return neodeInstance.cypher(' MATCH (everything) DETACH DELETE everything;') - .then(() => resolve()) - }) -} -beforeEach(() => cleanDatabase()) +beforeEach(() => cy.exec('yarn run db:reset')) Cypress.Commands.add('neode', () => { return neodeInstance