[FIX] Requests being skipped after reconnecting on onboarding (#4429)
This commit is contained in:
parent
a607980840
commit
c4d3af0e00
|
@ -45,16 +45,15 @@ function connect({ server, logoutOnError = false }: { server: string; logoutOnEr
|
||||||
if (sdk.current?.client?.host === server) {
|
if (sdk.current?.client?.host === server) {
|
||||||
return resolve();
|
return resolve();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Check for running requests and abort them before connecting to the server
|
||||||
|
abort();
|
||||||
|
|
||||||
disconnect();
|
disconnect();
|
||||||
database.setActiveDB(server);
|
database.setActiveDB(server);
|
||||||
|
|
||||||
store.dispatch(connectRequest());
|
store.dispatch(connectRequest());
|
||||||
|
|
||||||
// It's not called anywhere else
|
|
||||||
// if (this.connectTimeout) {
|
|
||||||
// clearTimeout(this.connectTimeout);
|
|
||||||
// }
|
|
||||||
|
|
||||||
if (connectingListener) {
|
if (connectingListener) {
|
||||||
connectingListener.then(stopListener);
|
connectingListener.then(stopListener);
|
||||||
}
|
}
|
||||||
|
@ -374,7 +373,6 @@ function abort() {
|
||||||
if (sdk.current) {
|
if (sdk.current) {
|
||||||
return sdk.current.abort();
|
return sdk.current.abort();
|
||||||
}
|
}
|
||||||
return new AbortController();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
function checkAndReopen() {
|
function checkAndReopen() {
|
||||||
|
|
|
@ -108,9 +108,6 @@ const handleSelectServer = function* handleSelectServer({ server, version, fetch
|
||||||
const basicAuth = UserPreferences.getString(`${BASIC_AUTH_KEY}-${server}`);
|
const basicAuth = UserPreferences.getString(`${BASIC_AUTH_KEY}-${server}`);
|
||||||
setBasicAuth(basicAuth);
|
setBasicAuth(basicAuth);
|
||||||
|
|
||||||
// Check for running requests and abort them before connecting to the server
|
|
||||||
Services.abort();
|
|
||||||
|
|
||||||
if (user) {
|
if (user) {
|
||||||
yield put(clearSettings());
|
yield put(clearSettings());
|
||||||
yield put(setUser(user));
|
yield put(setUser(user));
|
||||||
|
|
|
@ -40,7 +40,6 @@ async function navigateToLogin(server) {
|
||||||
await waitFor(element(by.id('login-view')))
|
await waitFor(element(by.id('login-view')))
|
||||||
.toExist()
|
.toExist()
|
||||||
.withTimeout(2000);
|
.withTimeout(2000);
|
||||||
await expect(element(by.id('login-view'))).toExist();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
async function navigateToRegister(server) {
|
async function navigateToRegister(server) {
|
||||||
|
@ -195,6 +194,9 @@ const checkServer = async server => {
|
||||||
.toBeVisible()
|
.toBeVisible()
|
||||||
.withTimeout(10000);
|
.withTimeout(10000);
|
||||||
await element(by.id('sidebar-close-drawer')).tap();
|
await element(by.id('sidebar-close-drawer')).tap();
|
||||||
|
await waitFor(element(by.id('sidebar-close-drawer')))
|
||||||
|
.not.toBeVisible()
|
||||||
|
.withTimeout(10000);
|
||||||
};
|
};
|
||||||
|
|
||||||
function runCommand(command) {
|
function runCommand(command) {
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
const { navigateToLogin, tapBack, platformTypes } = require('../../helpers/app');
|
const { navigateToLogin, tapBack, platformTypes, navigateToWorkspace, login } = require('../../helpers/app');
|
||||||
const data = require('../../data');
|
const data = require('../../data');
|
||||||
|
|
||||||
describe('Login screen', () => {
|
describe('Login screen', () => {
|
||||||
|
@ -74,5 +74,13 @@ describe('Login screen', () => {
|
||||||
.toBeVisible()
|
.toBeVisible()
|
||||||
.withTimeout(60000);
|
.withTimeout(60000);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
it('should connect, go back, connect to the same server and login', async () => {
|
||||||
|
await device.launchApp({ permissions: { notifications: 'YES' }, newInstance: true, delete: true });
|
||||||
|
await navigateToWorkspace();
|
||||||
|
await tapBack();
|
||||||
|
await navigateToLogin();
|
||||||
|
await login(data.users.regular.username, data.users.regular.password);
|
||||||
|
});
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
Loading…
Reference in New Issue