diff --git a/tests/e2e/upgrade/upgrade-master.wdio-spec.js b/tests/e2e/upgrade/upgrade-master.wdio-spec.js new file mode 100644 index 00000000000..d09bb49b6b4 --- /dev/null +++ b/tests/e2e/upgrade/upgrade-master.wdio-spec.js @@ -0,0 +1,38 @@ +const loginPage = require('@page-objects/default/login/login.wdio.page'); +const upgradePage = require('@page-objects/upgrade/upgrade.wdio.page'); +const commonPage = require('@page-objects/default/common/common.wdio.page'); +const aboutPage = require('@page-objects/default/about/about.wdio.page'); +const constants = require('@constants'); + +const upgradeVersion = async () => { + await upgradePage.goToUpgradePage(); + await upgradePage.expandPreReleasesAccordion(); + + await (await upgradePage.getInstallButton('master')).click(); + await (await upgradePage.upgradeModalConfirm()).click(); + + await (await upgradePage.cancelUpgradeButton()).waitForDisplayed(); + await (await upgradePage.deploymentInProgress()).waitForDisplayed(); + await (await upgradePage.deploymentInProgress()).waitForDisplayed({ reverse: true, timeout: 100000 }); + + await (await upgradePage.deploymentComplete()).waitForDisplayed(); +}; + + +describe('Performing an upgrade from current branch to master', () => { + it('should upgrade from current version to master', async () => { + await loginPage.cookieLogin({ + username: constants.USERNAME, + password: constants.PASSWORD, + createUser: false + }); + + await upgradeVersion('master'); + + expect(await upgradePage.getBuild()).to.include('alpha'); + await commonPage.goToAboutPage(); + await commonPage.waitForPageLoaded(); + await (await aboutPage.aboutCard()).waitForDisplayed(); + expect(await aboutPage.getVersion()).to.include('master'); + }); +}); diff --git a/tests/e2e/upgrade/upgrade.wdio-spec.js b/tests/e2e/upgrade/upgrade.wdio-spec.js index 4fedbedeaf3..c28067e7b03 100644 --- a/tests/e2e/upgrade/upgrade.wdio-spec.js +++ b/tests/e2e/upgrade/upgrade.wdio-spec.js @@ -147,25 +147,6 @@ describe('Performing an upgrade', () => { const expected = TAG || `${utils.escapeBranchName(BRANCH)} (`; expect(await aboutPage.getVersion()).to.include(expected); await commonPage.logout(); - - // https://github.com/medic/cht-core/issues/9117 - // install 'master' branch to make sure a new version can be installed from the build version - - await loginPage.cookieLogin({ - username: constants.USERNAME, - password: constants.PASSWORD, - createUser: false - }); - - await upgradeVersion('master'); - - expect(await upgradePage.getBuild()).to.include('alpha'); - await commonPage.goToAboutPage(); - await commonPage.waitForPageLoaded(); - await (await aboutPage.aboutCard()).waitForDisplayed(); - expect(await aboutPage.getVersion()).to.include('master'); - - await commonPage.logout(); }); it('should display upgrade page even without upgrade logs', async () => { diff --git a/tests/e2e/upgrade/wdio.conf.js b/tests/e2e/upgrade/wdio.conf.js index 4d70e4c3d5a..ae3b9972a28 100644 --- a/tests/e2e/upgrade/wdio.conf.js +++ b/tests/e2e/upgrade/wdio.conf.js @@ -13,7 +13,12 @@ const rpn = require('request-promise-native'); const utils = require('@utils'); const wdioBaseConfig = require('../../wdio.conf'); -const { MARKET_URL_READ, STAGING_SERVER, HAPROXY_PORT, BASE_VERSION } = process.env; +const { + MARKET_URL_READ='https://staging.dev.medicmobile.org', + STAGING_SERVER='_couch/builds_4', + HAPROXY_PORT, + BASE_VERSION='latest' +} = process.env; const CHT_COMPOSE_PROJECT_NAME = 'cht-upgrade'; const UPGRADE_SERVICE_DOCKER_COMPOSE_FOLDER = utils.makeTempDir('upgrade-service-'); @@ -123,8 +128,13 @@ const servicesStartTimeout = () => { // Override specific properties from wdio base config const upgradeConfig = Object.assign(wdioBaseConfig.config, { specs: + // order is important, because we want to upgrade from an older version to current version. validate the upgrade + // and then upgrade to master [ - '*.wdio-spec.js', + 'upgrade.wdio-spec.js', + 'admin-user.wdio-spec.js', + 'webapp.wdio-spec.js', + 'upgrade-master.wdio-spec.js', ], exclude: [], @@ -140,6 +150,7 @@ const upgradeConfig = Object.assign(wdioBaseConfig.config, { mochaOpts: { ui: 'bdd', timeout: TEST_TIMEOUT, + bail: true }, });