Files
upstream-mattermost/e2e-tests/cypress/tests/integration/channels/interactive_dialog/scrollable_spec.js
upstream-mirror 240db4e2a7
Some checks failed
Server CI / Postgres (shard 0) (push) Has been skipped
Server CI / Postgres (shard 3) (push) Has been skipped
BuildEnv Docker Image / build-image (push) Failing after 4s
BuildEnv Docker Image / build-image-fips (push) Failing after 4s
Migration Review & Release Notes / Generate migration review & release notes (push) Failing after 3s
Server CI / Build Environment (push) Failing after 3s
Server CI / Postgres (shard 1) (push) Has been skipped
Tools CI / check-style (mattermost-govet) (push) Failing after 4s
Server CI / Postgres (shard 2) (push) Has been skipped
Tools CI / check-style (mmgotool) (push) Failing after 3s
Server CI / Elasticsearch v8 Compatibility (push) Has been skipped
Server CI / OpenSearch v2 Compatibility (push) Has been skipped
Server CI / Postgres FIPS (shard 0) (push) Has been skipped
Tools CI / Test (mattermost-govet) (push) Failing after 3s
Server CI / Postgres FIPS (shard 1) (push) Has been skipped
Server CI / Postgres FIPS (shard 2) (push) Has been skipped
Tools CI / Test (mmgotool) (push) Failing after 3s
Server CI / Postgres FIPS (shard 3) (push) Has been skipped
Server CI / Run mmctl tests (push) Has been skipped
Server CI / Run mmctl tests (FIPS) (push) Has been skipped
Server CI / Merge Postgres Test Results (push) Has been skipped
Server CI / Merge Postgres FIPS Test Results (push) Has been skipped
Server CI / Check backport migrations (push) Has been skipped
Server CI / Check generated files (push) Has been skipped
Server CI / check-style (push) Has been skipped
Server CI / Vet API (push) Has been skipped
Server CI / Build mattermost server app (push) Has been skipped
Server CI / Server CI Complete (push) Failing after 2s
Server CI / Server CI Artifacts (push) Has been skipped
Server CI / Sentry Upload (push) Has been skipped
Server CI / Server CI Report (push) Failing after 5m1s
Server CI Nightly Race / Race Detector (push) Has been skipped
CodeQL / Analyze (go) (push) Has been cancelled
CodeQL / Analyze (javascript) (push) Has been cancelled
Webapp CI Cache Warm / Warm Webapp node_modules Cache (push) Has been cancelled
E2E CI Cache Warm / Warm E2E npm Registry Cache (push) Has been cancelled
API / build (push) Has been cancelled
Web App CI / check-types (push) Has been cancelled
Web App CI / check-lint (push) Has been cancelled
Web App CI / check-i18n (push) Has been cancelled
Web App CI / check-external-links (push) Has been cancelled
Web App CI / test (platform) (push) Has been cancelled
Web App CI / test (mattermost-redux) (push) Has been cancelled
Web App CI / test (channels shard 1/4) (push) Has been cancelled
Web App CI / test (channels shard 2/4) (push) Has been cancelled
Web App CI / test (channels shard 3/4) (push) Has been cancelled
Web App CI / test (channels shard 4/4) (push) Has been cancelled
Web App CI / upload-coverage (push) Has been cancelled
Web App CI / build (push) Has been cancelled
YAML Lint / yamllint (push) Has been cancelled
Push mirrored docker images / cd/Push mirrored docker images (push) Has been cancelled
docs-cd / Build and deploy docs (push) Has been cancelled
Docs CI / build (push) Has been cancelled
E2E Cache Warm: Cypress deps / Warm Cypress deps cache (push) Has been cancelled
Scorecards supply-chain security / Scorecard analysis (push) Has been cancelled
Server CI Weekly / Postgres FIPS (push) Has been skipped
Server CI Weekly / Run mmctl tests (FIPS) (push) Has been skipped
Server CI Weekly / Postgres with binary parameters (push) Has been skipped
Server CI Weekly / Build Environment (push) Failing after 1s
Server CI Cache Warm / Warm Go Module and Build Cache (push) Failing after 2s
Server CI Nightly Race / Build Environment (push) Failing after 1s
snapshot of https://github.com/mattermost/mattermost.git (master, 2026-09-16; blobs > 131072B omitted)
2026-09-16 00:29:55 +05:00

165 lines
7.9 KiB
JavaScript
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
// Copyright (c) 2015-present Mattermost, Inc. All Rights Reserved.
// See LICENSE.txt for license information.
// ***************************************************************
// - [#] indicates a test step (e.g. # Go to a page)
// - [*] indicates an assertion (e.g. * Check the title)
// - Use element ID when selecting an element. Create one if none.
// ***************************************************************
// Stage: @prod
// Group: @channels @interactive_dialog
/**
* Note: This test requires webhook server running. Initiate `npm run start:webhook` to start.
*/
const webhookUtils = require('../../../../utils/webhook_utils');
let createdCommand;
let userAndChannelDialog;
describe('Interactive Dialog - Apps Form', () => {
before(() => {
cy.requireWebhookServer();
// # Ensure that teammate name display setting is set to default 'username'
cy.apiSaveTeammateNameDisplayPreference('username');
// # Create new team and create command on it
cy.apiCreateTeam('test-team', 'Test Team').then(({team}) => {
for (let i = 0; i < 20; i++) {
cy.apiCreateChannel(team.id, `channel-${i}`, `Channel ${i}`);
}
cy.visit(`/${team.name}`);
const webhookBaseUrl = Cypress.expose().webhookBaseUrl;
const command = {
auto_complete: false,
description: 'Test for user and channel dialog',
display_name: 'Dialog with user and channel',
icon_url: '',
method: 'P',
team_id: team.id,
trigger: 'user_and_channel_dialog',
url: `${webhookBaseUrl}/user_and_channel_dialog_request`,
username: '',
};
cy.apiCreateCommand(command).then(({data}) => {
createdCommand = data;
userAndChannelDialog = webhookUtils.getUserAndChannelDialog(createdCommand.id, webhookBaseUrl);
});
});
});
afterEach(() => {
// # Reload current page after each test to close any dialogs left open
cy.reload();
});
it('MM-T2498 - Individual "User" and "Channel" screens are scrollable', () => {
// # Ensure no modal is open before starting
cy.get('#appsModal').should('not.exist');
// # Post a slash command
cy.postMessage(`/${createdCommand.trigger} `);
// * Verify that the apps form modal opens up
cy.get('#appsModal').should('be.visible').within(() => {
// * Verify that the header of modal contains icon URL, title and close button
cy.get('.modal-header').should('be.visible').within(($elForm) => {
cy.get('#appsModalIconUrl').should('be.visible').and('have.attr', 'src').and('not.be.empty');
cy.get('#appsModalLabel').should('be.visible').and('have.text', userAndChannelDialog.dialog.title);
cy.wrap($elForm).find('button.close').should('be.visible').and('contain', '×').and('contain', 'Close');
});
// * Verify that the body contains the both elements
cy.get('.modal-body').should('be.visible').children('.form-group').should('have.length', 2).each(($elForm, index) => {
const element = userAndChannelDialog.dialog.elements[index];
cy.wrap($elForm).find('label').first().scrollIntoView().should('be.visible').and('contain', element.display_name);
// ReactSelect structure - check for MultiInput element
cy.wrap($elForm).find('[id^=\'MultiInput_\']').should('be.visible');
// * Verify that the dropdown opens on click
cy.wrap($elForm).find('[id^=\'MultiInput_\']').click();
// Break out of .within() scope to find options in document and wait for them to be visible
cy.document().then((doc) => {
cy.wrap(doc).find('.react-select__menu').should('be.visible');
cy.wrap(doc).find('.react-select__option').should('have.length.greaterThan', 0);
});
if (index === 0) {
expect(element.name).to.equal('someuserselector');
// Test scrollability by navigating through ReactSelect options
cy.document().then((doc) => {
// Wait for options to be loaded and ensure first option exists
cy.wrap(doc).find('.react-select__option').first().should('exist');
// Navigate using keyboard on the input element
cy.wrap($elForm).find('[id^=\'MultiInput_\']').find('input').type('{uparrow}', {force: true});
cy.wrap($elForm).find('[id^=\'MultiInput_\']').find('input').type('{downarrow}'.repeat(10), {force: true});
// Verify scrolling happened by checking if first option is still in view
cy.wrap(doc).find('.react-select__option').first().then(($firstOption) => {
// Just verify the option exists - visibility may change due to scrolling
expect($firstOption.length).to.be.greaterThan(0);
});
cy.wrap($elForm).find('[id^=\'MultiInput_\']').find('input').type('{uparrow}'.repeat(10), {force: true});
cy.wrap(doc).find('.react-select__option').first().should('exist');
});
} else if (index === 1) {
expect(element.name).to.equal('somechannelselector');
// Test scrollability by navigating through ReactSelect options
cy.document().then((doc) => {
// Wait for options to be loaded and ensure first option exists
cy.wrap(doc).find('.react-select__option').first().should('exist');
// Navigate using keyboard on the input element
cy.wrap($elForm).find('[id^=\'MultiInput_\']').find('input').type('{uparrow}', {force: true});
cy.wrap($elForm).find('[id^=\'MultiInput_\']').find('input').type('{downarrow}'.repeat(10), {force: true});
// Verify scrolling happened by checking if first option is still in view
cy.wrap(doc).find('.react-select__option').first().then(($firstOption) => {
// Just verify the option exists - visibility may change due to scrolling
expect($firstOption.length).to.be.greaterThan(0);
});
cy.wrap($elForm).find('[id^=\'MultiInput_\']').find('input').type('{uparrow}'.repeat(10), {force: true});
cy.wrap(doc).find('.react-select__option').first().should('exist');
});
}
// # Select one element to close the dropdown
cy.document().then((doc) => {
cy.wrap(doc).find('.react-select__option').first().click({force: true});
});
if (element.help_text) {
cy.wrap($elForm).find('.help-text').should('exist').and('contain', element.help_text);
}
});
// * Verify that the footer contains cancel and submit buttons
cy.get('.modal-footer').should('be.visible').within(($elForm) => {
cy.wrap($elForm).find('#appsModalCancel').should('be.visible').and('have.text', 'Cancel');
cy.wrap($elForm).find('#appsModalSubmit').should('be.visible').and('have.text', userAndChannelDialog.dialog.submit_label);
});
// # Close interactive dialog
cy.get('.modal-header').should('be.visible').within(($elForm) => {
cy.wrap($elForm).find('button.close').should('be.visible').click();
});
cy.get('#appsModal').should('not.exist');
});
});
});