forked from openshift/console
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
(tests) Adds first iteration of E2E tests for cluster upgrades
- Loading branch information
Showing
8 changed files
with
122 additions
and
13 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -9,3 +9,4 @@ | |
/frontend/public/dist | ||
/frontend/npm-debug.log | ||
/frontend/yarn-error.log | ||
/frontend/tests_output |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
module.exports = { | ||
elements: { | ||
expandClusterUpdatesLink: { | ||
selector: '#expand-cluster-updates' | ||
}, | ||
showDetailsLink: { | ||
selector: '//button[contains(@class, "co-cluster-updates__operator-show-details")]', | ||
locateStrategy: 'xpath' | ||
}, | ||
channelState: { | ||
selector: '#channel-state' | ||
}, | ||
updatesButton: { | ||
selector: '//button[contains(@class, "co-cluster-updates__action-button")]', | ||
locateStrategy: 'xpath' | ||
}, | ||
uptoDateDiv: { | ||
selector: '//div[contains(@class, "co-cluster-updates__operator-icon co-cluster-updates__operator-icon--up-to-date")]', | ||
locateStrategy: 'xpath' | ||
}, | ||
pendingUpdatesDiv: { | ||
selector: '//div[contains(@class, "co-cluster-updates__operator-icon co-cluster-updates__operator-icon--pending")]', | ||
locateStrategy: 'xpath' | ||
}, | ||
updatingSpan: { | ||
selector: '//span[contains(@class, "co-cluster-updates__operator-subheader")]', | ||
locateStrategy: 'xpath' | ||
}, | ||
updateTCODiv: { | ||
selector: '//div[@data-id="Update Tectonic Operators"]', | ||
locateStrategy: 'xpath' | ||
}, | ||
updateAppVersionDiv: { | ||
selector: '//div[@data-id="Update AppVersion components"]', | ||
locateStrategy: 'xpath' | ||
}, | ||
cleanupStatusDiv: { | ||
selector: '//div[@data-id="Cleanup unwanted old resources"]', | ||
locateStrategy: 'xpath' | ||
} | ||
} | ||
}; |
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,65 @@ | ||
const _ = require('lodash'); | ||
const TIMEOUT = 4000; | ||
const UPGRADE_TIMEOUT = 10000; | ||
|
||
const clusterUpgradeTests_ = {}; | ||
|
||
const initTest = (browser, cb) => { | ||
const clusterUpgradePage = browser.page.clusterUpgradePage(); | ||
const url = `${browser.launch_url}/settings/cluster`; | ||
clusterUpgradePage | ||
.navigate(url) | ||
.waitForElementVisible('@expandClusterUpdatesLink', TIMEOUT) | ||
.click('@expandClusterUpdatesLink') | ||
.getText('@channelState', ({value}) => cb(value, clusterUpgradePage)); | ||
}; | ||
|
||
const assertChannelState = (channelState, client) => { | ||
console.log(`Asserting State for ${channelState}`); | ||
if (channelState === 'Up to date') { | ||
client.expect.element('@uptoDateDiv').to.be.visible; | ||
} else if (_.endsWith(channelState, 'is available')) { | ||
client.expect.element('@pendingUpdatesDiv').to.be.visible; | ||
} else if (channelState === 'Updating' || channelState === 'Paused...') { | ||
client.expect.element('@updatingSpan').to.be.visible; | ||
} | ||
}; | ||
|
||
const assertUpdatingStatus = (channelState, client) => { | ||
console.log(`Asserting Status for ${channelState}`); | ||
client.expect.element('@updateTCODiv').to.be.visible; | ||
client.expect.element('@updateAppVersionDiv').to.be.visible; | ||
client.expect.element('@cleanupStatusDiv').to.be.visible; | ||
}; | ||
|
||
clusterUpgradeTests_['Check for Updates'] = browser => { | ||
initTest(browser, assertChannelState); | ||
}; | ||
|
||
clusterUpgradeTests_['Trigger Updates'] = browser => { | ||
initTest(browser, (channelState, clusterUpgradePage) => { | ||
if (channelState !== 'Up to date') { | ||
if (_.endsWith(channelState, 'is available') || channelState === 'Paused...') { | ||
clusterUpgradePage.click('@updatesButton') | ||
.waitForElementVisible('@showDetailsLink', TIMEOUT); | ||
} else if (channelState === 'Updating') { | ||
clusterUpgradePage.click('@showDetailsLink'); | ||
} | ||
|
||
clusterUpgradePage.click('@showDetailsLink'); | ||
assertUpdatingStatus(channelState, clusterUpgradePage); | ||
//TODO: [amrutac] This could take longer, figure out a way to retry this test. | ||
clusterUpgradePage.waitForElementVisible('@uptoDateDiv', UPGRADE_TIMEOUT) | ||
.getText('@channelState', ({value}) => { | ||
clusterUpgradePage.verify.equal(value, 'Up to date'); | ||
}); | ||
} else { | ||
console.log('Updates are not available at this time.'); | ||
} | ||
|
||
}); | ||
}; | ||
|
||
clusterUpgradeTests_.after = browser => browser.end(); | ||
|
||
module.exports = clusterUpgradeTests_; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters