Skip to content

Commit

Permalink
prettier run 2 electric boogaloo.
Browse files Browse the repository at this point in the history
  • Loading branch information
Ryan-Koch committed Mar 23, 2020
1 parent a007a1e commit 8f24048
Show file tree
Hide file tree
Showing 21 changed files with 336 additions and 706 deletions.
4 changes: 1 addition & 3 deletions cypress/integration/api/static/staticHosting.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,7 @@ describe('static file hosting', () => {
});

it('returns the correct status', () => {
cy.request('/downloads/direct_deposit_form.pdf')
.its('status')
.should('equal', 200);
cy.request('/downloads/direct_deposit_form.pdf').its('status').should('equal', 200);
});

it('rejects POST requests', () => {
Expand Down
8 changes: 4 additions & 4 deletions cypress/integration/mymove/homepage.js
Original file line number Diff line number Diff line change
@@ -1,18 +1,18 @@
/* global cy */
import { milmoveAppName } from '../../support/constants';

describe('The Home Page', function() {
describe('The Home Page', function () {
beforeEach(() => {
cy.setupBaseUrl(milmoveAppName);
});
it('creates new devlocal user', function() {
it('creates new devlocal user', function () {
cy.signInAsNewMilMoveUser();
});
it('successfully loads when not logged in', function() {
it('successfully loads when not logged in', function () {
cy.logout();
milmoveUserIsOnSignInPage();
});
it('contains the link to customer service', function() {
it('contains the link to customer service', function () {
cy.visit('/');
cy.get('[data-cy=contact-footer]').contains('Contact Us');
cy.get('address').within(() => {
Expand Down
12 changes: 6 additions & 6 deletions cypress/integration/mymove/landingPages.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,27 +2,27 @@

import { milmoveAppName } from '../../support/constants';

describe('testing landing pages', function() {
describe('testing landing pages', function () {
// Submitted draft move/orders but no move type yet.
it('tests pre-move type', function() {
it('tests pre-move type', function () {
// sm_no_move_type@example.com
draftMove('9ceb8321-6a82-4f6d-8bb3-a1d85922a202');
});

// PPM: SUBMITTED
it('tests submitted PPM', function() {
it('tests submitted PPM', function () {
// ppm@incomple.te
ppmSubmitted('e10d5964-c070-49cb-9bd1-eaf9f7348eb6');
});

// PPM: APPROVED
it('tests approved PPM', function() {
it('tests approved PPM', function () {
// ppm@approv.ed
ppmApproved('70665111-7bbb-4876-a53d-18bb125c943e');
});

// PPM: PAYMENT_REQUESTED
it('tests PPM that has requested payment', function() {
it('tests PPM that has requested payment', function () {
// ppmpayment@request.ed
ppmPaymentRequested('beccca28-6e15-40cc-8692-261cae0d4b14');
});
Expand All @@ -31,7 +31,7 @@ describe('testing landing pages', function() {
// Not seeing a path to a COMPLETED PPM move at this time.

// PPM: CANCELED
it('tests canceled PPM', function() {
it('tests canceled PPM', function () {
// [email protected]
canceledMove('20102768-4d45-449c-a585-81bc386204b1');
});
Expand Down
40 changes: 14 additions & 26 deletions cypress/integration/mymove/mymoveCSRFProtect.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,73 +4,63 @@ import { milmoveAppName } from '../../support/constants';

// CSRF protection is turned on for all routes.
// We can test with the local dev login that uses POST
describe('testing CSRF protection for dev login', function() {
describe('testing CSRF protection for dev login', function () {
const csrfForbiddenMsg = 'Forbidden - CSRF token invalid\n';
const csrfForbiddenRespCode = 403;
const userId = '9ceb8321-6a82-4f6d-8bb3-a1d85922a202';

it('tests dev login with both unmasked and masked token', function() {
it('tests dev login with both unmasked and masked token', function () {
cy.signInAsUserPostRequest(milmoveAppName, userId);
cy.contains('Move to be scheduled');
cy.contains('Next Step: Finish setting up your move');
});

it('tests dev login with masked token only', function() {
it('tests dev login with masked token only', function () {
cy.signInAsUserPostRequest(milmoveAppName, userId, csrfForbiddenRespCode, csrfForbiddenMsg, false, true, false);
});

it('tests dev login with unmasked token only', function() {
it('tests dev login with unmasked token only', function () {
cy.signInAsUserPostRequest(milmoveAppName, userId, csrfForbiddenRespCode, csrfForbiddenMsg, true, false, false);
});

it('tests dev login without unmasked and masked token', function() {
it('tests dev login without unmasked and masked token', function () {
cy.signInAsUserPostRequest(milmoveAppName, userId, csrfForbiddenRespCode, csrfForbiddenMsg, false, false, false);
});
});

describe('testing CSRF protection updating user profile', function() {
describe('testing CSRF protection updating user profile', function () {
const userId = '9ceb8321-6a82-4f6d-8bb3-a1d85922a202';

it('tests updating user profile with proper tokens', function() {
it('tests updating user profile with proper tokens', function () {
cy.signIntoMyMoveAsUser(userId);

cy.visit('/moves/review/edit-profile');

// update info
cy.get('select[name=affiliation]')
.should('exist')
.should('have.value', 'ARMY');
cy.get('select[name=affiliation]').should('exist').should('have.value', 'ARMY');

cy.get('input[name="middle_name"]')
.clear()
.type('CSRF Test')
.blur();
cy.get('input[name="middle_name"]').clear().type('CSRF Test').blur();

// save info
cy.get('button[type="submit"]').click();

cy.location().should(loc => {
cy.location().should((loc) => {
expect(loc.pathname).to.match(/^\/$/);
});

// reload page
cy.visit('/moves/review/edit-profile');

cy.get('input[name="middle_name"]')
.should('exist')
.should('have.value', 'CSRF Test');
cy.get('input[name="middle_name"]').should('exist').should('have.value', 'CSRF Test');
});

it('tests updating user profile without masked token', function() {
it('tests updating user profile without masked token', function () {
cy.signIntoMyMoveAsUser(userId);

cy.visit('/moves/review/edit-profile');

// update info
cy.get('input[name="middle_name"]')
.clear()
.type('CSRF failed!')
.blur();
cy.get('input[name="middle_name"]').clear().type('CSRF failed!').blur();

//clear out masked token
cy.clearCookie('masked_gorilla_csrf');
Expand All @@ -83,8 +73,6 @@ describe('testing CSRF protection updating user profile', function() {
// reload page
cy.visit('/moves/review/edit-profile');

cy.get('input[name="middle_name"]')
.should('exist')
.should('not.have.value', 'CSRF failed!');
cy.get('input[name="middle_name"]').should('exist').should('not.have.value', 'CSRF failed!');
});
});
24 changes: 8 additions & 16 deletions cypress/integration/mymove/orders.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,33 +2,25 @@

import { milmoveAppName } from '../../support/constants';

describe('orders entry', function() {
it('will accept orders information', function() {
describe('orders entry', function () {
it('will accept orders information', function () {
cy.signInAsUserPostRequest(milmoveAppName, 'feac0e92-66ec-4cab-ad29-538129bf918e');
cy.contains('New move (from Yuma AFB)');
cy.contains('No details');
cy.contains('No documents');
cy.contains('Continue Move Setup').click();

cy.location().should(loc => {
cy.location().should((loc) => {
expect(loc.pathname).to.eq('/orders/');
});

cy.get('select[name="orders_type"]').select('Permanent Change Of Station');

cy.get('input[name="issue_date"]')
.first()
.click();
cy.get('input[name="issue_date"]').first().click();

cy.get('input[name="issue_date"]')
.first()
.type('6/2/2018{enter}')
.blur();
cy.get('input[name="issue_date"]').first().type('6/2/2018{enter}').blur();

cy.get('input[name="report_by_date"]')
.last()
.type('8/9/2018{enter}')
.blur();
cy.get('input[name="report_by_date"]').last().type('8/9/2018{enter}').blur();

// Choosing same current and destination duty station should block you from progressing and give an error
cy.selectDutyStation('Yuma AFB', 'new_duty_station');
Expand All @@ -41,15 +33,15 @@ describe('orders entry', function() {

cy.nextPage();

cy.location().should(loc => {
cy.location().should((loc) => {
expect(loc.pathname).to.eq('/orders/upload');
});

cy.setFeatureFlag('ppmPaymentRequest=false', '/');
cy.contains('NAS Fort Worth JRB (from Yuma AFB)');
cy.get('[data-cy="move-header-weight-estimate"]').contains('5,000 lbs');
cy.contains('Continue Move Setup').click();
cy.location().should(loc => {
cy.location().should((loc) => {
expect(loc.pathname).to.eq('/orders/upload');
});
});
Expand Down
Loading

0 comments on commit 8f24048

Please sign in to comment.