Skip to content
This repository has been archived by the owner on Mar 13, 2024. It is now read-only.

[GH-10035] Added the cypress spec for cancel out leave a team modal #2232

Merged
merged 2 commits into from
Jan 8, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ exports[`components/LeaveTeamModal should render the leave team model 1`] = `
className="modal-confirm"
dialogComponentClass={[Function]}
enforceFocus={true}
id="leaveTeamModal"
keyboard={true}
manager={
ModalManager {
Expand Down Expand Up @@ -59,6 +60,7 @@ exports[`components/LeaveTeamModal should render the leave team model 1`] = `
>
<button
className="btn btn-default"
id="leaveTeamNo"
onClick={[MockFunction]}
type="button"
>
Expand Down
2 changes: 2 additions & 0 deletions components/leave_team_modal/leave_team_modal.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,7 @@ class LeaveTeamModal extends React.PureComponent {
className='modal-confirm'
show={this.props.show}
onHide={this.props.onHide}
id='leaveTeamModal'
>
<Modal.Header closeButton={false}>
<Modal.Title>
Expand All @@ -100,6 +101,7 @@ class LeaveTeamModal extends React.PureComponent {
type='button'
className='btn btn-default'
onClick={this.props.onHide}
id='leaveTeamNo'
>
<FormattedMessage
id='leave_team_modal.no'
Expand Down
45 changes: 45 additions & 0 deletions cypress/integration/team/teams_spec.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
// Copyright (c) 2015-present Mattermost, Inc. All Rights Reserved.
// See LICENSE.txt for license information.

// ***************************************************************
// - [number] indicates a test step (e.g. 1. Go to a page)
// - [*] indicates an assertion (e.g. * Check the title)
// - Use element ID when selecting an element. Create one if none.
// ***************************************************************

describe('Teams Suite', () => {
before(() => {
// 1. Login and go to /
cy.login('user-1');
cy.visit('/');
});

it('Cancel out of leaving a team', () => {
// * check the team name
cy.get('#headerTeamName').should('contain', 'eligendi');
hanzei marked this conversation as resolved.
Show resolved Hide resolved

// * check the initialUrl
cy.url().should('include', '/ad-1/channels/town-square');

// 2. open the drop down menu
cy.get('#sidebarHeaderDropdownButton').should('be.visible').click();

// 3. click the leave team
cy.get('#sidebarDropdownMenu #leaveTeam').should('be.visible').click();

hanzei marked this conversation as resolved.
Show resolved Hide resolved
// * Check that the "leave team modal" opened up
cy.get('#leaveTeamModal').should('be.visible');

// 4. click on no
cy.get('#leaveTeamNo').click();

// * Check that the "leave team modal" closed
cy.get('#leaveTeamModal').should('not.be.visible');

hanzei marked this conversation as resolved.
Show resolved Hide resolved
// * check the team name
cy.get('#headerTeamName').should('contain', 'eligendi');
hanzei marked this conversation as resolved.
Show resolved Hide resolved

// * check the finalUrl
cy.url().should('include', '/ad-1/channels/town-square');
});
});