Skip to content

Commit

Permalink
CYPRESS: fix announcement cypress (#16536)
Browse files Browse the repository at this point in the history
* fix announcement cypress

* changes as per comments

* fix the cypress failure
  • Loading branch information
Ashish8689 authored Jun 5, 2024
1 parent d374e48 commit fcb87b5
Show file tree
Hide file tree
Showing 3 changed files with 22 additions and 13 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -449,10 +449,14 @@ class EntityClass {
// Announcement

createAnnouncement() {
createAnnouncementUtil({
title: 'Cypress announcement',
description: 'Cypress announcement description',
});
createAnnouncementUtil(
{
title: 'Cypress announcement',
description: 'Cypress announcement description',
},
this.entityName,
this.name
);
}

replyAnnouncement() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ const announcementForm = ({ title, description, startDate, endDate }) => {
cy.get('[id="announcement-submit"]').scrollIntoView().click();
};

export const createAnnouncement = (announcement) => {
export const createAnnouncement = (announcement, entityName, updatedName) => {
interceptURL(
'GET',
'/api/v1/feed?entityLink=*type=Announcement',
Expand Down Expand Up @@ -75,6 +75,15 @@ export const createAnnouncement = (announcement) => {
announcement.title
);
cy.goToHomePage();

cy.get('[data-testid="announcement-container"]')
.find(`a[href*="${encodeURIComponent(entityName)}"]`)
.click();

cy.get('[data-testid="entity-header-display-name"]').should(
'contain',
`Cypress ${updatedName} updated`
);
};

export const deleteAnnouncement = () => {
Expand Down Expand Up @@ -113,10 +122,6 @@ export const replyAnnouncementUtil = () => {
interceptURL('GET', '/api/v1/feed/*', 'allAnnouncementFeed');
interceptURL('POST', '/api/v1/feed/*/posts', 'addAnnouncementReply');

cy.get('[data-testid="announcement-container"] [data-testid="entity-link"]')
.first()
.click();

cy.get('[data-testid="announcement-card"]').click();

cy.get(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -106,6 +106,10 @@ describe('Entity detail page', { tags: 'DataAssets' }, () => {
entity.removeGlossary();
});

it(`Update displayName`, () => {
entity.renameEntity();
});

it(`Announcement create & delete`, () => {
entity.createAnnouncement();
entity.replyAnnouncement();
Expand Down Expand Up @@ -145,10 +149,6 @@ describe('Entity detail page', { tags: 'DataAssets' }, () => {
});
}

it(`Update displayName`, () => {
entity.renameEntity();
});

it(`follow unfollow entity`, () => {
entity.followUnfollowEntity();
});
Expand Down

0 comments on commit fcb87b5

Please sign in to comment.