Files
mostlymatter/e2e-tests/cypress/tests/support/ui/file_preview.js
M-ZubairAhmed fd6a662d76 [MM-62074] Move tooltips with withTooltip to new Tooltip component (#29528)
* replace inside of comp/withtooltip

* remove overlay trigger eslint rl

* update location of prev migrated new tooltips

* copy button

* shared_channel_indicator, shared_user_indicator.tsx, size_aware_image

* actions_menu, old_admin_settings, schema_admin_settings, admin_settings

* billing_summary, brand_image_setting, edit_section_edit_table_row, elapsed_duration_cell

* permissions_scheme_summary,secure_connections/controls,system_users_column_toggler_menu,system_users_export,group/group_users/users_to_remove_groups

* team_profile,user_grid_role_dropdown,priority_labels,toggle_formatting_bar,use_emoji_picker,formatting_icon

* show_formatting,alert_banner others

* more

* snap fix

* add disabled prop to menu

* test fix for avatar

feat: Add id to WithTooltip in Avatars component to fix test failures

* combine refs in withtooltip

* channel header title favorite test fix

* priority label comp changes

* types check for children

* Update avatar.tsx

* e2e fixes

* fix E2E tests

* Remove memo from WithTooltip

I found that the web app leaks a fair bit less memory when this is removed. See https://community.mattermost.com/core/pl/gwyyoww9gtbg8fddoic9meq84y for more information

* e2e lint fixes

* e2e fixes

* Fix test style issue

---------

Co-authored-by: yasserfaraazkhan <attitude3cena.yf@gmail.com>
Co-authored-by: Harrison Healey <harrisonmhealey@gmail.com>
Co-authored-by: Mattermost Build <build@mattermost.com>
2024-12-18 21:56:30 +00:00

68 строки
2.2 KiB
JavaScript

// Copyright (c) 2015-present Mattermost, Inc. All Rights Reserved.
// See LICENSE.txt for license information.
Cypress.Commands.add('uiGetFileThumbnail', (filename) => {
return cy.findByLabelText(`file thumbnail ${filename.toLowerCase()}`);
});
Cypress.Commands.add('uiGetFileUploadPreview', () => {
return cy.get('.file-preview__container');
});
Cypress.Commands.add('uiWaitForFileUploadPreview', () => {
cy.waitUntil(() => cy.uiGetFileUploadPreview().then((el) => {
return el.find('.post-image.normal').length > 0;
}));
});
Cypress.Commands.add('uiGetFilePreviewModal', (options = {exist: true}) => {
if (options.exist) {
return cy.get('.file-preview-modal').should('be.visible');
}
return cy.get('.file-preview-modal').should('not.exist');
});
Cypress.Commands.add('uiGetPublicLink', (options = {exist: true}) => {
if (options.exist) {
return cy.get('.icon-link-variant').should('be.visible');
}
return cy.get('.icon-link-variant').should('not.exist');
});
Cypress.Commands.add('uiGetHeaderFilePreviewModal', () => {
return cy.uiGetFilePreviewModal().find('.file-preview-modal-header').should('be.visible');
});
Cypress.Commands.add('uiOpenFilePreviewModal', (filename) => {
if (filename) {
cy.uiGetFileThumbnail(filename.toLowerCase()).click();
} else {
cy.findByTestId('fileAttachmentList').children().first().click();
}
});
Cypress.Commands.add('uiCloseFilePreviewModal', () => {
return cy.uiGetFilePreviewModal().find('.icon-close').click();
});
Cypress.Commands.add('uiGetContentFilePreviewModal', () => {
return cy.uiGetFilePreviewModal().find('.file-preview-modal__content');
});
Cypress.Commands.add('uiGetDownloadLinkFilePreviewModal', () => {
return cy.uiGetFilePreviewModal().find('.icon-link-variant');
});
Cypress.Commands.add('uiGetDownloadFilePreviewModal', () => {
return cy.uiGetFilePreviewModal().find('.icon-download-outline');
});
Cypress.Commands.add('uiGetArrowLeftFilePreviewModal', () => {
return cy.uiGetFilePreviewModal().find('.icon-chevron-left');
});
Cypress.Commands.add('uiGetArrowRightFilePreviewModal', () => {
return cy.uiGetFilePreviewModal().find('.icon-chevron-right');
});