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

Commit

Permalink
MM-15457 E2E - Fix integrations Cypress spec (#2784)
Browse files Browse the repository at this point in the history
* add ID's to elements needed for testing, updated integrations spec

* rename file to fix typo

* remove unnecessary cy.log

* update snapshot tests

* update test steps
  • Loading branch information
Bob Lubecker authored and reflog committed May 14, 2019
1 parent 6111a59 commit 1f2cbf3
Show file tree
Hide file tree
Showing 25 changed files with 240 additions and 196 deletions.
9 changes: 8 additions & 1 deletion components/backstage/components/backstage_list.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ export default class BackstageList extends React.Component {
header: PropTypes.node.isRequired,
addLink: PropTypes.string,
addText: PropTypes.node,
addButtonId: PropTypes.string,
emptyText: PropTypes.node,
emptyTextSearch: PropTypes.node,
helpText: PropTypes.node,
Expand Down Expand Up @@ -68,7 +69,10 @@ export default class BackstageList extends React.Component {
}
} else if (this.props.emptyTextSearch) {
children = (
<span className='backstage-list__item backstage-list__empty'>
<span
className='backstage-list__item backstage-list__empty'
id='emptySearchResultsMessage'
>
{React.cloneElement(this.props.emptyTextSearch, {values: {searchTerm: filter}})}
</span>
);
Expand All @@ -77,6 +81,7 @@ export default class BackstageList extends React.Component {
}

let addLink = null;

if (this.props.addLink && this.props.addText) {
addLink = (
<Link
Expand All @@ -86,6 +91,7 @@ export default class BackstageList extends React.Component {
<button
type='button'
className='btn btn-primary'
id={this.props.addButtonId}
>
<span>
{this.props.addText}
Expand Down Expand Up @@ -113,6 +119,7 @@ export default class BackstageList extends React.Component {
value={this.state.filter}
onChange={this.updateFilter}
style={style.search}
id='searchInput'
/>
</div>
</div>
Expand Down
6 changes: 5 additions & 1 deletion components/backstage/components/backstage_section.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ export default class BackstageSection extends React.Component {
parentLink: PropTypes.string,
subsection: PropTypes.bool,
children: PropTypes.arrayOf(PropTypes.element),
id: PropTypes.string,
};
}

Expand Down Expand Up @@ -61,7 +62,10 @@ export default class BackstageSection extends React.Component {
}

return (
<li className={className}>
<li
className={className}
id={this.props.id}
>
<NavLink
className={`${className}-title`}
activeClassName={`${className}-title--active`}
Expand Down
5 changes: 5 additions & 0 deletions components/backstage/components/backstage_sidebar.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,7 @@ export default class BackstageSidebar extends React.Component {
defaultMessage='Incoming Webhooks'
/>
)}
id='incomingWebhooks'
/>
</TeamPermissionGate>
);
Expand All @@ -85,6 +86,7 @@ export default class BackstageSidebar extends React.Component {
defaultMessage='Outgoing Webhooks'
/>
)}
id='outgoingWebhooks'
/>
</TeamPermissionGate>
);
Expand All @@ -106,6 +108,7 @@ export default class BackstageSidebar extends React.Component {
defaultMessage='Slash Commands'
/>
)}
id='slashCommands'
/>
</TeamPermissionGate>
);
Expand All @@ -124,6 +127,7 @@ export default class BackstageSidebar extends React.Component {
defaultMessage='OAuth 2.0 Applications'
/>
}
id='oauthApps'
/>
</SystemPermissionGate>
);
Expand All @@ -140,6 +144,7 @@ export default class BackstageSidebar extends React.Component {
defaultMessage='Bot Accounts'
/>
}
id='botAccounts'
/>
</SystemPermissionGate>
);
Expand Down
1 change: 1 addition & 0 deletions components/channel_select/channel_select.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,7 @@ export default class ChannelSelect extends React.PureComponent {
className='form-control'
value={this.props.value}
onChange={this.props.onChange}
id='channelSelect'
>
{options}
</select>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -477,6 +477,7 @@ exports[`components/integrations/AbstractCommand should match snapshot 1`] = `
</Link>
<SpinnerButton
className="btn btn-primary"
id="saveCommand"
onClick={[Function]}
spinning={false}
spinningText="Loading"
Expand Down Expand Up @@ -976,6 +977,7 @@ exports[`components/integrations/AbstractCommand should match snapshot, displays
</Link>
<SpinnerButton
className="btn btn-primary"
id="saveCommand"
onClick={[Function]}
spinning={false}
spinningText="Loading"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -259,6 +259,7 @@ exports[`components/integrations/AbstractIncomingWebhook should call action func
</Link>
<SpinnerButton
className="btn btn-primary"
id="saveWebhook"
onClick={[Function]}
spinning={false}
spinningText="Loading"
Expand Down Expand Up @@ -535,6 +536,7 @@ exports[`components/integrations/AbstractIncomingWebhook should match snapshot 1
</Link>
<SpinnerButton
className="btn btn-primary"
id="saveWebhook"
onClick={[Function]}
spinning={false}
spinningText="Loading"
Expand Down Expand Up @@ -815,6 +817,7 @@ exports[`components/integrations/AbstractIncomingWebhook should match snapshot,
</Link>
<SpinnerButton
className="btn btn-primary"
id="saveWebhook"
onClick={[Function]}
spinning={false}
spinningText="Loading"
Expand Down Expand Up @@ -1056,6 +1059,7 @@ exports[`components/integrations/AbstractIncomingWebhook should match snapshot,
</Link>
<SpinnerButton
className="btn btn-primary"
id="saveWebhook"
onClick={[Function]}
spinning={false}
spinningText="Loading"
Expand Down Expand Up @@ -1297,6 +1301,7 @@ exports[`components/integrations/AbstractIncomingWebhook should match snapshot,
</Link>
<SpinnerButton
className="btn btn-primary"
id="saveWebhook"
onClick={[Function]}
spinning={false}
spinningText="Loading"
Expand Down Expand Up @@ -1573,6 +1578,7 @@ exports[`components/integrations/AbstractIncomingWebhook should match snapshot,
</Link>
<SpinnerButton
className="btn btn-primary"
id="saveWebhook"
onClick={[Function]}
spinning={false}
spinningText="Loading"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -301,6 +301,7 @@ https://test.com/callback2"
</Link>
<SpinnerButton
className="btn btn-primary"
id="saveOauthApp"
onClick={[Function]}
spinning={false}
spinningText="Loading"
Expand Down Expand Up @@ -623,6 +624,7 @@ exports[`components/integrations/AbstractOAuthApp should match snapshot, display
</Link>
<SpinnerButton
className="btn btn-primary"
id="saveOauthApp"
onClick={[Function]}
spinning={false}
spinningText="Loading"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -343,6 +343,7 @@ exports[`components/integrations/AbstractOutgoingWebhook should match snapshot 1
</Link>
<SpinnerButton
className="btn btn-primary"
id="saveWebhook"
onClick={[Function]}
spinning={false}
spinningText="loading"
Expand Down
1 change: 1 addition & 0 deletions components/integrations/abstract_command.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -614,6 +614,7 @@ export default class AbstractCommand extends React.PureComponent {
spinning={this.state.saving}
spinningText={Utils.localizeMessage(this.props.loading.id, this.props.loading.defaultMessage)}
onClick={this.handleSubmit}
id='saveCommand'
>
<FormattedMessage
id={this.props.footer.id}
Expand Down
1 change: 1 addition & 0 deletions components/integrations/abstract_incoming_webhook.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -362,6 +362,7 @@ export default class AbstractIncomingWebhook extends React.Component {
spinning={this.state.saving}
spinningText={localizeMessage(this.props.loading.id, this.props.loading.defaultMessage)}
onClick={this.handleSubmit}
id='saveWebhook'
>
<FormattedMessage
id={footerToRender.id}
Expand Down
1 change: 1 addition & 0 deletions components/integrations/abstract_oauth_app.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -451,6 +451,7 @@ export default class AbstractOAuthApp extends React.PureComponent {
spinning={this.state.saving}
spinningText={localizeMessage(this.props.loading.id, this.props.loading.defaultMessage)}
onClick={this.handleSubmit}
id='saveOauthApp'
>
<FormattedMessage
id={footerToRender.id}
Expand Down
1 change: 1 addition & 0 deletions components/integrations/abstract_outgoing_webhook.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -568,6 +568,7 @@ export default class AbstractOutgoingWebhook extends React.Component {
spinning={this.state.saving}
spinningText={localizeMessage(this.props.loading.id, this.props.loading.defaultMessage)}
onClick={this.handleSubmit}
id='saveWebhook'
>
<FormattedMessage
id={footerToRender.id}
Expand Down
1 change: 1 addition & 0 deletions components/integrations/bots/add_bot/add_bot.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -650,6 +650,7 @@ export default class AddBot extends React.Component {
spinning={this.state.adding}
spinningText={buttonActiveText}
onClick={this.handleSubmit}
id='saveBot'
>
{buttonText}
</SpinnerButton>
Expand Down
1 change: 1 addition & 0 deletions components/integrations/bots/bots.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -188,6 +188,7 @@ export default class Bots extends React.PureComponent {
/>
}
addLink={'/' + this.props.team.name + '/integrations/bots/add'}
addButtonId='addBotAccount'
emptyText={
<FormattedMessage
id='bots.manage.empty'
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ exports[`components/integrations/ConfirmIntegration should match snapshot, comma
>
<h4
className="backstage-form__title"
id="formTitle"
>
<FormattedMessage
defaultMessage="Setup Successful"
Expand Down Expand Up @@ -63,6 +64,7 @@ exports[`components/integrations/ConfirmIntegration should match snapshot, comma
>
<Link
className="btn btn-primary"
id="doneButton"
to="/team_test/integrations/commands"
type="submit"
>
Expand Down Expand Up @@ -102,6 +104,7 @@ exports[`components/integrations/ConfirmIntegration should match snapshot, incom
>
<h4
className="backstage-form__title"
id="formTitle"
>
<FormattedMessage
defaultMessage="Setup Successful"
Expand Down Expand Up @@ -138,6 +141,7 @@ exports[`components/integrations/ConfirmIntegration should match snapshot, incom
>
<Link
className="btn btn-primary"
id="doneButton"
to="/team_test/integrations/incoming_webhooks"
type="submit"
>
Expand Down Expand Up @@ -177,6 +181,7 @@ exports[`components/integrations/ConfirmIntegration should match snapshot, oauth
>
<h4
className="backstage-form__title"
id="formTitle"
>
<FormattedMessage
defaultMessage="Setup Successful"
Expand Down Expand Up @@ -252,6 +257,7 @@ exports[`components/integrations/ConfirmIntegration should match snapshot, oauth
>
<Link
className="btn btn-primary"
id="doneButton"
to="/team_test/integrations/oauth2-apps"
type="submit"
>
Expand Down Expand Up @@ -293,6 +299,7 @@ exports[`components/integrations/ConfirmIntegration should match snapshot, outgo
>
<h4
className="backstage-form__title"
id="formTitle"
>
<FormattedMessage
defaultMessage="Setup Successful"
Expand Down Expand Up @@ -329,6 +336,7 @@ exports[`components/integrations/ConfirmIntegration should match snapshot, outgo
>
<Link
className="btn btn-primary"
id="doneButton"
to="/team_test/integrations/outgoing_webhooks"
type="submit"
>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -275,7 +275,10 @@ export default class ConfirmIntegration extends React.Component {
/>
</BackstageHeader>
<div className='backstage-form backstage-form__confirmation'>
<h4 className='backstage-form__title'>
<h4
className='backstage-form__title'
id='formTitle'
>
<FormattedMessage
id='integrations.successful'
defaultMessage='Setup Successful'
Expand All @@ -288,6 +291,7 @@ export default class ConfirmIntegration extends React.Component {
className='btn btn-primary'
type='submit'
to={'/' + this.props.team.name + '/integrations/' + this.state.type}
id='doneButton'
>
<FormattedMessage
id='integrations.done'
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -114,6 +114,7 @@ export default class InstalledCommands extends React.PureComponent {
/>
}
addLink={'/' + this.props.team.name + '/integrations/commands/add'}
addButtonId='addSlashCommand'
emptyText={
<FormattedMessage
id='installed_commands.empty'
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -143,6 +143,7 @@ export default class InstalledIncomingWebhooks extends React.PureComponent {
/>
}
addLink={'/' + this.props.team.name + '/integrations/incoming_webhooks/add'}
addButtonId='addIncomingWebhook'
emptyText={
<FormattedMessage
id='installed_incoming_webhooks.empty'
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

exports[`components/integrations/InstalledOAuthApps should match snapshot 1`] = `
<BackstageList
addButtonId="addOauthApp"
addLink="/test/integrations/oauth2-apps/add"
addText="Add OAuth 2.0 Application"
emptyText={
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -116,6 +116,7 @@ export default class InstalledOAuthApps extends React.PureComponent {
props = {
addLink: '/' + this.props.team.name + '/integrations/oauth2-apps/add',
addText: localizeMessage('installed_oauth_apps.add', 'Add OAuth 2.0 Application'),
addButtonId: 'addOauthApp',
};
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -109,6 +109,7 @@ exports[`components/integrations/InstalledOutgoingWebhooks should match snapshot

exports[`components/integrations/InstalledOutgoingWebhooks should match snapshot 3`] = `
<BackstageList
addButtonId="addOutgoingWebhook"
addLink="/test/integrations/outgoing_webhooks/add"
addText={
<FormattedMessage
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -162,6 +162,7 @@ export default class InstalledOutgoingWebhooks extends React.PureComponent {
/>
}
addLink={'/' + this.props.team.name + '/integrations/outgoing_webhooks/add'}
addButtonId='addOutgoingWebhook'
emptyText={
<FormattedMessage
id='installed_outgoing_webhooks.empty'
Expand Down
Loading

0 comments on commit 1f2cbf3

Please sign in to comment.