Cypress: Added session login for all the cypress specs (#8903)

This commit is contained in:
Shailesh Parmar 2022-11-21 17:02:48 +05:30 committed by GitHub
parent 4427fe487f
commit effba5e170
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
20 changed files with 43 additions and 88 deletions

View File

@ -11,8 +11,7 @@
* limitations under the License.
*/
import { descriptionBox, interceptURL, login, uuid, verifyResponseStatusCode } from "../../common/common";
import { LOGIN } from "../../constants/constants";
import { descriptionBox, interceptURL, uuid, verifyResponseStatusCode } from "../../common/common";
const roleName = `Role-test-${uuid()}`;
const userName = `Usercttest${uuid()}`;
@ -20,8 +19,7 @@ const userEmail = `${userName}@gmail.com`;
describe("Test Add role and assign it to the user", () => {
beforeEach(() => {
login(LOGIN.username, LOGIN.password);
cy.goToHomePage();
cy.login();
interceptURL('GET', '*api/v1/roles*', 'getRoles');

View File

@ -11,8 +11,8 @@
* limitations under the License.
*/
import { addTeam, interceptURL, login, uuid, verifyResponseStatusCode, visitEntityDetailsPage } from '../../common/common';
import { LOGIN, SEARCH_ENTITY_TABLE } from '../../constants/constants';
import { addTeam, interceptURL, uuid, verifyResponseStatusCode, visitEntityDetailsPage } from '../../common/common';
import { SEARCH_ENTITY_TABLE } from '../../constants/constants';
const teamName = `team-group-test-${uuid()}`;
const TEAM_DETAILS = {
@ -25,8 +25,7 @@ const TEAM_DETAILS = {
describe('Create a team and add that team as a owner of the entity', () => {
beforeEach(() => {
login(LOGIN.username, LOGIN.password);
cy.goToHomePage();
cy.login();
});
/**

View File

@ -11,8 +11,8 @@
* limitations under the License.
*/
import { login, visitEntityDetailsPage } from '../../common/common';
import { LOGIN, SEARCH_ENTITY_PIPELINE, SEARCH_ENTITY_TABLE, SEARCH_ENTITY_TOPIC } from '../../constants/constants';
import { visitEntityDetailsPage } from '../../common/common';
import { SEARCH_ENTITY_PIPELINE, SEARCH_ENTITY_TABLE, SEARCH_ENTITY_TOPIC } from '../../constants/constants';
const tableEntity = SEARCH_ENTITY_TABLE.table_1;
const topicEntity = SEARCH_ENTITY_TOPIC.topic_1;
@ -29,8 +29,7 @@ const ENTITIES_LIST = [
describe('Entity Details Page', () => {
beforeEach(() => {
login(LOGIN.username, LOGIN.password);
cy.goToHomePage();
cy.login();
});
ENTITIES_LIST.map((entity) => {

View File

@ -12,15 +12,14 @@
*/
import { getCurrentLocaleDate, getFutureLocaleDateFromCurrentDate } from "../../../src/utils/TimeUtils";
import { descriptionBox, interceptURL, login, verifyResponseStatusCode, visitEntityDetailsPage } from "../../common/common";
import { ANNOUNCEMENT_ENTITIES, LOGIN } from "../../constants/constants";
import { descriptionBox, interceptURL, verifyResponseStatusCode, visitEntityDetailsPage } from "../../common/common";
import { ANNOUNCEMENT_ENTITIES } from "../../constants/constants";
describe("Entity Announcement", () => {
beforeEach(() => {
login(LOGIN.username, LOGIN.password);
cy.goToHomePage();
cy.login();
});
const createAnnouncement = (title, startDate, endDate, description) => {

View File

@ -11,13 +11,12 @@
* limitations under the License.
*/
import { interceptURL, login, verifyResponseStatusCode } from "../../common/common";
import { BASE_URL, LOGIN } from "../../constants/constants";
import { interceptURL, verifyResponseStatusCode } from "../../common/common";
import { BASE_URL } from "../../constants/constants";
describe("Logout User", () => {
beforeEach(() => {
login(LOGIN.username, LOGIN.password);
cy.goToHomePage();
cy.login();
});
it("After login logout the user and invalidate the token", () => {

View File

@ -11,8 +11,8 @@
* limitations under the License.
*/
import { login, visitEntityDetailsPage } from '../../common/common';
import { LOGIN, SEARCH_ENTITY_TABLE } from '../../constants/constants';
import { visitEntityDetailsPage } from '../../common/common';
import { SEARCH_ENTITY_TABLE } from '../../constants/constants';
const TEAM_DETAILS = SEARCH_ENTITY_TABLE.table_1;
const userURL =
@ -21,16 +21,8 @@ const teamURL =
'/api/v1/search/query?q=*%20AND%20teamType:Group&from=0&size=10&index=team_search_index';
describe('Test if the total count of users and teams is correctly displayed in the assign owner widget', () => {
before(() => {
cy.clearLocalStorageSnapshot();
login(LOGIN.username, LOGIN.password);
cy.goToHomePage();
cy.saveLocalStorage('localstorage');
});
beforeEach(() => {
cy.log('Restoring local storage snapshot');
cy.restoreLocalStorage('localstorage');
cy.clickOnLogo();
cy.login();
});
it('Check total count of users and teams', () => {

View File

@ -13,12 +13,10 @@
import { getExpiryDateTimeFromDate } from '../../../src/utils/TimeUtils.ts';
import {
descriptionBox,
interceptURL,
login,
uuid,
interceptURL, uuid,
verifyResponseStatusCode
} from '../../common/common';
import { DELETE_TERM, LOGIN } from '../../constants/constants';
import { DELETE_TERM } from '../../constants/constants';
const botName = `Bot-ct-test-${uuid()}`;
const botEmail = `${botName}@mail.com`;
@ -73,8 +71,7 @@ const revokeToken = () => {
describe('Bots Page should work properly', () => {
beforeEach(() => {
login(LOGIN.username, LOGIN.password);
cy.goToHomePage();
cy.login();
cy.get('[data-testid="appbar-item-settings"]')
.should('exist')
.should('be.visible')

View File

@ -12,13 +12,12 @@
*/
import { getCurrentLocaleDate, getFutureLocaleDateFromCurrentDate } from '../../../src/utils/TimeUtils';
import { descriptionBox, interceptURL, login, verifyResponseStatusCode, visitEntityDetailsPage } from '../../common/common';
import { DELETE_ENTITY, DELETE_TERM, LOGIN } from '../../constants/constants';
import { descriptionBox, interceptURL, verifyResponseStatusCode, visitEntityDetailsPage } from '../../common/common';
import { DELETE_ENTITY, DELETE_TERM } from '../../constants/constants';
describe('Entity Details Page', () => {
beforeEach(() => {
login(LOGIN.username, LOGIN.password);
cy.goToHomePage();
cy.login();
});
const deleteEntity = (value) => {

View File

@ -13,16 +13,12 @@
import {
descriptionBox,
interceptURL,
login,
toastNotification,
interceptURL, toastNotification,
verifyResponseStatusCode,
visitEntityDetailsPage
} from '../../common/common';
import {
DELETE_TERM,
LOGIN,
NEW_GLOSSARY,
DELETE_TERM, NEW_GLOSSARY,
NEW_GLOSSARY_TERMS,
SEARCH_ENTITY_TABLE
} from '../../constants/constants';
@ -107,8 +103,7 @@ const goToAssetsTab = (term) => {
describe('Glossary page should work properly', () => {
beforeEach(() => {
login(LOGIN.username, LOGIN.password);
cy.goToHomePage();
cy.login();
interceptURL('GET', '/api/v1/glossaryTerms*', 'getGlossaryTerms');
cy.get('[data-testid="governance"]')

View File

@ -10,8 +10,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import { descriptionBox, interceptURL, login, uuid, verifyResponseStatusCode } from '../../common/common';
import { LOGIN } from '../../constants/constants';
import { descriptionBox, interceptURL, uuid, verifyResponseStatusCode } from '../../common/common';
const MSteamName = `MSTeam-ct-test-${uuid()}`;
@ -20,8 +19,7 @@ const endpointURL = 'http://localhost:8585';
describe('MSTeams Page', () => {
beforeEach(() => {
login(LOGIN.username, LOGIN.password);
cy.goToHomePage();
cy.login();
cy.get('[data-testid="appbar-item-settings"]')
.should('exist')

View File

@ -11,8 +11,7 @@
* limitations under the License.
*/
import { descriptionBox, interceptURL, login, uuid, verifyResponseStatusCode } from '../../common/common';
import { LOGIN } from '../../constants/constants';
import { descriptionBox, interceptURL, uuid, verifyResponseStatusCode } from '../../common/common';
const roles = {
dataConsumer: 'Data Consumer',
@ -91,8 +90,7 @@ const addRule = (rulename, ruleDescription, descriptionIndex) => {
describe('Policy page should work properly', () => {
beforeEach(() => {
login(LOGIN.username, LOGIN.password);
cy.goToHomePage();
cy.login();
cy.intercept('GET', '*api/v1/policies*').as('getPolicies');
cy.get('[data-testid="appbar-item-settings"]').should('be.visible').click();

View File

@ -13,12 +13,9 @@
import {
descriptionBox,
interceptURL,
login,
uuid,
interceptURL, uuid,
verifyResponseStatusCode
} from '../../common/common';
import { LOGIN } from '../../constants/constants';
const roles = {
dataConsumer: 'Data Consumer',
@ -58,8 +55,7 @@ const removePolicyFromRole = (policyName) => {
describe('Roles page should work properly', () => {
beforeEach(() => {
login(LOGIN.username, LOGIN.password);
cy.goToHomePage();
cy.login();
interceptURL('GET', '*api/v1/roles*', 'getRoles');

View File

@ -11,13 +11,12 @@
* limitations under the License.
*/
import { descriptionBox, interceptURL, login, verifyResponseStatusCode } from '../../common/common';
import { LOGIN, service } from '../../constants/constants';
import { descriptionBox, interceptURL, verifyResponseStatusCode } from '../../common/common';
import { service } from '../../constants/constants';
describe('Services page should work properly', () => {
beforeEach(() => {
login(LOGIN.username, LOGIN.password);
cy.goToHomePage();
cy.login();
//redirecting to services page
cy.get('[data-testid="appbar-item-settings"]').should('be.visible').click();

View File

@ -10,8 +10,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import { descriptionBox, interceptURL, login, uuid, verifyResponseStatusCode } from '../../common/common';
import { LOGIN } from '../../constants/constants';
import { descriptionBox, interceptURL, uuid, verifyResponseStatusCode } from '../../common/common';
const slackName = `Slack-ct-test-${uuid()}`;
const updatedDescription = 'This is updated slack description';
@ -19,8 +18,7 @@ const endpointURL = 'http://localhost:8585';
describe('Slack Page', () => {
beforeEach(() => {
login(LOGIN.username, LOGIN.password);
cy.goToHomePage();
cy.login();
cy.get('[data-testid="appbar-item-settings"]')
.should('exist')

View File

@ -11,13 +11,12 @@
* limitations under the License.
*/
import { addNewTagToEntity, descriptionBox, interceptURL, login, verifyResponseStatusCode } from '../../common/common';
import { LOGIN, NEW_TAG, NEW_TAG_CATEGORY, SEARCH_ENTITY_TABLE } from '../../constants/constants';
import { addNewTagToEntity, descriptionBox, interceptURL, verifyResponseStatusCode } from '../../common/common';
import { NEW_TAG, NEW_TAG_CATEGORY, SEARCH_ENTITY_TABLE } from '../../constants/constants';
describe('Tags page should work', () => {
beforeEach(() => {
login(LOGIN.username, LOGIN.password);
cy.goToHomePage();
cy.login();
interceptURL('GET', '/api/v1/tags*', 'getTags');
cy.get('[data-testid="governance"]')

View File

@ -31,8 +31,7 @@ const adminEmail = `${adminName}@gmail.com`;
describe('Users flow should work properly', () => {
beforeEach(() => {
login(LOGIN.username, LOGIN.password);
cy.goToHomePage();
cy.login();
cy.get('[data-testid="appbar-item-settings"]')
.should('exist')

View File

@ -10,8 +10,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import { descriptionBox, interceptURL, login, uuid, verifyResponseStatusCode } from '../../common/common';
import { LOGIN } from '../../constants/constants';
import { descriptionBox, interceptURL, uuid, verifyResponseStatusCode } from '../../common/common';
const webhookName = `Webhook-ct-test-${uuid()}`;
@ -20,8 +19,7 @@ const endpointURL = 'http://localhost:8585';
describe('Webooks Page', () => {
beforeEach(() => {
login(LOGIN.username, LOGIN.password);
cy.goToHomePage();
cy.login();
cy.get('[data-testid="appbar-item-settings"]')
.should('exist')

View File

@ -14,7 +14,6 @@
// ***********************************************************
// Import commands.js using ES2015 syntax:
import 'cypress-localstorage-commands';
import './commands';
// Alternatively you can use CommonJS syntax:

View File

@ -181,7 +181,6 @@
"connect-api-mocker": "^1.10.0",
"copy-webpack-plugin": "^7.0.0",
"css-loader": "3.4.2",
"cypress-localstorage-commands": "^2.2.1",
"dotenv": "^16.0.0",
"eslint": "^6.6.0",
"eslint-config-prettier": "^6.11.0",

View File

@ -6057,11 +6057,6 @@ csstype@^3.0.2:
resolved "https://registry.yarnpkg.com/csstype/-/csstype-3.0.8.tgz#d2266a792729fb227cd216fb572f43728e1ad340"
integrity sha512-jXKhWqXPmlUeoQnF/EhTtTl4C9SnrxSH/jZUih3jmO6lBKr99rP3/+FmrMj4EFpOXzMtXHAZkd3x0E6h6Fgflw==
cypress-localstorage-commands@^2.2.1:
version "2.2.1"
resolved "https://registry.yarnpkg.com/cypress-localstorage-commands/-/cypress-localstorage-commands-2.2.1.tgz#9895d75a3e8059e78d61231c5794dc46e0fc5fdd"
integrity sha512-m7IwoM+BMOJj7FzzN4It268c/i/Ur72CQX8JwLICkQ6ZgF1XNJOIKlQ7Rszg45ATLTjVTL1QElKCZECoU8cthQ==
cypress@^10.7.0:
version "10.7.0"
resolved "https://registry.yarnpkg.com/cypress/-/cypress-10.7.0.tgz#2d37f8b9751c6de33ee48639cb7e67a2ce593231"