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

Added tests for object service dashboard page #3555

Merged

Conversation

bipuladh
Copy link
Contributor

@bipuladh bipuladh commented Nov 24, 2019

Integration for Object Service Dashboard
Todo:

  • Add "id" for better for CSS selection.

@openshift-ci-robot openshift-ci-robot added do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress. size/M Denotes a PR that changes 30-99 lines, ignoring generated files. approved Indicates a PR has been approved by an approver from all required OWNERS files. component/noobaa Related to noobaa-storage-plugin labels Nov 24, 2019
let text = await obcCount.getText();
const initialCount = text.substring(0, 1);
// Go to create form page
await browser.get(
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Aren't we supposed to click on "Create OBC" button and expect to be redirected to this link, instead of just redirecting to the URL?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes but will be following a different approach, will use kubectl to create obc.


it('Checks whether MCG is healthy', async () => {
await browser.get(`${appHost}/dashboards/object-service`);
expect(clusterHealth.isPresent()).toBeFalsy();
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why are we expecting it to be false?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

because there is no message for healthy status only for unhealthy and error states.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please add a comment to the code.

@gnehapk
Copy link
Contributor

gnehapk commented Nov 26, 2019

It seems that you have added tests for all cards here. Its better to have separate describe block for each card as looking at this PR, its not easy to identify test for each card. @bipuladh

Copy link
Member

@umangachapagain umangachapagain left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I believe we also need to add Snapshot tests (RFE) to ensure that the Pages load in the structure we expect it to have.

Otherwise, selection like below might break without any traces

export const obcCount = $(
  '#content-scrollable > div:nth-child(2) > div > div > div > div > div:nth-child(1) > div > div:nth-child(3) > article > div.pf-c-card__body.co-dashboard-card__body > div:nth-child(2) > div.nb-buckets-card__row-title > div:nth-child(1)',
);

beforeAll(async () => {
await browser.get(`${appHost}/dashboards/object-service`);
});
it('Creates an Object Bucket Claim and test equality', async () => {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
it('Creates an Object Bucket Claim and test equality', async () => {
it('Creates an Object Bucket Claim and tests equality', async () => {

@umangachapagain
Copy link
Member

Run linter to ensure uniform formatting.

@bipuladh
Copy link
Contributor Author

@umangachapagain this code has been linted. Hence the frontend tests are passing.

@umangachapagain
Copy link
Member

@umangachapagain this code has been linted. Hence the frontend tests are passing.

But there are some inconsistent new line issues between line 25 and 26, and 28 and 29.

@openshift-ci-robot openshift-ci-robot added component/dashboard Related to dashboard component/shared Related to console-shared size/L Denotes a PR that changes 100-499 lines, ignoring generated files. and removed size/M Denotes a PR that changes 30-99 lines, ignoring generated files. approved Indicates a PR has been approved by an approver from all required OWNERS files. labels Nov 26, 2019
@bipuladh bipuladh changed the title [WIP] Added tests for object service dashboard page Added tests for object service dashboard page Nov 26, 2019
@openshift-ci-robot openshift-ci-robot removed the do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress. label Nov 26, 2019
@bipuladh
Copy link
Contributor Author

/assign @rhrazdil

Copy link
Member

@umangachapagain umangachapagain left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Changes to the component itself should not be a part of this PR. Or, atleast should be in a separate commit with a little explanation on why it was done. (purely based on the processes that I have seen)

@bipuladh
Copy link
Contributor Author

@umangachapagain agreed. IMO these changes will make more sense when they are accompanied by the use case. And the owners of those particular components might be able to give a better approach(possibly using a different tag). These changes aren't structural changes but are only the addition of identifier tags which would not change the layout/behaviour of these components and would not make sense to add without any pretext to add them.

Copy link

@rhrazdil rhrazdil left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested a few changes

let text = await obcCount.getText();
const initialCount = text.substring(0, 1);
await execSync(`echo '${JSON.stringify(testBucket)}' | kubectl create -n ${testName} -f -`);
await browser.sleep(10000);
Copy link

@rhrazdil rhrazdil Nov 26, 2019

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It would be much nicer to wait for some condition. You can take a look here how simple waiting method implementation can look:

export const waitForCount = (elementArrayFinder: ElementArrayFinder, targetCount: number) => {

and here how it's used:
await browser.wait(until.and(waitForCount(resourceRows, 0)), PAGE_LOAD_TIMEOUT_SECS);

@@ -0,0 +1,12 @@
import { $, element, by } from 'protractor';

export const obcCount = element(by.css('div[aria-label="Object Bucket Claim count"]'));

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

$() is an alias for element(by.css()), so these can be simplified by just using $().

@openshift-ci-robot
Copy link
Contributor

@bipuladh: Reopened this PR.

In response to this:

/reopen

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository.

@afreen23
Copy link
Contributor

A reason for closing and reopening would help here @bipuladh .

@bipuladh
Copy link
Contributor Author

/close

@openshift-ci-robot
Copy link
Contributor

@bipuladh: Closed this PR.

In response to this:

/close

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository.

@bipuladh
Copy link
Contributor Author

/reopen

@openshift-ci-robot
Copy link
Contributor

@bipuladh: Reopened this PR.

In response to this:

/reopen

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository.

@openshift-ci-robot openshift-ci-robot removed the needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. label Jun 18, 2020
@bipuladh bipuladh force-pushed the nb-dash-integration-test branch 2 times, most recently from 6d5163a to f7d572f Compare June 24, 2020 16:17
@openshift-ci-robot openshift-ci-robot added the approved Indicates a PR has been approved by an approver from all required OWNERS files. label Jun 24, 2020
});

it('Test at least one noobaa bucket is present', async () => {
await browser.wait(until.and(untilNoLoadersPresent));
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Since this is already checked in beforeAll, why do you need to check it again here?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Its present at other places too

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yes. For some reason, it fails without this.

@@ -0,0 +1,106 @@
import { execSync } from 'child_process';
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The file should be named to something like object-service-dashboard instead of overviewDashboard

await browser.wait(until.and(untilNoLoadersPresent));
await browser.wait(until.visibilityOf(healthOfMCG));
const color = healthOfMCG.getAttribute('fill');
expect(color).toBe('#486b00');
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Makes sense. Thanks.

@gnehapk
Copy link
Contributor

gnehapk commented Jun 29, 2020

/lgtm

@openshift-ci-robot openshift-ci-robot added the lgtm Indicates that a PR is ready to be merged. label Jun 29, 2020
@openshift-ci-robot
Copy link
Contributor

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: bipuladh, gnehapk, umangachapagain

The full list of commands accepted by this bot can be found here.

The pull request process is described here

Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@openshift-bot
Copy link
Contributor

/retest

Please review the full test history for this PR and help us cut down flakes.

@openshift-merge-robot openshift-merge-robot merged commit 7083b9c into openshift:master Jun 29, 2020
@spadgett spadgett added this to the v4.6 milestone Jul 8, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
approved Indicates a PR has been approved by an approver from all required OWNERS files. component/dashboard Related to dashboard component/noobaa Related to noobaa-storage-plugin component/shared Related to console-shared lgtm Indicates that a PR is ready to be merged. size/L Denotes a PR that changes 100-499 lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet