#389: add e2e tests for invalid refreshToken case. Minor bug fixes

This commit is contained in:
SleepWalker
2018-02-18 20:09:32 +02:00
parent bf2976c009
commit 206627be17
20 changed files with 1371 additions and 14 deletions

View File

@@ -53,7 +53,10 @@ describe('components/accounts/actions', () => {
available: [],
active: null
},
user: {}
auth: {
credentials: {},
},
user: {},
});
sinon.stub(authentication, 'validateToken').named('authentication.validateToken');
@@ -197,7 +200,10 @@ describe('components/accounts/actions', () => {
active: account.id,
available: [account]
},
user
auth: {
credentials: {},
},
user,
});
});
@@ -279,7 +285,10 @@ describe('components/accounts/actions', () => {
active: account2.id,
available: [account, account2]
},
user
auth: {
credentials: {},
},
user,
});
});
@@ -338,7 +347,7 @@ describe('components/accounts/actions', () => {
active: foreignAccount.id,
available: [account, foreignAccount, foreignAccount2]
},
user
user,
});
});
@@ -409,7 +418,10 @@ describe('components/accounts/actions', () => {
active: foreignAccount.id,
available: [foreignAccount, foreignAccount2]
},
user
auth: {
credentials: {},
},
user,
});
logoutStrangers()(dispatch, getState);

View File

@@ -373,6 +373,7 @@ class PanelTransition extends Component {
const backButton = (
<button style={sideScrollStyle}
className={panelStyles.headerControl}
data-e2e-go-back
type="button"
onClick={this.onGoBack}
>

View File

@@ -226,12 +226,15 @@ export function setLogin(login: ?string) {
}
export function relogin(login: ?string) {
return (dispatch: (Function | Object) => void) => {
return (dispatch: (Function | Object) => void, getState: () => Object) => {
const credentials = getCredentials(getState());
const returnUrl = credentials.returnUrl || location.pathname + location.search;
dispatch({
type: SET_CREDENTIALS,
payload: {
login,
returnUrl: location.pathname + location.search,
returnUrl,
isRelogin: true,
},
});

View File

@@ -42,7 +42,10 @@ describe('refreshTokenMiddleware', () => {
expect(dispatch, 'to have a call satisfying', [
{
type: 'auth:setCredentials',
payload: {login: email}
payload: {
login: email,
returnUrl: expect.it('to be a string'),
},
}
]);
@@ -68,7 +71,10 @@ describe('refreshTokenMiddleware', () => {
active: account,
available: [account]
},
user: {}
auth: {
credentials: {},
},
user: {},
});
});
@@ -140,7 +146,10 @@ describe('refreshTokenMiddleware', () => {
active: account,
available: [account]
},
user: {}
auth: {
credentials: {},
},
user: {},
});
const req = {url: 'foo', options: {}};
@@ -284,7 +293,10 @@ describe('refreshTokenMiddleware', () => {
refreshToken: null,
}]
},
user: {}
auth: {
credentials: {},
},
user: {},
});
return expect(

View File

@@ -50,7 +50,7 @@ class AuthPage extends Component<{
<AppInfo {...client} onGoToAuth={this.onGoToAuth} />
</div>
<div className={styles.content}>
<div className={styles.content} data-e2e-content>
<Switch>
<Route path="/login" render={renderPanelTransition(Login)} />
<Route path="/mfa" render={renderPanelTransition(Mfa)} />

View File

@@ -64,7 +64,7 @@ class RootPage extends Component<{
<div id="view-port" className={classNames(styles.viewPort, {
[styles.isPopupActive]: isPopupActive
})}>
<div className={styles.header}>
<div className={styles.header} data-e2e-toolbar>
<div className={styles.headerContent}>
<Link to="/" className={styles.logo} onClick={onLogoClick}>
<Message {...messages.siteName} />