Skip to content

Commit

Permalink
Add e2e test step to verify the issue close button works
Browse files Browse the repository at this point in the history
  • Loading branch information
GeordieP committed Oct 9, 2018
1 parent 9b1599e commit 539cb31
Show file tree
Hide file tree
Showing 3 changed files with 25 additions and 4 deletions.
18 changes: 16 additions & 2 deletions cypress/integration/e2e/2-admin-actions_spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ describe('Admin create/edit/delete flows', () => {
// author username
cy.root().should('contain', 'AdminUser');
// severity
cy.root().should('contain', 'high');
cy.root().should('contain', 'High');
// body text
cy.root().should('contain', bodyText);
});
Expand All @@ -56,12 +56,26 @@ describe('Admin create/edit/delete flows', () => {
// verify issue contents
cy.get('.IssueView-content').within(() => {
// severity
cy.root().should('contain', 'low');
cy.root().should('contain', 'Low');
// body text
cy.root().should('contain', bodyText);
});
});

it('Close issue', () => {
// issue should start open
cy.get('.IssueView-content').contains('Open');

// click close button
cy.get('[data-testid="closeIssue"]').click();

// verify issue is closed
cy.get('.IssueView-content').contains('Closed');

// verify close button is gone
cy.get('[data-testid="closeIssue"]').should('not.exist');
});

it('Delete issue', () => {
cy.get('[data-testid="deleteIssue"]').click();
// did we navigate? we deleted the only issue, and should be back on
Expand Down
4 changes: 4 additions & 0 deletions server/src/graphql/resolvers.ts
Original file line number Diff line number Diff line change
Expand Up @@ -354,6 +354,10 @@ export default (db: any) => {
throw new Error(`Insufficient Permissions. (required ${ PermissionLevel.Create }, had ${ level })`);
}

if (args.status) {
args.status = args.status.toLowerCase();
}

return new db.Issue({
...args,
creator: ctx.state.user.id,
Expand Down
7 changes: 5 additions & 2 deletions src/components/Issue/Segments.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,8 @@ interface Props extends HTMLAttributes<HTMLElement> {
children: any;
}

const capitalize = (str: string) => `${str[0].toUpperCase()}${str.slice(1)}`;

export default ({ issue, children, ...props }: Props) => {
const renderTitle = () => (
<h1 className='u-noMargin'>{issue.title}</h1>
Expand All @@ -30,8 +32,9 @@ export default ({ issue, children, ...props }: Props) => {
</section>

<section className='u-alignRight'>
<h4>{issue.type} | {issue.severity}</h4>
<h4>{issue.status}</h4>
{/* capitalize first letter of each field*/}
<h4>{capitalize(issue.type)} | {capitalize(issue.severity)}</h4>
<h4>{capitalize(issue.status)}</h4>
</section>
</section>
);
Expand Down

0 comments on commit 539cb31

Please sign in to comment.