diff --git a/bin/restore-mastodon-data.js b/bin/restore-mastodon-data.js index 222119b..42028ac 100644 --- a/bin/restore-mastodon-data.js +++ b/bin/restore-mastodon-data.js @@ -45,6 +45,7 @@ export async function restoreMastodonData () { console.log('Restoring mastodon data...') let internalIdsToIds = {} for (let action of actions) { + await new Promise(resolve => setTimeout(resolve, 1000)) // delay so that notifications have proper order console.log(JSON.stringify(action)) let accessToken = users[action.user].accessToken diff --git a/bin/setup-mastodon-in-travis.sh b/bin/setup-mastodon-in-travis.sh index fdf46e6..fe9c1ad 100755 --- a/bin/setup-mastodon-in-travis.sh +++ b/bin/setup-mastodon-in-travis.sh @@ -1,7 +1,6 @@ #!/usr/bin/env bash set -e -set -x if [[ "$COMMAND" = deploy-dev-travis ]]; then exit 0 # no need to setup mastodon in this case diff --git a/routes/settings/quick-login.html b/routes/settings/quick-login.html new file mode 100644 index 0000000..8670401 --- /dev/null +++ b/routes/settings/quick-login.html @@ -0,0 +1,32 @@ + + \ No newline at end of file diff --git a/tests/roles.js b/tests/roles.js index 497bb90..2344d49 100644 --- a/tests/roles.js +++ b/tests/roles.js @@ -1,22 +1,9 @@ -import { - authorizeInput, emailInput, getUrl, instanceInput, mastodonLogInButton, - passwordInput, - sleep -} from './utils' +import { getUrl } from './utils' import { users } from './users' -async function login (t, username, password) { - await sleep(500) - await t.typeText(instanceInput, 'localhost:3000', {paste: true}) - await sleep(500) - return t - .pressKey('enter') - .expect(getUrl()).eql('http://localhost:3000/auth/sign_in', {timeout: 30000}) - .typeText(emailInput, username, {paste: true}) - .typeText(passwordInput, password, {paste: true}) - .click(mastodonLogInButton) - .expect(getUrl()).contains('/oauth/authorize') - .click(authorizeInput) +// quick login using a secret page and a known access token (makes tests run faster) +async function login (t, user) { + await t.navigateTo(`/settings/quick-login?instanceName=localhost:3000&accessToken=${user.accessToken}`) .expect(getUrl()).eql('http://localhost:4002/', {timeout: 30000}) } @@ -30,11 +17,9 @@ async function login (t, username, password) { // }) export async function loginAsFoobar (t) { - await t.navigateTo('/settings/instances/add') - await login(t, users.foobar.email, users.foobar.password) + await login(t, users.foobar) } export async function loginAsLockedAccount (t) { - await t.navigateTo('/settings/instances/add') - await login(t, users.LockedAccount.email, users.LockedAccount.password) + await login(t, users.LockedAccount) }