diff --git a/cypress/integration/editorial_workflow_spec_proxy_backend.js b/cypress/integration/editorial_workflow_spec_proxy_backend.js index f6ab26ec..db4b1021 100644 --- a/cypress/integration/editorial_workflow_spec_proxy_backend.js +++ b/cypress/integration/editorial_workflow_spec_proxy_backend.js @@ -9,6 +9,7 @@ describe('Proxy Backend Editorial Workflow', () => { before(() => { specUtils.before(taskResult, { publish_mode: 'editorial_workflow' }, backend); + Cypress.config('defaultCommandTimeout', 5 * 1000); }); after(() => { diff --git a/cypress/integration/media_library_spec_proxy_backend.js b/cypress/integration/media_library_spec_proxy_backend.js index c7c2ea76..6f2b6859 100644 --- a/cypress/integration/media_library_spec_proxy_backend.js +++ b/cypress/integration/media_library_spec_proxy_backend.js @@ -9,6 +9,7 @@ describe('Proxy Backend Media Library - REST API', () => { before(() => { specUtils.before(taskResult, { publish_mode: 'editorial_workflow' }, backend); + Cypress.config('defaultCommandTimeout', 5 * 1000); }); after(() => { diff --git a/cypress/integration/simple_workflow_spec_proxy_backend.js b/cypress/integration/simple_workflow_spec_proxy_backend.js index 4046142d..3638a402 100644 --- a/cypress/integration/simple_workflow_spec_proxy_backend.js +++ b/cypress/integration/simple_workflow_spec_proxy_backend.js @@ -9,6 +9,7 @@ describe('Proxy Backend Simple Workflow', () => { before(() => { specUtils.before(taskResult, { publish_mode: 'simple' }, backend); + Cypress.config('defaultCommandTimeout', 5 * 1000); }); after(() => { diff --git a/cypress/utils/steps.js b/cypress/utils/steps.js index ce38e383..7144d660 100644 --- a/cypress/utils/steps.js +++ b/cypress/utils/steps.js @@ -33,7 +33,7 @@ function assertNotification(message) { cy.get('.notif__container').within(() => { cy.contains(message); // eslint-disable-next-line cypress/no-unnecessary-waiting - cy.wait(100); + cy.wait(500); cy.contains(message).invoke('hide'); }); } @@ -136,19 +136,21 @@ function assertOnCollectionsPage() { } function assertEntryDeleted(entry) { - const hasEntries = Cypress.$('a h2').length > 0; - if (hasEntries) { - if (Array.isArray(entry)) { - const titles = entry.map(e => e.title); - cy.get('a h2').each(el => { - expect(titles).not.to.include(el.text()); - }); - } else { - cy.get('a h2').each(el => { - expect(entry.title).not.to.equal(el.text()); - }); + cy.get('body').then($body => { + const entriesHeaders = $body.find('a h2'); + if (entriesHeaders.length > 0) { + if (Array.isArray(entry)) { + const titles = entry.map(e => e.title); + cy.get('a h2').each(el => { + expect(titles).not.to.include(el.text()); + }); + } else { + cy.get('a h2').each(el => { + expect(entry.title).not.to.equal(el.text()); + }); + } } - } + }); } function assertWorkflowStatus({ title }, status) { diff --git a/packages/netlify-cms-proxy-server/src/middlewares/localGit/index.ts b/packages/netlify-cms-proxy-server/src/middlewares/localGit/index.ts index 14553606..3514d451 100644 --- a/packages/netlify-cms-proxy-server/src/middlewares/localGit/index.ts +++ b/packages/netlify-cms-proxy-server/src/middlewares/localGit/index.ts @@ -214,6 +214,34 @@ const commitEntry = async ( await commit(git, commitMessage, [entry.path, ...assets.map(a => a.path)]); }; +const rebase = async (git: simpleGit.SimpleGit, branch: string) => { + const gpgSign = await git.raw(['config', 'commit.gpgsign']); + try { + if (gpgSign === 'true') { + await git.addConfig('commit.gpgsign', 'false'); + } + await git.rebase([branch, '--no-verify']); + } finally { + if (gpgSign === 'true') { + await git.addConfig('commit.gpgsign', gpgSign); + } + } +}; + +const merge = async (git: simpleGit.SimpleGit, from: string, to: string) => { + const gpgSign = await git.raw(['config', 'commit.gpgsign']); + try { + if (gpgSign === 'true') { + await git.addConfig('commit.gpgsign', 'false'); + } + await git.mergeFromTo(from, to); + } finally { + if (gpgSign === 'true') { + await git.addConfig('commit.gpgsign', gpgSign); + } + } +}; + const isBranchExists = async (git: simpleGit.SimpleGit, branch: string) => { const branchExists = await git.branchLocal().then(({ all }) => all.includes(branch)); return branchExists; @@ -357,7 +385,7 @@ export const localGitMiddleware = ({ repoPath }: Options) => { } else { await git.checkoutLocalBranch(cmsBranch); } - await git.rebase([branch, '--no-gpg-sign', '--no-gpg-sign']); + await rebase(git, branch); const diff = await git.diffSummary([branch, cmsBranch]); const data = await getEntryDataFromDiff( git, @@ -398,7 +426,7 @@ export const localGitMiddleware = ({ repoPath }: Options) => { const { collection, slug } = body.params as PublishUnpublishedEntryParams; const contentKey = generateContentKey(collection, slug); const cmsBranch = branchFromContentKey(contentKey); - await git.mergeFromTo(cmsBranch, branch); + await merge(git, cmsBranch, branch); await git.deleteLocalBranch(cmsBranch); res.json({ message: `branch ${cmsBranch} merged to ${branch}` }); break;