Skip to content

Commit

Permalink
feat!: Remove beta gate, deprecate MVP site (#565)
Browse files Browse the repository at this point in the history
* Redirect all routes to beta pages or 404

* Remove beta banner from layout

* Remove betaContext from app

* Use redirects instead of rewrites, remove beta context use

* Removing join beta from e2e tests

* Update auth test

* Update e2e tests

* Remove test for canonical link tag
  • Loading branch information
Suzanne Rozier authored Mar 23, 2022
1 parent 2e8b3ae commit d0f180f
Show file tree
Hide file tree
Showing 13 changed files with 235 additions and 393 deletions.
3 changes: 0 additions & 3 deletions e2e/cypress/integration/about-us.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,10 @@ import logging from '../plugins/logging'
describe('About Us', () => {
before(() => {
cy.loginTestIDP()
cy.visit('/joinbeta')
})

beforeEach(() => {
cy.preserveLoginCookies()
cy.preserveBetaCookie()

cy.visit('/')
cy.injectAxe()
})
Expand Down
71 changes: 7 additions & 64 deletions e2e/cypress/integration/auth.spec.js
Original file line number Diff line number Diff line change
@@ -1,29 +1,10 @@
describe('The Authentication flow', () => {
describe('access without being logged in', () => {
it('requires a user to be logged in to view MVP pages', () => {
it('requires a user to be logged in to view the portal routes', () => {
cy.clearCookies()
const mvpRoutes = [
'/',
'/about-us',
'/about-us/accomplishments',
'/news',
'/training-and-education',
'training-and-education/force-multiplier-program',
]
const routes = ['/', '/sites-and-applications', '/about-us', '/news']

mvpRoutes.forEach((url) => {
cy.visit(url)
cy.url().should('match', /login/)
})
})

it('requires a user to be logged in to view beta pages', () => {
cy.clearCookies()
cy.visit('/joinbeta')

const betaRoutes = ['/', '/sites-and-applications']

betaRoutes.forEach((url) => {
routes.forEach((url) => {
cy.visit(url)
cy.url().should('match', /login/)
})
Expand All @@ -46,23 +27,8 @@ describe('The Authentication flow', () => {
).as('testIDPLogout')
})

it('a user can log into and out of the MVP site', () => {
it('a user can log into and out of the portal', () => {
cy.loginTestIDP()
cy.visit('/')
cy.contains('Manage your life')
cy.url().should('eq', Cypress.config().baseUrl + '/')

cy.contains('Log out').click()
cy.wait('@logout')

cy.visit('/')
cy.url().should('match', /login/)
})

it('a user can log into and out of the beta site', () => {
cy.loginTestIDP()
cy.visit('/joinbeta')

cy.visit('/')
cy.contains('My Space')
cy.url().should('eq', Cypress.config().baseUrl + '/')
Expand All @@ -85,30 +51,12 @@ describe('The Authentication flow', () => {
cy.preserveLoginCookies()
})

it('can load the user on MVP pages', () => {
const mvpRoutes = [
'/',
'/about-us',
'/about-us/accomplishments',
'/news',
'/training-and-education',
'training-and-education/force-multiplier-program',
]

mvpRoutes.forEach((url) => {
cy.visit(url)
cy.wait('@getUser')
.its('response.statusCode')
.should('be.oneOf', [200, 304])
})
})

it('can load the user on beta pages', () => {
it('loads the user on each route', () => {
cy.visit('/joinbeta')

const betaRoutes = ['/', '/sites-and-applications']
const routes = ['/', '/sites-and-applications', '/about-us', '/news']

betaRoutes.forEach((url) => {
routes.forEach((url) => {
cy.visit(url)
cy.wait('@getUser')
.its('response.statusCode')
Expand All @@ -125,19 +73,14 @@ describe('The Authentication flow', () => {

it('logging in as Test User 1 loads their My Space data', () => {
cy.loginTestIDP()
cy.visit('/joinbeta')

cy.contains('My Space')
cy.contains('Welcome, BERNADETTE CAMPBELL')

cy.contains('Example Collection')
cy.contains('Second Collection')
})

it('logging in as Test User 2 loads their My Space data', () => {
cy.loginTestIDP({ username: 'user2', password: 'user2pass' })
cy.visit('/joinbeta')

cy.contains('My Space')
cy.contains('Welcome, RONALD BOYD')
cy.contains('Third Collection')
Expand Down
33 changes: 0 additions & 33 deletions e2e/cypress/integration/beta.spec.js

This file was deleted.

114 changes: 0 additions & 114 deletions e2e/cypress/integration/mvp.spec.js

This file was deleted.

86 changes: 86 additions & 0 deletions e2e/cypress/integration/navigation.spec.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,86 @@
import logging from '../plugins/logging'

describe('Routes & navigation', () => {
describe('logged in pages', () => {
before(() => {
cy.loginTestIDP()
})

beforeEach(() => {
cy.preserveLoginCookies()
})

it('can navigate to the home page', () => {
cy.visit('/')
cy.injectAxe()
cy.contains('Welcome, BERNADETTE CAMPBELL')
cy.contains('Welcome to the new Space Force Service Portal!')
cy.contains('My Space')

// Check a11y
cy.checkA11y(null, null, logging, { skipFailures: true })

// Check meta data
cy.document()
cy.get('head title').should('contain', 'Space Force Portal')
})

it('can navigate to the News page', () => {
cy.visit('/news')
cy.injectAxe()
cy.contains('Latest news')
cy.checkA11y(null, null, logging, { skipFailures: true })
})

it('can navigate to the About Us page', () => {
cy.visit('/about-us')
cy.injectAxe()
cy.contains('About the Space Force')
cy.checkA11y(null, null, logging, { skipFailures: true })
})

it('can navigate to the Sites & Applications page', () => {
cy.visit('/sites-and-applications')
cy.injectAxe()
cy.contains('Sites & Applications')
cy.checkA11y(null, null, logging, { skipFailures: true })
})

describe('redirects', () => {
it('redirects deprecated MVP routes to the 404 page', () => {
const routes = [
'/about-us/accomplishments',
'/training-and-education',
'/training-and-education/force-multiplier-program',
]

routes.forEach((url) => {
cy.visit(url, { failOnStatusCode: false })
cy.url().should('eq', Cypress.config().baseUrl + '/404')
})
})

it('redirects deprecated beta routes to the home page', () => {
const routes = ['/joinbeta', '/leavebeta']

routes.forEach((url) => {
cy.visit(url)
cy.url().should('eq', Cypress.config().baseUrl + '/')
})
})
})
})

describe('logged out pages', () => {
beforeEach(() => {
cy.clearCookies()
})

it('can visit the login page', () => {
cy.visit('/login')
cy.injectAxe()
cy.contains('Space Force Portal Login')
cy.checkA11y(null, null, logging, { skipFailures: true })
})
})
})
4 changes: 0 additions & 4 deletions e2e/cypress/integration/news.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,15 +2,11 @@ import logging from '../plugins/logging'

describe('News and Announcements', () => {
before(() => {
// Reset the database
cy.task('db:seed')
cy.loginTestIDP()
cy.visit('/joinbeta')
})

beforeEach(() => {
cy.preserveLoginCookies()
cy.preserveBetaCookie()

cy.intercept(
'https://www.spaceforce.mil/DesktopModules/ArticleCS/RSS.ashx?ContentType=1&Site=1060&max=12'
Expand Down
2 changes: 0 additions & 2 deletions e2e/cypress/integration/sites-and-applications.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,10 @@ describe('Sites and Applications', () => {
// Reset the database
cy.task('db:seed')
cy.loginTestIDP()
cy.visit('/joinbeta')
})

beforeEach(() => {
cy.preserveLoginCookies()
cy.preserveBetaCookie()
cy.visit('/')
})

Expand Down
Loading

0 comments on commit d0f180f

Please sign in to comment.