Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Improve the create account onboarding flow #140

Merged
merged 25 commits into from
Jan 13, 2021
Merged
Show file tree
Hide file tree
Changes from 24 commits
Commits
Show all changes
25 commits
Select commit Hold shift + click to select a range
16afd5c
Inline buttons
MaxwellBo Jan 9, 2021
8add1d9
Improve adjacency
MaxwellBo Jan 9, 2021
398b30f
Make the committee list overflow
MaxwellBo Jan 9, 2021
18ddde2
Add 404 page
MaxwellBo Jan 9, 2021
2c3e905
Tag the committee with the right template
MaxwellBo Jan 9, 2021
c3c284d
Improve header
MaxwellBo Jan 9, 2021
c3ea067
Update compatability notice
MaxwellBo Jan 9, 2021
30aadc5
Add the intermediate create account stage
MaxwellBo Jan 9, 2021
f947b46
Move the conditional for rendering notices
MaxwellBo Jan 9, 2021
6ccb27d
Fix copy for committee creation
MaxwellBo Jan 9, 2021
bc8fe2b
Preserve password when moving to create an account
MaxwellBo Jan 9, 2021
eb6440b
Fix typo
MaxwellBo Jan 9, 2021
6368f80
Cut down the copy a bit more
MaxwellBo Jan 9, 2021
2071218
Add field requirements in CreateAccount mode
MaxwellBo Jan 9, 2021
04a1262
Fix Cypress tests
MaxwellBo Jan 9, 2021
e660388
Remove useless default dict
MaxwellBo Jan 9, 2021
ff848c7
Fix Cypress tests again
MaxwellBo Jan 10, 2021
ec72892
Rejig the onboard form
MaxwellBo Jan 10, 2021
18db193
Fix Cypress tests again
MaxwellBo Jan 10, 2021
bfdf0bc
Title stages of authorisation
MaxwellBo Jan 10, 2021
709a04c
Evenly split button width
MaxwellBo Jan 10, 2021
c318352
Make autocomplete work better
MaxwellBo Jan 10, 2021
c89318a
Purge email and password fields after logging in and creating
MaxwellBo Jan 10, 2021
ddbfa2d
Add message for committee empty state
kumar-ish Jan 12, 2021
10a1a69
Other/older -> older/other
kumar-ish Jan 12, 2021
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
44 changes: 21 additions & 23 deletions cypress/integration/onboard.spec.js
Original file line number Diff line number Diff line change
@@ -1,10 +1,8 @@
import { purge, enterUsernameAndPassword } from './utils'
import { purge, enterUsername, enterCurrentPassword, enterNewPassword } from './utils'

const CHAIRPERSON = 'Test chairperson'
const TEMPLATE = 'UN Security Council'
const TOPIC = 'Test topic'
const COMMITTEE = 'Test committee'
const CONFERENCE = 'Test conference'
const TEMPLATE = 'Security Council'

describe('Run through creating a new committee', function () {
before(function() {
Expand All @@ -18,38 +16,41 @@ describe('Run through creating a new committee', function () {
})

it('attempts to create an account that is already in use, and then logs in', function () {
cy.get('button').contains('Login').then(() => {
enterUsernameAndPassword()

cy.get('button').contains('Log in').then(() => {
cy.contains('Create account').click()

enterUsername()
enterNewPassword()

cy.get('button').contains('Create account').click()

cy.contains('in use by another account')

cy.get('button').contains('Login').click()
cy.get('a').contains('Back to login').click()

enterCurrentPassword()

cy.get('button').contains('Log in').click()
})
})

it('creates a new Security Council committee', function () {
cy.get('div')
.contains('Template to skip manual member creation (optional)')
.type(TEMPLATE + '{enter}')
.contains(TEMPLATE)

cy.get('input[placeholder="Committee name"')
.type(COMMITTEE)
.should('have.value', COMMITTEE)
.should('have.value', TEMPLATE)

cy.get('input[placeholder="Committee topic"')
.type(TOPIC)
.should('have.value', TOPIC)

cy.get('input[placeholder="Name(s) of chairperson or chairpeople"')
.type(CHAIRPERSON)
.should('have.value', CHAIRPERSON)

cy.get('input[placeholder="Conference name"')
.type(CONFERENCE)
.should('have.value', CONFERENCE)

cy.get('div')
.contains('Template to skip manual member creation (optional)')
.type(TEMPLATE + '{enter}')
.contains(TEMPLATE)

const createButton = cy.get('button').contains('Create committee')

createButton.should('not.be.disabled')
Expand All @@ -58,13 +59,10 @@ describe('Run through creating a new committee', function () {
cy.url().should('include', '/committees')

cy.get('input[placeholder="Committee name"')
.should('have.value', COMMITTEE)
.should('have.value', TEMPLATE)

cy.get('input[placeholder="Committee topic"')
.should('have.value', TOPIC)

cy.get('input[placeholder="Name(s) of chairperson or chairpeople"')
.should('have.value', CHAIRPERSON)
})

it('observes the templated prepopulated member list for the Security Council', function () {
Expand Down
19 changes: 9 additions & 10 deletions cypress/integration/utils.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,30 +6,29 @@ export function purge() {
cy.clearLocalStorage()
}

export function enterUsernameAndPassword() {
export function enterUsername() {
cy.get('input[autocomplete=email]')
.type('[email protected]')
.should('have.value', '[email protected]')
}

export function enterCurrentPassword() {
cy.get('input[autocomplete=current-password]')
.type('fakepassword')
.should('have.value', 'fakepassword')
}

export function enterUsernameAndPasswordAndHitsEnter() {
cy.get('input[autocomplete=email]')
.type('[email protected]')
.should('have.value', '[email protected]')

cy.get('input[autocomplete=current-password]')
.type('fakepassword{enter}')
export function enterNewPassword() {
cy.get('input[autocomplete=new-password]')
.type('fakepassword')
.should('have.value', 'fakepassword')
}

export function invokeModalAndLogin() {
cy.get('button').contains('Login').click()
enterUsernameAndPassword()
cy.get('.modal').find('button').contains('Login').click()
enterUsername()
enterCurrentPassword()
cy.get('.modal').find('button').contains('Log in').click()
cy.get('body').type('{esc}')
cy.wait(2000)
}
12 changes: 7 additions & 5 deletions src/App.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -9,12 +9,13 @@ import 'firebase/database';
import 'firebase/firestore';
import 'firebase/storage';

import { Route } from 'react-router-dom';
import { Route, Switch } from 'react-router-dom';
import './App.css';

import Onboard from './components/Onboard';
import Homepage from './components/Homepage';
import Committee from './components/Committee';
import { NotFound } from './components/NotFound';

const firebaseConfig = {
apiKey: 'AIzaSyA9EuEf7m3YOTBhBNhoe7DcOIZJP2toL6w',
Expand All @@ -27,17 +28,18 @@ const firebaseConfig = {

firebase.initializeApp(firebaseConfig);



class App extends React.Component {
render() {
return (
<React.Fragment>
<Switch>
<Route exact path="/" component={Homepage} />
<Route exact path="/onboard" component={Onboard} />
<Route exact path="/committees" component={Onboard} />
<Route path="/committees/:committeeID" component={Committee} />
</React.Fragment>
<Route path="*">
<NotFound item="page" id="unknown" />
</Route>
</Switch>
);
}
}
Expand Down
Loading