e2e(fix): custom status expiry spec (#31358)

Этот коммит содержится в:
sabril
2025-06-11 11:27:45 +08:00
коммит произвёл GitHub
родитель d84f455ba0
Коммит 3230eaf84c

Просмотреть файл

@@ -12,19 +12,23 @@
import dayjs from 'dayjs';
describe('MM-T4064 Status expiry visibility', () => {
before(() => {
cy.apiUpdateConfig({TeamSettings: {EnableCustomUserStatuses: true}});
// # Login as test user and visit channel
cy.apiInitSetup({loginAfter: true}).then(({channelUrl}) => {
cy.visit(channelUrl);
});
});
const waitingTime = 60; //minutes
let expiresAt = dayjs();
const expiryTimeFormat = 'h:mm A';
it.skip('MM-T4064_6 should show expiry time in the tooltip of custom status emoji in the post header', () => {
beforeEach(() => {
cy.apiAdminLogin().apiUpdateConfig({TeamSettings: {EnableCustomUserStatuses: true}});
// # Login as test user and visit channel
cy.apiInitSetup({loginAfter: true}).then(({channelUrl}) => {
cy.visit(channelUrl);
// # Post a message in the channel
cy.postMessage('Hello World!');
});
});
it('MM-T4064_6 should show expiry time in the tooltip of custom status emoji in the post header', () => {
// # Open the user account menu
cy.uiOpenUserMenu('Set custom status');
@@ -44,9 +48,6 @@ describe('MM-T4064 Status expiry visibility', () => {
// # Note that we need to be flexible around accepted values, as this calculation and the server-side one may differ slightly
expiresAt = dayjs().add(waitingTime, 'minute');
// # Post a message in the channel
cy.postMessage('Hello World!');
// # Get the last post
cy.getLastPostId().then((postId) => {
// # Hover on the custom status emoji present in the post header
@@ -59,7 +60,37 @@ describe('MM-T4064 Status expiry visibility', () => {
});
});
it.skip('MM-T4064_7 should show custom status expiry time in the user popover', () => {
it('MM-T4064_7 should show custom status expiry time in the user popover', () => {
// # Open the user account menu
cy.uiOpenUserMenu('Set custom status');
// * Verify that the custom status modal opens
cy.findByRole('dialog', {name: 'Set a status'}).should('exist').within(() => {
// # Select a custom status from the suggestions
cy.get('.statusSuggestion__row').first().click();
// # Click on the Set Status button
cy.findByText('Set Status').click();
});
// * Modal should be closed
cy.get('#custom_status_modal').should('not.exist');
// # Setting the time at which the custom status should be expired
// # Note that we need to be flexible around accepted values, as this calculation and the server-side one may differ slightly
expiresAt = dayjs().add(waitingTime, 'minute');
// # Get the last post
cy.getLastPostId().then((postId) => {
// # Hover on the custom status emoji present in the post header
cy.get(`#post_${postId}`).find('.emoticon').should('exist').trigger('mouseenter');
// * Custom status tooltip should be visible and contain the correct custom status expiry time
cy.findByRole('tooltip').should('exist').and('contain.text', expiresAt.format(expiryTimeFormat));
cy.get(`#post_${postId}`).find('.emoticon').trigger('mouseleave');
});
// # Click on the post header of the last post by the current user and open profile popover
cy.get('.post.current--user .post__header .user-popover').first().click();
cy.get('div.user-profile-popover').should('exist');