diff --git a/cypress/utils/steps.js b/cypress/utils/steps.js index 3eec5a5b..3521e8c5 100644 --- a/cypress/utils/steps.js +++ b/cypress/utils/steps.js @@ -278,21 +278,29 @@ function createPostAndExit(entry) { exitEditor(); } +function advanceClock(clock) { + if (clock) { + // https://github.com/cypress-io/cypress/issues/1273 + clock.tick(150); + clock.tick(150); + // eslint-disable-next-line cypress/no-unnecessary-waiting + cy.wait(500); + } +} + function publishEntry({ createNew = false, duplicate = false } = {}) { cy.clock().then(clock => { // some input fields are de-bounced thus require advancing the clock - if (clock) { - // https://github.com/cypress-io/cypress/issues/1273 - clock.tick(150); - clock.tick(150); - // eslint-disable-next-line cypress/no-unnecessary-waiting - cy.wait(500); - } + advanceClock(clock); if (createNew) { + advanceClock(clock); selectDropdownItem('Publish', publishTypes.publishAndCreateNew); + advanceClock(clock); } else if (duplicate) { + advanceClock(clock); selectDropdownItem('Publish', publishTypes.publishAndDuplicate); + advanceClock(clock); } else { selectDropdownItem('Publish', publishTypes.publishNow); } diff --git a/yarn.lock b/yarn.lock index f63bd5ed..5cb523fe 100644 --- a/yarn.lock +++ b/yarn.lock @@ -6381,9 +6381,9 @@ cypress-plugin-tab@^1.0.0: ally.js "^1.4.1" cypress@^4.6.0: - version "4.7.0" - resolved "https://registry.yarnpkg.com/cypress/-/cypress-4.7.0.tgz#3ea29bddaf9a1faeaa5b8d54b60a84ed1cafa83d" - integrity sha512-Vav6wUFhPRlImIND/2lOQlUnAWzgCC/iXyJlJjX9nJOJul5LC1vUpf/m8Oiae870PFPyT0ZLLwPHKTXZNdXmHw== + version "4.8.0" + resolved "https://registry.yarnpkg.com/cypress/-/cypress-4.8.0.tgz#8fe731db77f39310511d83e81439d06ae3388554" + integrity sha512-Lsff8lF8pq6k/ioNua783tCsxGSLp6gqGXecdIfqCkqjYiOA53XKuEf1CaQJLUVs1dHSf49eDUp/sb620oJjVQ== dependencies: "@cypress/listr-verbose-renderer" "0.4.1" "@cypress/request" "2.88.5" @@ -7786,9 +7786,9 @@ fast-deep-equal@^2.0.1: integrity sha1-ewUhjd+WZ79/Nwv3/bLLFf3Qqkk= fast-deep-equal@^3.1.1: - version "3.1.1" - resolved "https://registry.yarnpkg.com/fast-deep-equal/-/fast-deep-equal-3.1.1.tgz#545145077c501491e33b15ec408c294376e94ae4" - integrity sha512-8UEa58QDLauDNfpbrX55Q9jrGHThw2ZMdOky5Gl1CDtVeJDPVrG4Jxx1N8jw2gkWaff5UUuX1KJd+9zGe2B+ZA== + version "3.1.3" + resolved "https://registry.yarnpkg.com/fast-deep-equal/-/fast-deep-equal-3.1.3.tgz#3a7d56b559d6cbc3eb512325244e619a65c6c525" + integrity sha512-f3qQ9oQy9j2AhBe/H9VC91wLmKBCCU/gDOnKNAYG5hswO7BLKj09Hc5HYNz9cGI++xlpDCIgDaitVs03ATR84Q== fast-diff@^1.1.2: version "1.2.0"