Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

exui-2102 using as a comparison for approve org to investigate how it works. #1318

Open
wants to merge 14 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
156 changes: 24 additions & 132 deletions Jenkinsfile_CNP
Original file line number Diff line number Diff line change
Expand Up @@ -7,20 +7,16 @@ properties([
projectUrlStr: 'https://github.com/hmcts/rpx-xui-manage-organisations'
],
pipelineTriggers([
[$class: 'GitHubPushTrigger']
cron('H 07 * * 1-5')
])
])

@Library("Infrastructure")

//To enable PACT testing on pipeline uncomment the next line
import uk.gov.hmcts.contino.AppPipelineDsl

def type = "nodejs"
def product = "xui"
def component = "mo-webapp"
def channel = '#xui-pipeline'
def yarnBuilder = new uk.gov.hmcts.contino.YarnBuilder(this)

def secrets = [
'rpx-${env}': [
Expand All @@ -39,163 +35,59 @@ def secrets = [
secret('launch-darkly-client-id', 'LAUNCH_DARKLY_CLIENT_ID'),
secret('system-user-name', 'SYSTEM_USER_NAME'),
secret('system-user-password', 'SYSTEM_USER_PASSWORD'),
secret('mo-webapp-redis6-connection-string', 'REDISCLOUD_URL'),

secret('mo-webapp-redis6-connection-string', 'REDISCLOUD_URL')
],
]

def branchesToSync = ['demo', 'perftest', 'ithc']

static LinkedHashMap<String, Object> secret(String secretName, String envVar) {
[ $class: 'AzureKeyVaultSecret',
secretType: 'Secret',
name: secretName,
version: '',
envVariable: envVar
]
[ $class: 'AzureKeyVaultSecret',
secretType: 'Secret',
name: secretName,
version: '',
envVariable: envVar
]
}

withPipeline(type, product, component) {
disableCleanupOfHelmReleaseOnFailure()
withNightlyPipeline(type, product, component) {
enableSlackNotifications(channel)
loadVaultSecrets(secrets)
enableAksStagingDeployment()
syncBranchesWithMaster(branchesToSync)

enablePactAs([
AppPipelineDsl.PactRoles.CONSUMER
])
// enableFortifyScan('rpx-aat')
// enableFullFunctionalTest(120)
// enableSecurityScan()
enableCrossBrowserTest()

env.TEST_URL = 'https://manage-org.aat.platform.hmcts.net/'
afterSuccess('checkout') {sh 'yarn cache clean'}
afterSuccess('build') {
yarnBuilder.yarn('build')
}

afterSuccess('test') {

publishHTML ( [
allowMissing : true,
alwaysLinkToLastBuild: true,
keepAll : true,
reportDir : "reports/tests/coverage/node",
reportFiles : "index.html",
reportName : "node coverage tests"
])

publishHTML ( [
allowMissing : true,
alwaysLinkToLastBuild: true,
keepAll : true,
reportDir : "reports/tests/coverage/ng",
reportFiles : "index.html",
reportName : "ng coverage tests"
])

sh 'npm run build'
publishHTML([
allowMissing : true,
alwaysLinkToLastBuild: true,
keepAll : true,
reportDir : "reports/tests/a11y/",
reportFiles : 'Report.html',
reportName : 'Manage Org a11y Test'
])




}

// after('smoketest:demo') {
// publishHTML([
// allowMissing : true,
// alwaysLinkToLastBuild: true,
// keepAll : true,
// reportDir : "reports/tests/smoke/",
// reportFiles : 'index.html',
// reportName : 'DEMO Smoke Test'
// ])
// }

afterSuccess('smoketest:preview') {
publishHTML([
allowMissing : true,
alwaysLinkToLastBuild: true,
keepAll : true,
reportDir : "reports/tests/api_functional/",
reportFiles : 'mochawesome.html',
reportName : 'PREVIEW API Test'
])

publishHTML([
allowMissing : true,
alwaysLinkToLastBuild: true,
keepAll : true,
reportDir : "reports/smoke_tests/functional",
reportDir : "test/reports/lint/node/",
reportFiles : 'index.html',
reportName : 'PREVIEW Manage Org Smoke Test'
reportName : 'node lint Report'
])
}

afterSuccess('functionalTest:preview') {

publishHTML([
allowMissing : true,
alwaysLinkToLastBuild: true,
keepAll : true,
reportDir : "reports/tests/api_functional/",
reportFiles : 'mochawesome.html',
reportName : 'PREVIEW API Functional Test'
])

publishHTML([
allowMissing : true,
alwaysLinkToLastBuild: true,
keepAll : true,
reportDir : "reports/tests/functional/",
reportDir : "test/reports/lint/ng/",
reportFiles : 'index.html',
reportName : 'PREVIEW Functional Test'
reportName : 'ng lint Report'
])
}


afterSuccess('smoketest:aat') {
publishHTML([
allowMissing : true,
alwaysLinkToLastBuild: true,
keepAll : true,
reportDir : "reports/tests/api_functional/",
reportFiles : 'mochawesome.html',
reportName : 'API Smoke Test'
])

publishHTML([
allowMissing : true,
alwaysLinkToLastBuild: true,
keepAll : true,
reportDir : "reports/smoke_tests/functional",
reportFiles : 'index.html',
reportName : 'AAT Manage Org Smoke Test'
])
}

afterSuccess('functionalTest:aat') {

publishHTML([
allowMissing : true,
alwaysLinkToLastBuild: true,
keepAll : true,
reportDir : "reports/tests/api_functional/",
reportFiles : 'mochawesome.html',
reportName : 'API Functional Test'
])

afterSuccess('crossBrowserTest') {
publishHTML([
allowMissing : true,
alwaysLinkToLastBuild: true,
keepAll : true,
reportDir : "reports/tests/functional/",
reportDir : "reports/tests/crossbrowser/",
reportFiles : 'index.html',
reportName : 'AAT Functional Test'
reportName : 'XUI Manage Organisation Cross Browser Tests'
])
steps.archiveArtifacts allowEmptyArchive: true, artifacts: 'build/reports/tests/crossbrowser/**/*'
}

}
4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@
"test:functional": "yarn build && node ./test_codecept/backendMock/configCopy.js && NODE_CONFIG_ENV=mock && yarn playwright install chromium && yarn test:api && yarn run test:xuiIntegration && yarn run test:codeceptE2E && yarn run test:a11yInTest",
"test:functional:backup": "webdriver-manager update --versions.chrome 2.40 && protractor ./test/e2e/config/functional.conf.js",
"test:functional:local": "webdriver-manager update --versions.chrome 2.40 && protractor ./test/e2e/config/functional.conf.js --local",
"test:fullfunctional": "yarn test:api && yarn run test:codeceptE2E",
"test:fullfunctional": "yarn run test:codeceptE2E",
"test:fullfunctional:local": "webdriver-manager update --versions.chrome 2.40 && protractor ./test/e2e/config/fullfunctional.conf.js --local",
"test:mutation": "echo 'not implemented'",
"test:mutation:fix": "NODE_ENV=development npx nyc stryker run stryker.node.conf.js ",
Expand Down Expand Up @@ -251,5 +251,5 @@
"minimist": "^1.2.8",
"loader-utils": "~2.0.3"
},
"packageManager": "[email protected].4"
"packageManager": "[email protected].3"
}
5 changes: 5 additions & 0 deletions test/e2e/features/step_definitions/loginLogout.steps.js
Original file line number Diff line number Diff line change
Expand Up @@ -25,14 +25,19 @@ async function waitForElement(el) {

When(/^I navigate to manage organisation Url$/, { timeout: 600 * 1000 }, async function () {
const world = this;
console.log('in I navigate to manage organisation Url !!!!!!!!!!!');
await browser.driver.manage().deleteAllCookies();
await browser.get(config.config.baseUrl);
console.log('browser.get(config.config.baseUrl) !!!!!!!!!!!' + config.config.baseUrl);
console.log('browser name !!!!!!!!!!!' + browser.browserName);
console.log('calling browserWaits.waitForElement(loginPage.emailAddress) !!!!!!!!!!!');
await browserWaits.retryWithAction(loginPage.emailAddress, async function (message) {
const stream = await browser.takeScreenshot();
const decodedImage = new Buffer(stream.replace(/^data:image\/(png|gif|jpeg);base64,/, ''), 'base64');
world.attach(decodedImage, 'image/png');
await browser.get(config.config.baseUrl);
});
console.log('calling browserWaits.waitForElement(loginPage.emailAddress) !!!!!!!!!!!');
await browserWaits.waitForElement(loginPage.emailAddress, LONG_DELAY, 'IDAM login page Email Address input not present');
});

Expand Down
7 changes: 7 additions & 0 deletions test/e2e/support/customWaits.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,12 @@ class BrowserWaits {
}

async waitForElement(waitelement, customWait, message) {
console.log('in waitForElement');
console.log('browser type is: ' + browser.browserName);
console.log('waitelement is: ' + waitelement.toString());
console.log('element type of -> ' + typeof(waitelement));
console.log('element stringify -> ' + JSON.stringify(waitelement));
console.log('element.locator.toString is: ' + waitelement.locator().toString());
await browser.wait(EC.visibilityOf(waitelement), customWait ? customWait : this.waitTime, 'Error : ' + waitelement.locator().toString() + (message ? ' => ' + message : '_'));
}

Expand Down Expand Up @@ -85,6 +91,7 @@ class BrowserWaits {

while (retryCounter < 3) {
try {
console.log('in retryWithAction, element: ' + element.value);
await this.waitForElement(element, 15000);
retryCounter += 3;
} catch (err) {
Expand Down
16 changes: 11 additions & 5 deletions test_codecept/codeceptCommon/browser.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@
const helper = require('codeceptjs').helper;

function getActor(){
console.log('in getActor()');
console.log('actor() --> ' + actor());
return actor().retry({ retries: 3, minTimeout: 30 });
}

Expand Down Expand Up @@ -72,13 +74,17 @@ class Browser{
}

async get(url){
console.log('in Browser get');
console.log('url --> ' + url);
console.log('getActor() --> ' + getActor());
console.log('getActor().amOnPage --> ' + getActor().amOnPage);
await getActor().amOnPage(url);
}

async getCurrentUrl(){
return await getActor().grabCurrentUrl()
}

async refresh(){
const url = await this.getCurrentUrl();
await this.get(url);
Expand All @@ -91,15 +97,15 @@ class Browser{
}catch(err){

}

}

async executeScript(fn, element){
return getActor().executeScript(fn, element.selector);
return getActor().executeScript(fn, element.selector);
}

async getBrowserLogs(){
return await getActor().grabBrowserLogs();
return await getActor().grabBrowserLogs();
}

async captureBrowserLogs(){
Expand All @@ -114,7 +120,7 @@ class Browser{
async getSessionStorage(key) {
return await getActor().executeScript((key) => {
return window.sessionStorage[key]
},key);
},key);
}

async getLocalStorage(key) {
Expand Down