Cypress: Added test related to redirection from home page (#9112)

* Cypress: Added test related to redirection from home page

* fix cypress issue
This commit is contained in:
Ashish Gupta 2022-12-02 20:54:25 +05:30 committed by GitHub
parent 1b3ff505c2
commit 7241c3a975
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 313 additions and 76 deletions

View File

@ -975,4 +975,71 @@ export const updateDescriptionForIngestedTables = (
.first()
.invoke('text')
.should('contain', description);
};
};
export const followAndOwnTheEntity = (termObj) => {
// search for the term and redirect to the respective entity tab
visitEntityDetailsPage(termObj.term, termObj.serviceName, termObj.entity);
interceptURL('PUT', '/api/v1/*/*/followers', 'waitAfterFollow');
cy.get('[data-testid="follow-button"]').should('be.visible').click();
verifyResponseStatusCode('@waitAfterFollow', 200);
// go to manage tab and search for logged in user and set the owner
interceptURL(
'GET',
'/api/v1/search/query?q=*%20AND%20teamType:Group&from=0&size=10&index=team_search_index',
'getTeams'
);
cy.get('[data-testid="edit-Owner-icon"]').should('be.visible').click();
verifyResponseStatusCode('@getTeams', 200);
//Clicking on users tab
cy.get('[data-testid="dropdown-tab"]')
.contains('Users')
.should('exist')
.should('be.visible')
.click();
//Selecting the user
cy.get('[data-testid="list-item"]')
.first()
.should('exist')
.should('be.visible')
.click();
cy.get(':nth-child(2) > [data-testid="owner-link"]')
.scrollIntoView()
.invoke('text')
.then((text) => {
expect(text).equal('admin');
});
cy.clickOnLogo();
// checks newly generated feed for follow and setting owner
cy.get('[data-testid="message-container"]')
.first()
.contains('Added owner: admin')
.should('be.visible');
cy.get('[data-testid="message-container"]')
.eq(1)
.scrollIntoView()
.contains(`Followed ${termObj.entity.slice(0, -1)}`)
.should('be.visible');
//Check followed entity on mydata page
cy.get('[data-testid="following-data-container"]')
.find(`[data-testid="Following data-${termObj.displayName}"]`)
.should('be.visible');
//Check owned entity
cy.get('[data-testid="my-data-container"]')
.find(`[data-testid="My data-${termObj.displayName}"]`)
.should('be.visible')
cy.clickOnLogo();
};

View File

@ -47,6 +47,7 @@ export const DATA_QUALITY_SAMPLE_DATA_TABLE = {
export const SEARCH_ENTITY_TABLE = {
table_1: {
term: 'raw_customer',
displayName: 'raw_customer',
entity: MYDATA_SUMMARY_OPTIONS.tables,
serviceName: 'sample_data',
},
@ -65,6 +66,7 @@ export const SEARCH_ENTITY_TABLE = {
export const SEARCH_ENTITY_TOPIC = {
topic_1: {
term: 'shop_products',
displayName: 'shop_products',
entity: MYDATA_SUMMARY_OPTIONS.topics,
serviceName: 'sample_kafka',
},
@ -78,6 +80,7 @@ export const SEARCH_ENTITY_TOPIC = {
export const SEARCH_ENTITY_DASHBOARD = {
dashboard_1: {
term: 'Slack Dashboard',
displayName: 'Slack Dashboard',
entity: MYDATA_SUMMARY_OPTIONS.dashboards,
serviceName: 'sample_superset',
},

View File

@ -0,0 +1,182 @@
/*
* Copyright 2021 Collate
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
* http://www.apache.org/licenses/LICENSE-2.0
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import { BASE_URL } from './constants';
export const LEFT_PANEL_DETAILS = {
tables: {
testid: '[data-testid="tables"]',
url: `${BASE_URL}/explore/tables`,
},
topics: {
testid: '[data-testid="topics"]',
url: `${BASE_URL}/explore/topics`,
},
dashboard: {
testid: '[data-testid="dashboards"]',
url: `${BASE_URL}/explore/dashboards`,
},
pipelines: {
testid: '[data-testid="pipelines"]',
url: `${BASE_URL}/explore/pipelines`,
},
mlmodels: {
testid: '[data-testid="mlmodels"]',
url: `${BASE_URL}/explore/mlmodels`,
},
testSuites: {
testid: '[data-testid="test-suite"]',
url: `${BASE_URL}/test-suites`,
},
services: {
testid: '[data-testid="service"]',
url: `${BASE_URL}/settings/services/databases`,
},
users: {
testid: '[data-testid="user"]',
url: `${BASE_URL}/settings/members/users`,
},
teams: {
testid: '[data-testid="terms"]',
url: `${BASE_URL}/settings/members/teams`,
},
};
export const NAVBAR_DETAILS = {
explore: {
testid: '[data-testid="appbar-item-explore"]',
url: `${BASE_URL}/explore/tables/?page=1`,
},
quality: {
testid: '[data-testid="appbar-item-data-quality"]',
url: `${BASE_URL}/test-suites`,
},
insights: {
testid: '[data-testid="appbar-item-data-insight"]',
url: `${BASE_URL}/data-insights`,
},
glossary: {
testid: `[data-testid="governance"]`,
subMenu: `[data-testid="appbar-item-glossary"]`,
url: `${BASE_URL}/glossary`,
},
tags: {
testid: `[data-testid="governance"]`,
subMenu: '[data-testid="appbar-item-tags"]',
url: `${BASE_URL}/tags`,
},
settings: {
testid: '[data-testid="appbar-item-settings"]',
url: `${BASE_URL}/settings/members/teams/Organization`,
},
profile: {
testid: '[data-testid="dropdown-profile"]',
subMenu: '[data-testid="greeting-text"] [data-testid="user-name"]',
url: `${BASE_URL}/users/admin`,
}
};
export const SETTINGS_LEFT_PANEL = {
settings: {
testid: '[data-testid="appbar-item-settings"]',
url: `${BASE_URL}/settings/members/teams/Organization`,
},
teams: {
testid: '[data-menu-id*="teams"]',
url: `${BASE_URL}/settings/members/teams/Organization`,
},
users: {
testid: '[data-menu-id*="users"]',
url: `${BASE_URL}/settings/members/users`,
},
admins: {
testid: '[data-menu-id*="admins"]',
url: `${BASE_URL}/settings/members/admins`,
},
roles: {
testid: '[data-menu-id*="roles"]',
url: `${BASE_URL}/settings/access/roles`,
},
policies: {
testid: '[data-menu-id*="policies"]',
url: `${BASE_URL}/settings/access/policies`,
},
databases: {
testid: '[data-menu-id*="databases"]',
url: `${BASE_URL}/settings/services/databases`,
},
messaging: {
testid: '[data-menu-id*="messaging"]',
url: `${BASE_URL}/settings/services/messaging`,
},
dashboard: {
testid: '[data-menu-id*="services.dashboards"]',
url: `${BASE_URL}/settings/services/dashboards`,
},
pipelines: {
testid: '[data-menu-id*="services.pipelines"]',
url: `${BASE_URL}/settings/services/pipelines`,
},
mlmodels: {
testid: '[data-menu-id*="services.mlModels"]',
url: `${BASE_URL}/settings/services/mlModels`,
},
metadata: {
testid: '[data-menu-id*="metadata"]',
url: `${BASE_URL}/settings/services/metadata`,
},
activityFeed: {
testid: '[data-menu-id*="activityFeed"]',
url: `${BASE_URL}/settings/collaboration/activityFeed`,
},
customAttributesTable: {
testid: '[data-menu-id*="tables"]',
url: `${BASE_URL}/settings/customAttributes/tables`,
},
customAttributesTopics: {
testid: '[data-menu-id*="topics"]',
url: `${BASE_URL}/settings/customAttributes/topics`,
},
customAttributesDashboards: {
testid: '[data-menu-id*="customAttributes.dashboards"]',
url: `${BASE_URL}/settings/customAttributes/dashboards`,
},
customAttributesPipelines: {
testid: '[data-menu-id*="customAttributes.pipelines"]',
url: `${BASE_URL}/settings/customAttributes/pipelines`,
},
customAttributesMlModels: {
testid: '[data-menu-id*="customAttributes.mlModels"]',
url: `${BASE_URL}/settings/customAttributes/mlModels`,
},
elasticsearch: {
testid: '[data-menu-id*="elasticsearch"]',
url: `${BASE_URL}/settings/eventPublishers/elasticsearch`,
},
webhooks: {
testid: '[data-menu-id*="webhook"]',
url: `${BASE_URL}/settings/integrations/webhook`,
},
slack: {
testid: '[data-menu-id*="slack"]',
url: `${BASE_URL}/settings/integrations/slack`,
},
msTeams: {
testid: '[data-menu-id*="msTeams"]',
url: `${BASE_URL}/settings/integrations/msTeams`,
},
bots: {
testid: '[data-menu-id*="bots"]',
url: `${BASE_URL}/settings/integrations/bots`,
}
}

View File

@ -13,25 +13,8 @@
/// <reference types="cypress" />
import {
interceptURL,
searchEntity,
verifyResponseStatusCode,
visitEntityDetailsPage
} from '../../common/common';
import {
ENTITIES,
FOLLOWING_TITLE,
MYDATA_SUMMARY_OPTIONS,
MY_DATA_TITLE,
NO_SEARCHED_TERMS,
RECENT_SEARCH_TITLE,
RECENT_VIEW_TITLE,
SEARCH_ENTITY_DASHBOARD,
SEARCH_ENTITY_PIPELINE,
SEARCH_ENTITY_TABLE,
SEARCH_ENTITY_TOPIC
} from '../../constants/constants';
import { followAndOwnTheEntity, interceptURL, searchEntity, visitEntityDetailsPage } from '../../common/common';
import { ENTITIES, FOLLOWING_TITLE, MYDATA_SUMMARY_OPTIONS, MY_DATA_TITLE, NO_SEARCHED_TERMS, RECENT_SEARCH_TITLE, RECENT_VIEW_TITLE, SEARCH_ENTITY_DASHBOARD, SEARCH_ENTITY_PIPELINE, SEARCH_ENTITY_TABLE, SEARCH_ENTITY_TOPIC } from '../../constants/constants';
const FOLLOWING_MYDATA_COUNT = 3;
@ -64,62 +47,6 @@ describe('MyData page should work', () => {
cy.contains(NO_SEARCHED_TERMS).scrollIntoView().should('be.visible');
};
const followAndOwnTheEntity = (termObj) => {
// search for the term and redirect to the respective entity tab
visitEntityDetailsPage(termObj.term, termObj.serviceName, termObj.entity);
interceptURL('PUT', '/api/v1/*/*/followers', 'waitAfterFollow');
cy.get('[data-testid="follow-button"]').should('be.visible').click();
verifyResponseStatusCode('@waitAfterFollow', 200);
// go to manage tab and search for logged in user and set the owner
interceptURL(
'GET',
'/api/v1/search/query?q=*%20AND%20teamType:Group&from=0&size=10&index=team_search_index',
'getTeams'
);
cy.get('[data-testid="edit-Owner-icon"]').should('be.visible').click();
verifyResponseStatusCode('@getTeams', 200);
//Clicking on users tab
cy.get('[data-testid="dropdown-tab"]')
.contains('Users')
.should('exist')
.should('be.visible')
.click();
//Selecting the user
cy.get('[data-testid="list-item"]')
.first()
.should('exist')
.should('be.visible')
.click();
cy.get(':nth-child(2) > [data-testid="owner-link"]')
.scrollIntoView()
.invoke('text')
.then((text) => {
expect(text).equal('admin');
});
cy.clickOnLogo();
// checks newly generated feed for follow and setting owner
cy.get('[data-testid="message-container"]')
.first()
.contains('Added owner: admin')
.should('be.visible');
cy.get('[data-testid="message-container"]')
.eq(1)
.scrollIntoView()
.contains(`Followed ${termObj.entity.slice(0, -1)}`)
.should('be.visible');
cy.clickOnLogo();
};
it('MyData Page should render properly with all the required components', () => {
cy.get('[data-testid="data-summary-container"]').should('be.visible');
cy.contains(RECENT_SEARCH_TITLE).should('be.visible');
@ -186,6 +113,7 @@ describe('MyData page should work', () => {
followAndOwnTheEntity(SEARCH_ENTITY_PIPELINE.pipeline_1);
});
it.skip('My data and following section, CTA should work properly', () => {
cy.get('[data-testid="my-data-container"]')
.find('[data-testid*="My data"]')

View File

@ -0,0 +1,57 @@
/*
* Copyright 2021 Collate
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
* http://www.apache.org/licenses/LICENSE-2.0
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import { BASE_URL } from '../../constants/constants';
import { LEFT_PANEL_DETAILS, NAVBAR_DETAILS, SETTINGS_LEFT_PANEL } from '../../constants/redirections.constants';
const validateURL = (url) => {
cy.url().should('contain', url);
};
describe('Redirection link should work properly', () => {
beforeEach(() => {
cy.login();
});
it('Check mydata redirection links on navbar', () => {
Object.values(NAVBAR_DETAILS).map((navbar) => {
cy.get(navbar.testid).should('be.visible').click({animationDistanceThreshold: 10});
if(navbar.subMenu) {
cy.get(navbar.subMenu).should('be.visible').click({ force: true });
}
//
cy.get('body').click();
validateURL(navbar.url);
cy.clickOnLogo();
validateURL(`${BASE_URL}/my-data`);
});
});
it(`Check mydata redirection mydata links on left panel.`, () => {
Object.values(LEFT_PANEL_DETAILS).map((leftpanel) => {
cy.get(leftpanel.testid).should('be.visible').click();
validateURL(leftpanel.url);
cy.clickOnLogo();
validateURL(`${BASE_URL}/my-data`);
});
});
it('Check redirection links on settings page', () => {
cy.get(NAVBAR_DETAILS.settings.testid).should('be.visible').click();
Object.values(SETTINGS_LEFT_PANEL).map((settingsLeftPanel) => {
cy.get(settingsLeftPanel.testid).scrollIntoView().should('be.visible').click();
cy.wait(200);
validateURL(settingsLeftPanel.url);
});
})
});