Move /e2e -> /e2e-tests
Этот коммит содержится в:
@@ -0,0 +1,101 @@
|
||||
// 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.
|
||||
// ***************************************************************
|
||||
|
||||
// Group: @channels @subpath
|
||||
|
||||
import * as TIMEOUTS from '../../../fixtures/timeouts';
|
||||
|
||||
describe('Subpath Channel routing', () => {
|
||||
let testUser;
|
||||
let testTeam;
|
||||
let otherUser;
|
||||
|
||||
before(() => {
|
||||
cy.shouldRunWithSubpath();
|
||||
|
||||
cy.apiInitSetup().then(({team, user}) => {
|
||||
testTeam = team;
|
||||
testUser = user;
|
||||
|
||||
cy.apiCreateUser({prefix: 'otherUser'}).then(({user: newUser}) => {
|
||||
otherUser = newUser;
|
||||
cy.apiAddUserToTeam(team.id, newUser.id);
|
||||
});
|
||||
|
||||
// # Login as test user
|
||||
cy.apiLogin(testUser);
|
||||
});
|
||||
});
|
||||
|
||||
it('MM-T986 - Should go to town square channel view', () => {
|
||||
// # Go to town square channel
|
||||
cy.visit(`/${testTeam.name}/channels/town-square`);
|
||||
|
||||
// * Check if the channel is loaded correctly
|
||||
cy.get('#channelHeaderTitle', {timeout: TIMEOUTS.ONE_MIN}).should('be.visible').should('contain', 'Town Square');
|
||||
});
|
||||
|
||||
it('MM-T987 - Rejoin channel with permalink', () => {
|
||||
// # Visit Town Square channel
|
||||
cy.visit(`/${testTeam.name}/channels/town-square`);
|
||||
|
||||
// # Create a new channel
|
||||
cy.apiCreateChannel(testTeam.id, 'subpath-channel', 'subpath-channel', 'O', 'subpath-ch').then(({channel}) => {
|
||||
// # Visit newly created channel
|
||||
cy.visit(`/${testTeam.name}/channels/${channel.name}`);
|
||||
|
||||
// # Post a message
|
||||
cy.postMessage('Subpath Test Message');
|
||||
|
||||
// # Create permalink to post
|
||||
cy.getLastPostId().then((id) => {
|
||||
const permalink = `${Cypress.config('baseUrl')}/${testTeam.name}/pl/${id}`;
|
||||
|
||||
// # Click on ... button of last post
|
||||
cy.clickPostDotMenu(id);
|
||||
|
||||
// # Click on "Copy Link"
|
||||
cy.uiClickCopyLink(permalink, id);
|
||||
|
||||
// # Leave the channel
|
||||
cy.uiLeaveChannel();
|
||||
|
||||
// # Visit the permalink
|
||||
cy.visit(permalink);
|
||||
|
||||
// * Check that we have rejoined the channel
|
||||
cy.get('#channelHeaderTitle', {timeout: TIMEOUTS.ONE_MIN}).should('be.visible').should('contain', 'subpath-channel');
|
||||
|
||||
// * Check that the post message is the correct one
|
||||
cy.get(`#postMessageText_${id}`).should('contain', 'Subpath Test Message');
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
it('MM-T988 - Should redirect to DM on login', () => {
|
||||
// # Create a direct channel between two users
|
||||
cy.apiCreateDirectChannel([testUser.id, otherUser.id]).then(() => {
|
||||
const dmChannelURL = `/${testTeam.name}/messages/@${otherUser.username}`;
|
||||
|
||||
// # Logout
|
||||
cy.apiLogout();
|
||||
|
||||
// # Visit the channel using the channel name
|
||||
cy.visit(dmChannelURL);
|
||||
|
||||
// # Login
|
||||
cy.findByPlaceholderText('Email or Username').clear().type(testUser.username);
|
||||
cy.findByPlaceholderText('Password').clear().type(testUser.password);
|
||||
cy.get('#saveSetting').should('not.be.disabled').click();
|
||||
|
||||
// * Check that we in are in DM channel
|
||||
cy.get('#channelHeaderTitle', {timeout: TIMEOUTS.ONE_MIN}).should('be.visible').should('contain', otherUser.username);
|
||||
});
|
||||
});
|
||||
});
|
||||
@@ -0,0 +1,69 @@
|
||||
// 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.
|
||||
// ***************************************************************
|
||||
|
||||
// Group: @channels @subpath
|
||||
|
||||
import * as TIMEOUTS from '../../../fixtures/timeouts';
|
||||
import {generateRandomUser} from '../../../support/api/user';
|
||||
import {getAdminAccount} from '../../../support/env';
|
||||
|
||||
describe('Subpath Direct Message Search', () => {
|
||||
let testTeam;
|
||||
|
||||
before(() => {
|
||||
cy.shouldRunWithSubpath();
|
||||
|
||||
cy.apiInitSetup().then(({team, user}) => {
|
||||
testTeam = team;
|
||||
cy.apiLogin(user);
|
||||
});
|
||||
});
|
||||
|
||||
it('MM-T989 - User on other subpath, but not on this one, should not show in DM More list', () => {
|
||||
const admin = getAdminAccount();
|
||||
const secondServer = Cypress.env('secondServerURL');
|
||||
|
||||
// # Log into admin account of other subpath server
|
||||
cy.request({
|
||||
headers: {'X-Requested-With': 'XMLHttpRequest'},
|
||||
url: `${secondServer}/api/v4/users/login`,
|
||||
method: 'POST',
|
||||
body: {login_id: admin.username, password: admin.password},
|
||||
}).then((response) => {
|
||||
expect(response.status).to.equal(200);
|
||||
|
||||
// # Create a user on other subpath server
|
||||
const newUser = generateRandomUser('otherSubpathUser');
|
||||
const createUserOption = {
|
||||
headers: {'X-Requested-With': 'XMLHttpRequest'},
|
||||
method: 'POST',
|
||||
url: `${secondServer}/api/v4/users`,
|
||||
body: newUser,
|
||||
};
|
||||
cy.request(createUserOption).then((userRes) => {
|
||||
expect(userRes.status).to.equal(201);
|
||||
const otherSubpathUser = userRes.body;
|
||||
|
||||
// # Go to town square channel of primary subpath server
|
||||
cy.visit(`/${testTeam.name}/channels/town-square`);
|
||||
|
||||
// # Open DM modal
|
||||
cy.uiAddDirectMessage().click().wait(TIMEOUTS.HALF_SEC);
|
||||
|
||||
// # Search for username from other subpath server
|
||||
cy.get('#selectItems input').
|
||||
typeWithForce(otherSubpathUser.username).
|
||||
wait(TIMEOUTS.HALF_SEC);
|
||||
|
||||
// * Verify username does not show up in search result
|
||||
cy.get(`#displayedUserName${otherSubpathUser.username}`).should('not.exist');
|
||||
});
|
||||
});
|
||||
});
|
||||
});
|
||||
@@ -0,0 +1,66 @@
|
||||
// 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.
|
||||
// ***************************************************************
|
||||
|
||||
// Group: @channels @subpath @not_cloud @signin_authentication
|
||||
|
||||
describe('Cookie with Subpath', () => {
|
||||
let testUser;
|
||||
let townsquareLink;
|
||||
|
||||
before(() => {
|
||||
cy.shouldRunWithSubpath();
|
||||
cy.shouldNotRunOnCloudEdition();
|
||||
|
||||
// # Create new team and user
|
||||
cy.apiInitSetup().then(({team, user}) => {
|
||||
testUser = user;
|
||||
|
||||
// Logout current session and try to visit town-square
|
||||
cy.apiLogout().then(() => {
|
||||
townsquareLink = `/${team.name}/channels/town-square`;
|
||||
cy.visit(townsquareLink);
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
it('should generate cookie with subpath', () => {
|
||||
cy.url().then((url) => {
|
||||
cy.location().its('origin').then((origin) => {
|
||||
let subpath = '';
|
||||
if (url !== origin) {
|
||||
subpath = url.replace(origin, '').replace(townsquareLink, '');
|
||||
}
|
||||
|
||||
// * Check login page is loaded
|
||||
cy.get('.login-body-card').should('be.visible');
|
||||
|
||||
// # Login as testUser
|
||||
cy.get('#input_loginId').should('be.visible').type(testUser.username);
|
||||
cy.get('#input_password-input').should('be.visible').type(testUser.password);
|
||||
cy.get('#saveSetting').should('be.visible').click();
|
||||
|
||||
// * Check login success
|
||||
cy.get('#channel_view').should('be.visible');
|
||||
|
||||
// * Check subpath included in url
|
||||
cy.url().should('include', subpath);
|
||||
cy.url().should('include', '/channels/town-square');
|
||||
|
||||
// * Check cookies have correct path parameter
|
||||
cy.getCookies().should('have.length', 5).each((cookie) => {
|
||||
if (subpath) {
|
||||
expect(cookie).to.have.property('path', subpath);
|
||||
} else {
|
||||
expect(cookie).to.have.property('path', '/');
|
||||
}
|
||||
});
|
||||
});
|
||||
});
|
||||
});
|
||||
});
|
||||
Ссылка в новой задаче
Block a user