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

ODC-5577:Topology chart view automation #9399

Conversation

sanketpathak
Copy link
Contributor

@sanketpathak sanketpathak commented Jul 4, 2021

Fix: https://issues.redhat.com/browse/ODC-6006

Problem: Automation of empty state of topology chart view, topology chart view with workloads and filters in topology chart view

Solution: This script will automate the topology chart view page.

Test Setup:

Cluster should be running on local

Check the TAGS in frontend/packages/topology/integration-tests/cypress.json file be: "@Topology and (@smoke or @regression) and not (@Manual or @to-do or @un-verified)",

Command to execute:

yarn run dev
yarn run test-cypress-topology
Execute the topology-chart-area-visual.feature file

Checks for approving Epic scenarios Automation PR:

  • Execute the @to-do tagged gherkin scripts manually
  • Convert the @to-do gherkin scripts to cypress automation scripts
  • Once scripts are automated, remove tag @to-do
  • Execute the scripts in Remote cluster

Browser
Chrome 89

Test Execution Screenshot:
Screenshot from 2021-07-04 00-05-08

@openshift-ci openshift-ci bot added component/dev-console Related to dev-console component/topology Related to topology labels Jul 4, 2021
@sanketpathak sanketpathak force-pushed the Topology-chart-view-automation-odc-5577 branch 2 times, most recently from 4bf8175 to 4312fa3 Compare July 7, 2021 07:06
@gajanan-more
Copy link
Contributor

Screenshot 2021-07-07 at 5 30 11 PM

All the tests are running fine but I am getting this error and @sanketpathak is not. Adding /lgtm for running tests successfully.

@gajanan-more
Copy link
Contributor

/lgtm

@openshift-ci openshift-ci bot added the lgtm Indicates that a PR is ready to be merged. label Jul 7, 2021
Comment on lines 112 to 114
case 'deployment config':
case 'Deployment Config':
case 'deployment-config':
case 'Deployment-Config':
case 'DeploymentConfig':
Copy link
Contributor

Choose a reason for hiding this comment

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

Can we try "||" operator, instead of adding multiple lines

Copy link
Contributor Author

Choose a reason for hiding this comment

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

It's not working

Comment on lines 222 to 225
export function typeOfResource(type: string) {
return `[data-test="${type}"]`;
}

Copy link
Contributor

Choose a reason for hiding this comment

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

we can use cy.byTestID("attribute-name"). Please remove this function

Copy link
Contributor

Choose a reason for hiding this comment

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

you are trying to return data-test attribute using this function and passing it to cy.get() function right, if that is the case. we can directly pass it to cy.byTestID()

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Updated

Comment on lines 226 to 231
export function typeOfWorkload(workload: string) {
return `[data-test~="icon"][data-test~="${workload
.toLowerCase()
.replace(' ', '')
.trim()}"]`;
}
Copy link
Contributor

Choose a reason for hiding this comment

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

Please use Arrow functions where ever applicable instead this functions

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Updated

Comment on lines 13 to 15
Then('user sees Topology page with message "No resources found"', () => {
cy.get(topologyPO.emptyText).should('be.visible');
});
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
Then('user sees Topology page with message "No resources found"', () => {
cy.get(topologyPO.emptyText).should('be.visible');
});
Then('user sees Topology page with message {string}', (text:string) => {
cy.get(topologyPO.emptyText).should('be.visible');
});

or
Modify the step in feature file as Then user sees Topology page with message No resources found

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Updated

navigateTo(devNavigationMenu.Topology);
});

When('user clicks on "Add page" link in the topology page', () => {
Copy link
Contributor

Choose a reason for hiding this comment

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

same comment as mentioned above

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Updated

@sanketpathak sanketpathak force-pushed the Topology-chart-view-automation-odc-5577 branch from 4312fa3 to 79e9b76 Compare July 14, 2021 22:32
@openshift-ci openshift-ci bot removed the lgtm Indicates that a PR is ready to be merged. label Jul 14, 2021
@sanketpathak
Copy link
Contributor Author

/assign @makambalaji

@openshift-ci openshift-ci bot added the needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. label Jul 15, 2021
@sanketpathak sanketpathak force-pushed the Topology-chart-view-automation-odc-5577 branch from 79e9b76 to 50dffdc Compare July 16, 2021 13:04
@openshift-ci openshift-ci bot added component/shared Related to console-shared and removed needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. labels Jul 16, 2021
@makambalaji
Copy link
Contributor

Tested on my localhost, worked fine

@makambalaji
Copy link
Contributor

/approve
Please get approval from Developers

@makambalaji
Copy link
Contributor

/lgtm

@openshift-ci openshift-ci bot added the lgtm Indicates that a PR is ready to be merged. label Jul 19, 2021
@gajanan-more
Copy link
Contributor

/lgtm

@gajanan-more
Copy link
Contributor

@jerolimov Can you please review this PR? QE Review is already done. If there is nothing, please add approve
Thank you.

@jerolimov
Copy link
Member

/retest

Copy link
Member

@jerolimov jerolimov left a comment

Choose a reason for hiding this comment

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

Added some findings. Please take a look and let me know what you think.

Comment on lines 40 to 44
or visit the{' '}
<Link to="/add" data-test="add-page">
Add page
</Link>{' '}
for more details.
Copy link
Member

@jerolimov jerolimov Jul 21, 2021

Choose a reason for hiding this comment

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

The {' '} ensures that the output is the same, but changes the i18n string in the translation files. I recommend that we concat these space strings into one string, like this:

        <Trans t={t} ns="topology">
          <Button
            isInline
            variant="link"
            data-test="start-building-your-application"
            onClick={(e) => {
              e.stopPropagation();
              setIsQuickSearchOpen(true);
            }}
          >
            Start building your application
          </Button>
          {' or visit the '}
          <Link to="/add" data-test="add-page">
            Add page
          </Link>
          {' for more details.'}
        </Trans>

Your code (and my example as well) changed the translation file! Please run yarn i18n after changing this.

You can also change the <3> to <2> manually in the other translation files, so that they still match? Thanks.

Alternative:

        <Trans t={t} ns="topology">
          <Button
            isInline
            variant="link"
            data-test="start-building-your-application"
            onClick={(e) => {
              e.stopPropagation();
              setIsQuickSearchOpen(true);
            }}
          >
            Start building your application
          </Button>{' '}
          {'or visit the '}
          <Link to="/add" data-test="add-page">
            Add page
          </Link>{' '}
          for more details.
        </Trans>

Then you don't need to change the translation files.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Updated with the first change

@@ -36,6 +36,7 @@ const QuickSearchBar: React.FC<QuickSearchBarProps> = ({
onChange={onSearch}
autoFocus={autoFocus}
value={searchTerm}
data-test="quick-search-input"
Copy link
Member

Choose a reason for hiding this comment

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

We don't want repeat the prefixes. In this case please just use input or drop it as it is not used yet.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Changed to input, It can be used for automation in future

);
});

Given('user has created deployment config workload {string}', (componentName: string) => {
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
Given('user has created deployment config workload {string}', (componentName: string) => {
Given('user has created a deployment config workload {string}', (componentName: string) => {

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Updated

Comment on lines 39 to 42
cy.get(topologyPO.graph.startBuildingNewApp)
.should('be.visible')
.click();
Copy link
Member

Choose a reason for hiding this comment

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

Little bit confusing that you don't use build: string here.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Updated

Comment on lines +69 to +73
When('user navigates to Topology page', () => {
navigateTo(devNavigationMenu.Topology);
});

Copy link
Member

Choose a reason for hiding this comment

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

This is already defined above.

Suggested change
When('user navigates to Topology page', () => {
navigateTo(devNavigationMenu.Topology);
});

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Sorry I missed that, removed

Comment on lines 94 to 99
When('user is at Topology page chart view', () => {
navigateTo(devNavigationMenu.Topology);
});

Copy link
Member

Choose a reason for hiding this comment

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

Same as When('user navigates to Topology page', ...

And we call the both topology variants "graph" and "list". If this should ensure that this should show the graph (chart), I would expect some additional code to do that.

So can you reuse When('user navigates to Topology page', here as well or add an check for the topology switch button on the top right corner?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Updated with checking the switch button

Comment on lines 124 to 128
cy.byTestID('DeploymentConfig').click();
cy.get(typeOfWorkload(workload)).should('be.visible');
cy.byTestID('DeploymentConfig').click();
Copy link
Member

Choose a reason for hiding this comment

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

Is this back and forward clicks really required?

Suggested change
cy.byTestID('DeploymentConfig').click();
cy.get(typeOfWorkload(workload)).should('be.visible');
cy.byTestID('DeploymentConfig').click();
cy.get(typeOfWorkload(workload)).should('be.visible');

Copy link
Contributor Author

Choose a reason for hiding this comment

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

It's not required but I did to make it consistent with the previous then statement and if in future further test scenarios are added in the file, then we do not have to worry about the checks being disabled

Copy link
Member

Choose a reason for hiding this comment

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

Sorry don't get the edge case where it is needed to click items twice.

Also, this is an Then(... condition. I would suggest not to click an items here anymore. If a click before that is needed this should be part of a When statement, or?

I would suggest to remove all clicks from

Then(
  'user can see only the {string} workload when Deployment option is selected',

and

Then(
  'user can see only the {string} workload when Deployment-Config option is selected',

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Updated

@@ -21,22 +21,27 @@ const TopologyEmptyState: React.FC<TopologyEmptyStateProps> = ({ setIsQuickSearc
return (
<EmptyState className="odc-topology__empty-state" variant={EmptyStateVariant.full}>
<EmptyStateIcon variant="container" component={TopologyIcon} />
<Title headingLevel="h3" size="lg">
<Title headingLevel="h3" size="lg" data-test="no-resources-found">
Copy link
Member

Choose a reason for hiding this comment

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

If possible, please move this 2 lines up to the EmptyState as the complete component define this.

    <EmptyState
      className="odc-topology__empty-state"
      variant={EmptyStateVariant.full}
      data-test="empty-state"
    >
      <EmptyStateIcon variant="container" component={TopologyIcon} />
      <Title headingLevel="h3" size="lg">

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Updated

key={filter.id}
value={filter.id}
isChecked={filter.value}
data-test={filter.labelKey ? t(filter.labelKey) : filter.label}
Copy link
Member

Choose a reason for hiding this comment

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

I think we don't want and need to translate data-test attributes.

Suggested change
data-test={filter.labelKey ? t(filter.labelKey) : filter.label}
data-test={filter.label}

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Updated

@@ -154,6 +154,7 @@ const BaseNode: React.FC<BaseNodeProps> = ({
paddingX={8}
paddingY={4}
kind={kind}
data-test={`name-${element.getLabel()}`}
Copy link
Member

Choose a reason for hiding this comment

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

I don't find any code which is looking for this name- data-test attribute?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I was trying out something so this attribute was required but it didn't work out. I've not removed it because it can be used for future automation

Copy link
Member

Choose a reason for hiding this comment

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

But then I would recommend another data-test. Please remove it from this PR when it is not used and then you can add it with a test scenario where it is used.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Sure Christoph, will update it

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Updated

@sanketpathak sanketpathak force-pushed the Topology-chart-view-automation-odc-5577 branch from 50dffdc to 7f90ff3 Compare July 21, 2021 14:03
@openshift-ci openshift-ci bot added kind/i18n Indicates issue or PR relates to internationalization or has content that needs to be translated and removed lgtm Indicates that a PR is ready to be merged. labels Jul 21, 2021
Copy link
Member

@jerolimov jerolimov left a comment

Choose a reason for hiding this comment

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

@sanketpathak sanketpathak force-pushed the Topology-chart-view-automation-odc-5577 branch from 7f90ff3 to 056c82b Compare July 22, 2021 08:59
cy.get(gitPO.gitSection.validatedMessage).should('not.have.text', 'Validating...');
cy.get(gitPO.gitSection.validatedMessage)
.should('not.include.text', 'Validating...')
.and('not.include.text', 'Repository URL to build and deploy your code from source');
Copy link
Contributor

Choose a reason for hiding this comment

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

Can you please add this text to static-text folder

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Added

@sanketpathak sanketpathak force-pushed the Topology-chart-view-automation-odc-5577 branch from 056c82b to f73a751 Compare July 22, 2021 14:14
@@ -92,7 +92,7 @@ const TopologyFilterBar: React.FC<TopologyFilterBarProps> = ({
</ToolbarItem>
</ToolbarGroup>
<ToolbarGroup variant={ToolbarGroupVariant['filter-group']}>
<ToolbarItem>
<ToolbarItem data-test={'filter-by-resource'}>
Copy link
Member

@jerolimov jerolimov Jul 22, 2021

Choose a reason for hiding this comment

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

Mini nit:

Suggested change
<ToolbarItem data-test={'filter-by-resource'}>
<ToolbarItem data-test="filter-by-resource">

Copy link
Member

@jerolimov jerolimov left a comment

Choose a reason for hiding this comment

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

@sanketpathak @makambalaji I run all topology tests with yarn run test-cypress-topology, feature which is touched in this PR is green, but all others are red. Sanket says that you Balaji will check these later / in another PR.

image

The frontend changes are fine for me! Approving them. Balaji, please add lgtm if the rest is fine for you.

/approve

@openshift-ci openshift-ci bot added the approved Indicates a PR has been approved by an approver from all required OWNERS files. label Jul 22, 2021
@makambalaji
Copy link
Contributor

Executed the test scenarios as per the pr description, working as expected
image

@makambalaji
Copy link
Contributor

/lgtm

@openshift-ci openshift-ci bot added the lgtm Indicates that a PR is ready to be merged. label Jul 22, 2021
@sanketpathak sanketpathak force-pushed the Topology-chart-view-automation-odc-5577 branch from f73a751 to d79b408 Compare July 22, 2021 15:53
@openshift-ci openshift-ci bot removed the lgtm Indicates that a PR is ready to be merged. label Jul 22, 2021
@jerolimov
Copy link
Member

Readd Balajis lgtm as the latest changes are requested by myself and looks fine. 👍

/lgtm

@openshift-ci openshift-ci bot added the lgtm Indicates that a PR is ready to be merged. label Jul 22, 2021
@openshift-ci
Copy link
Contributor

openshift-ci bot commented Jul 22, 2021

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: gajanan-more, jerolimov, makambalaji, sanketpathak

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

@jerolimov
Copy link
Member

/retest

@openshift-bot
Copy link
Contributor

/retest-required

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

2 similar comments
@openshift-bot
Copy link
Contributor

/retest-required

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

@openshift-bot
Copy link
Contributor

/retest-required

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

@openshift-merge-robot openshift-merge-robot merged commit cdea2e7 into openshift:master Jul 23, 2021
@spadgett spadgett added this to the v4.9 milestone Aug 30, 2021
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/dev-console Related to dev-console component/shared Related to console-shared component/topology Related to topology kind/i18n Indicates issue or PR relates to internationalization or has content that needs to be translated lgtm Indicates that a PR is ready to be merged.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

7 participants