Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
4 changed files
with
144 additions
and
0 deletions.
There are no files selected for viewing
15 changes: 15 additions & 0 deletions
15
frontend/packages/noobaa-storage-plugin/integration-tests/mocks/obcData.ts
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,15 @@ | ||
import { testName } from '@console/internal-integration-tests/protractor.conf'; | ||
|
||
export const testBucket = { | ||
apiVersion: 'objectbucket.io/v1alpha1', | ||
kind: 'ObjectBucketClaim', | ||
metadata: { | ||
namespace: testName, | ||
name: 'test-bucket', | ||
}, | ||
spec: { | ||
ssl: false, | ||
storageClassName: 'openshift-storage.noobaa.io', | ||
generateBucketName: 'test-bucket', | ||
}, | ||
}; |
107 changes: 107 additions & 0 deletions
107
...packages/noobaa-storage-plugin/integration-tests/tests/objectSerivceDashboard.scenario.ts
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,107 @@ | ||
import { execSync } from 'child_process'; | ||
import { browser, ExpectedConditions as until } from 'protractor'; | ||
import { appHost } from '@console/internal-integration-tests/protractor.conf'; | ||
import { untilNoLoadersPresent } from '@console/internal-integration-tests/views/crud.view'; | ||
import { waitFor } from '@console/ceph-storage-plugin/integration-tests/utils/helpers'; | ||
import { OCP_HEALTH_ICON_COLORS } from '@console/ceph-storage-plugin/integration-tests/utils/consts'; | ||
import { | ||
efficiencyValue, | ||
healthOfMCG, | ||
noobaaCount, | ||
obcCount, | ||
resourceProviders, | ||
savingsValue, | ||
resiliencyOfMCG, | ||
} from '../views/noobaaDashboardPage.view'; | ||
import { testBucket } from '../mocks/obcData'; | ||
|
||
const loadAndWait = async () => { | ||
await browser.get(`${appHost}/dashboards/object-service`); | ||
await browser.wait(until.and(untilNoLoadersPresent)); | ||
}; | ||
|
||
describe('Tests Buckets Card', () => { | ||
beforeAll(async () => { | ||
await loadAndWait(); | ||
}); | ||
|
||
it('Test at least one noobaa bucket is present', async () => { | ||
await browser.wait(until.and(untilNoLoadersPresent)); | ||
await browser.wait(until.visibilityOf(noobaaCount)); | ||
const text = await noobaaCount.getText(); | ||
const [count] = text.split(' '); | ||
expect(Number(count)).toBeGreaterThanOrEqual(1); | ||
}); | ||
|
||
it('Create an Object Bucket Claim and test equality', async () => { | ||
await browser.wait(until.visibilityOf(obcCount)); | ||
let text = await obcCount.getText(); | ||
const [initialCount] = text.split(' '); | ||
execSync(`echo '${JSON.stringify(testBucket)}' | kubectl create -f -`); | ||
await waitFor(obcCount, (Number(initialCount) + 1).toString()); | ||
text = await obcCount.getText(); | ||
const [finalCount] = text.split(' '); | ||
expect(Number(finalCount)).toEqual(Number(initialCount) + 1); | ||
execSync(`echo '${JSON.stringify(testBucket)}' | kubectl delete -f -`); | ||
}); | ||
}); | ||
|
||
describe('Test Status Card', () => { | ||
beforeAll(async () => { | ||
await loadAndWait(); | ||
}); | ||
|
||
it('Check if Multi Cloud Gateway is in a healthy state', async () => { | ||
await browser.wait(until.and(untilNoLoadersPresent)); | ||
await browser.wait(until.visibilityOf(healthOfMCG)); | ||
const color = healthOfMCG.getAttribute('fill'); | ||
expect(color).toBe(OCP_HEALTH_ICON_COLORS.GREEN); | ||
}); | ||
|
||
it('Check if Data Resiliency of MCG is in healthy state', async () => { | ||
await browser.wait(until.visibilityOf(resiliencyOfMCG)); | ||
const color = healthOfMCG.getAttribute('fill'); | ||
expect(color).toBe(OCP_HEALTH_ICON_COLORS.GREEN); | ||
}); | ||
}); | ||
|
||
describe('Test Object Data Reduction Card', () => { | ||
beforeAll(async () => { | ||
await loadAndWait(); | ||
}); | ||
|
||
it('Check if Efficiency Ratio is in acceptable data range', async () => { | ||
await browser.wait(until.and(untilNoLoadersPresent)); | ||
await browser.wait(until.visibilityOf(efficiencyValue)); | ||
const effValue = await efficiencyValue.getText(); | ||
const [ratioA, ratioB] = effValue.split(':'); | ||
const [numA, numB] = [Number(ratioA), Number(ratioB)]; | ||
expect(numA).toBeGreaterThan(0); | ||
expect(numB).toBeGreaterThan(0); | ||
}); | ||
|
||
it('Check for savings value to be in acceptable data range', async () => { | ||
await browser.wait(until.visibilityOf(savingsValue)); | ||
const savVal = await savingsValue.getText(); | ||
const [savDigits] = savVal.split(' '); | ||
const numSav = Number(savDigits); | ||
if (Number.isNaN(numSav)) { | ||
expect(savVal.trim()).toEqual('No Savings'); | ||
} else { | ||
expect(numSav).toBeGreaterThanOrEqual(0); | ||
} | ||
}); | ||
}); | ||
|
||
describe('Test Resource Providers card', () => { | ||
beforeAll(async () => { | ||
await loadAndWait(); | ||
}); | ||
|
||
it('Check if resource provider has at least 1 provider', async () => { | ||
await browser.wait(until.and(untilNoLoadersPresent)); | ||
await browser.wait(until.visibilityOf(resourceProviders)); | ||
const text = await resourceProviders.getText(); | ||
expect(text).toBeDefined(); | ||
}); | ||
}); |
19 changes: 19 additions & 0 deletions
19
frontend/packages/noobaa-storage-plugin/integration-tests/views/noobaaDashboardPage.view.ts
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,19 @@ | ||
import { $ } from 'protractor'; | ||
|
||
export const noobaaCount = $('div:nth-child(1) > div.co-inventory-card__item-title'); | ||
export const obCount = $('div:nth-child(2) > div.co-inventory-card__item-title'); | ||
export const obcCount = $('div:nth-child(3) > div.co-inventory-card__item-title'); | ||
|
||
export const healthLoading = $('.skeleton-health'); | ||
export const healthOfMCG = $('div > div > div:nth-child(1) > div > div.co-dashboard-icon > svg'); | ||
export const resiliencyOfMCG = $( | ||
'div > div > div:nth-child(2) > div > div.co-dashboard-icon > svg', | ||
); | ||
export const efficiencyValue = $( | ||
'div:nth-child(1) > div.nb-object-data-reduction-card__row-status-item > span', | ||
); | ||
export const savingsValue = $( | ||
'div:nth-child(2) > div.nb-object-data-reduction-card__row-status-item > span', | ||
); | ||
|
||
export const resourceProviders = $('.nb-resource-providers-card__row-title'); |
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