From 9857baedbc9c221d3dfd96ce3ddbda3d3405b742 Mon Sep 17 00:00:00 2001 From: Maximilian Stoiber Date: Fri, 30 Mar 2018 11:58:08 +0200 Subject: [PATCH 001/207] Fix e2e tests @brianlovin we need to run resetdb both before() and beforeEach(), because otherwise the cy.visit('/whatever') runs before the beforeEach() so it'd 404. --- cypress/support/index.js | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/cypress/support/index.js b/cypress/support/index.js index 070776b2b5..90186bfe4a 100644 --- a/cypress/support/index.js +++ b/cypress/support/index.js @@ -17,10 +17,9 @@ import './commands'; before(() => { - cy.exec( - `node -e "const teardown = require('./shared/testing/teardown.js')().then(() => process.exit())"` - ); - cy.exec( - `node -e "const setup = require('./shared/testing/setup.js')().then(() => process.exit())"` - ); + cy.resetdb(); +}); + +beforeEach(() => { + cy.resetdb(); }); From cba37206a22a6f236eb58499a9be30bde3d04aa3 Mon Sep 17 00:00:00 2001 From: Maximilian Stoiber Date: Fri, 30 Mar 2018 12:33:24 +0200 Subject: [PATCH 002/207] Replace all before(s with beforeEach(s --- .../channel/settings/create_spec.js | 2 +- .../channel/settings/delete_spec.js | 4 +-- .../integration/channel/settings/edit_spec.js | 4 +-- .../integration/channel/view/composer_spec.js | 8 ++--- .../integration/channel/view/members_spec.js | 2 +- .../channel/view/membership_spec.js | 12 ++++---- .../channel/view/notifications_spec.js | 6 ++-- .../integration/channel/view/profile_spec.js | 14 ++++----- .../integration/channel/view/search_spec.js | 2 +- .../integration/channel/view/threads_spec.js | 4 +-- cypress/integration/home_spec.js | 2 +- cypress/integration/inbox_spec.js | 2 +- cypress/integration/pricing_spec.js | 4 +-- cypress/integration/privacy_page_spec.js | 4 +-- cypress/integration/terms_page_spec.js | 4 +-- cypress/integration/thread/action_bar_spec.js | 18 +++++------ cypress/integration/thread/chat_input_spec.js | 8 ++--- cypress/integration/thread/view_spec.js | 30 +++++++++---------- cypress/integration/user_spec.js | 2 +- 19 files changed, 66 insertions(+), 66 deletions(-) diff --git a/cypress/integration/channel/settings/create_spec.js b/cypress/integration/channel/settings/create_spec.js index 5580567e4c..814925c655 100644 --- a/cypress/integration/channel/settings/create_spec.js +++ b/cypress/integration/channel/settings/create_spec.js @@ -13,7 +13,7 @@ const { userId: ownerInChannelId } = data.usersChannels.find( // NOTE @brian: I will finish this after payments-api-v2 merges describe('create a channel', () => { - before(() => { + beforeEach(() => { cy.auth(ownerInChannelId); // NOTE @brian: I can not get this to auth directly into /settings, having to work around for now cy.visit(`/${community.slug}`); diff --git a/cypress/integration/channel/settings/delete_spec.js b/cypress/integration/channel/settings/delete_spec.js index 18b9feb32e..af28fadb76 100644 --- a/cypress/integration/channel/settings/delete_spec.js +++ b/cypress/integration/channel/settings/delete_spec.js @@ -20,7 +20,7 @@ const { userId: ownerInPrivateChannelId } = data.usersChannels.find( ); describe('deleting general channel', () => { - before(() => { + beforeEach(() => { cy.auth(ownerInChannelId); cy.visit(`/${community.slug}/${channel.slug}`); }); @@ -38,7 +38,7 @@ describe('deleting general channel', () => { }); describe('deleting a channel', () => { - before(() => { + beforeEach(() => { cy.auth(ownerInPrivateChannelId); cy.visit(`/${privateCommunity.slug}/${privateChannel.slug}`); }); diff --git a/cypress/integration/channel/settings/edit_spec.js b/cypress/integration/channel/settings/edit_spec.js index 9fa0c44545..92d43f3829 100644 --- a/cypress/integration/channel/settings/edit_spec.js +++ b/cypress/integration/channel/settings/edit_spec.js @@ -16,7 +16,7 @@ const ORIGINAL_NAME = ' General'; const ORIGINAL_DESCRIPTION = 'General chatter'; describe('edit a channel', () => { - before(() => { + beforeEach(() => { cy.auth(ownerInChannelId); cy.visit(`/${community.slug}/${channel.slug}`); }); @@ -60,7 +60,7 @@ describe('edit a channel', () => { }); describe('undo editing a channel', () => { - before(() => { + beforeEach(() => { cy.auth(ownerInChannelId); cy.visit(`/${community.slug}/${channel.slug}`); }); diff --git a/cypress/integration/channel/view/composer_spec.js b/cypress/integration/channel/view/composer_spec.js index 2ed1029f20..7e05617c23 100644 --- a/cypress/integration/channel/view/composer_spec.js +++ b/cypress/integration/channel/view/composer_spec.js @@ -20,7 +20,7 @@ const { userId: memberInArchivedChannelId } = data.usersChannels.find( const QUIET_USER_ID = constants.QUIET_USER_ID; describe('renders composer for logged in members', () => { - before(() => { + beforeEach(() => { cy.auth(memberInChannelId); cy.visit(`/${community.slug}/${channel.slug}`); }); @@ -37,7 +37,7 @@ describe('renders composer for logged in members', () => { }); describe('does not render composer for non members', () => { - before(() => { + beforeEach(() => { cy.auth(QUIET_USER_ID); cy.visit(`/${community.slug}/${channel.slug}`); }); @@ -50,7 +50,7 @@ describe('does not render composer for non members', () => { }); describe('does not render composer for logged out users', () => { - before(() => { + beforeEach(() => { cy.visit(`/${community.slug}/${channel.slug}`); }); @@ -62,7 +62,7 @@ describe('does not render composer for logged out users', () => { }); describe('does not render composer for archived channel', () => { - before(() => { + beforeEach(() => { cy.auth(memberInArchivedChannelId); cy.visit(`/${community.slug}/${archivedChannel.slug}`); }); diff --git a/cypress/integration/channel/view/members_spec.js b/cypress/integration/channel/view/members_spec.js index 4816bc7f19..741a8c2ab5 100644 --- a/cypress/integration/channel/view/members_spec.js +++ b/cypress/integration/channel/view/members_spec.js @@ -9,7 +9,7 @@ const usersChannels = data.usersChannels const members = data.users.filter(user => usersChannels.indexOf(user.id) >= 0); describe('renders members list on channel view', () => { - before(() => { + beforeEach(() => { cy.visit(`/${community.slug}/${channel.slug}`); }); diff --git a/cypress/integration/channel/view/membership_spec.js b/cypress/integration/channel/view/membership_spec.js index f942b21260..9e2ad692aa 100644 --- a/cypress/integration/channel/view/membership_spec.js +++ b/cypress/integration/channel/view/membership_spec.js @@ -58,7 +58,7 @@ const join = () => { }; describe('logged out channel membership', () => { - before(() => { + beforeEach(() => { cy.visit(`/${community.slug}/${publicChannel.slug}`); }); @@ -68,7 +68,7 @@ describe('logged out channel membership', () => { }); describe('channel profile as member', () => { - before(() => { + beforeEach(() => { cy.auth(memberInChannelId); cy.visit(`/${community.slug}/${publicChannel.slug}`); }); @@ -80,7 +80,7 @@ describe('channel profile as member', () => { }); describe('channel profile as non-member', () => { - before(() => { + beforeEach(() => { cy.auth(QUIET_USER_ID); cy.visit(`/${community.slug}/${publicChannel.slug}`); }); @@ -92,7 +92,7 @@ describe('channel profile as non-member', () => { }); describe('channel profile as owner', () => { - before(() => { + beforeEach(() => { cy.auth(ownerInChannelId); cy.visit(`/${community.slug}/${publicChannel.slug}`); }); @@ -107,7 +107,7 @@ describe('channel profile as owner', () => { describe('private channel profile', () => { describe('private channel as member', () => { - before(() => { + beforeEach(() => { cy.auth(memberInPrivateChannelId); cy.visit(`/${community.slug}/${privateChannel.slug}`); }); @@ -118,7 +118,7 @@ describe('private channel profile', () => { }); describe('private channel as non-member', () => { - before(() => { + beforeEach(() => { cy.auth(QUIET_USER_ID); cy.visit(`/${community.slug}/${privateChannel.slug}`); }); diff --git a/cypress/integration/channel/view/notifications_spec.js b/cypress/integration/channel/view/notifications_spec.js index 92df56ed80..4dab9a1ce9 100644 --- a/cypress/integration/channel/view/notifications_spec.js +++ b/cypress/integration/channel/view/notifications_spec.js @@ -12,7 +12,7 @@ const { userId: memberInChannelId } = data.usersChannels.find( const QUIET_USER_ID = constants.QUIET_USER_ID; describe('channel notification preferences logged out', () => { - before(() => { + beforeEach(() => { cy.visit(`/${community.slug}/${channel.slug}`); }); @@ -24,7 +24,7 @@ describe('channel notification preferences logged out', () => { }); describe('channel notification preferences as member', () => { - before(() => { + beforeEach(() => { cy.auth(memberInChannelId); cy.visit(`/${community.slug}/${channel.slug}`); }); @@ -45,7 +45,7 @@ describe('channel notification preferences as member', () => { }); describe('channel profile as non-member', () => { - before(() => { + beforeEach(() => { cy.auth(QUIET_USER_ID); cy.visit(`/${community.slug}/${channel.slug}`); }); diff --git a/cypress/integration/channel/view/profile_spec.js b/cypress/integration/channel/view/profile_spec.js index db8f261232..bcd054b613 100644 --- a/cypress/integration/channel/view/profile_spec.js +++ b/cypress/integration/channel/view/profile_spec.js @@ -18,7 +18,7 @@ const { userId: memberInPrivateChannelId } = data.usersChannels.find( ); describe('public channel', () => { - before(() => { + beforeEach(() => { cy.visit(`/${community.slug}/${publicChannel.slug}`); }); @@ -35,7 +35,7 @@ describe('public channel', () => { }); describe('archived channel', () => { - before(() => { + beforeEach(() => { cy.visit(`/${community.slug}/${archivedChannel.slug}`); }); @@ -50,7 +50,7 @@ describe('archived channel', () => { }); describe('deleted channel', () => { - before(() => { + beforeEach(() => { cy.visit(`/${community.slug}/${deletedChannel.slug}`); }); @@ -61,7 +61,7 @@ describe('deleted channel', () => { }); describe('blocked in public channel', () => { - before(() => { + beforeEach(() => { cy.auth(blockedInChannelId); cy.visit(`/${community.slug}/${publicChannel.slug}`); }); @@ -73,7 +73,7 @@ describe('blocked in public channel', () => { }); describe('member in private channel', () => { - before(() => { + beforeEach(() => { cy.auth(memberInPrivateChannelId); cy.visit(`/${community.slug}/${privateChannel.slug}`); }); @@ -84,7 +84,7 @@ describe('member in private channel', () => { }); describe('blocked in private channel', () => { - before(() => { + beforeEach(() => { cy.auth(blockedInChannelId); cy.visit(`/${community.slug}/${privateChannel.slug}`); }); @@ -95,7 +95,7 @@ describe('blocked in private channel', () => { }); describe('is not logged in', () => { - before(() => { + beforeEach(() => { cy.visit(`/${community.slug}/${privateChannel.slug}`); }); diff --git a/cypress/integration/channel/view/search_spec.js b/cypress/integration/channel/view/search_spec.js index 943cf2bdfd..ba3daac0a9 100644 --- a/cypress/integration/channel/view/search_spec.js +++ b/cypress/integration/channel/view/search_spec.js @@ -5,7 +5,7 @@ const community = data.communities.find( ); describe('renders search on channel view', () => { - before(() => { + beforeEach(() => { cy.visit(`/${community.slug}/${channel.slug}`); }); diff --git a/cypress/integration/channel/view/threads_spec.js b/cypress/integration/channel/view/threads_spec.js index a675667751..f87c99a604 100644 --- a/cypress/integration/channel/view/threads_spec.js +++ b/cypress/integration/channel/view/threads_spec.js @@ -12,7 +12,7 @@ const { userId: memberInChannelId } = data.usersChannels.find( ); describe('channel threads logged out', () => { - before(() => { + beforeEach(() => { cy.visit(`/${community.slug}/${channel.slug}`); }); @@ -26,7 +26,7 @@ describe('channel threads logged out', () => { }); describe('channel threads logged in', () => { - before(() => { + beforeEach(() => { cy.auth(memberInChannelId); cy.visit(`/${community.slug}/${channel.slug}`); }); diff --git a/cypress/integration/home_spec.js b/cypress/integration/home_spec.js index df1be67480..07c54f5003 100644 --- a/cypress/integration/home_spec.js +++ b/cypress/integration/home_spec.js @@ -1,5 +1,5 @@ describe('Home View', () => { - before(() => { + beforeEach(() => { cy.visit('/'); }); diff --git a/cypress/integration/inbox_spec.js b/cypress/integration/inbox_spec.js index f5a6fb65e1..80cda69195 100644 --- a/cypress/integration/inbox_spec.js +++ b/cypress/integration/inbox_spec.js @@ -9,7 +9,7 @@ const dashboardThreads = data.threads.filter(({ channelId }) => ); describe('Inbox View', () => { - before(() => { + beforeEach(() => { cy.auth(user.id); cy.visit('/'); }); diff --git a/cypress/integration/pricing_spec.js b/cypress/integration/pricing_spec.js index 31aa073cbf..c7ff41a7e7 100644 --- a/cypress/integration/pricing_spec.js +++ b/cypress/integration/pricing_spec.js @@ -6,7 +6,7 @@ const { userId: ownerId } = data.usersCommunities.find( ); describe('Renders pricing page features lists', () => { - before(() => { + beforeEach(() => { cy.visit(`/pricing`); }); @@ -24,7 +24,7 @@ describe('Renders pricing page features lists', () => { }); describe('Renders pricing page owned communities', () => { - before(() => { + beforeEach(() => { cy.auth(ownerId); cy.visit(`/pricing`); }); diff --git a/cypress/integration/privacy_page_spec.js b/cypress/integration/privacy_page_spec.js index 8f90296829..6e034e2e9b 100644 --- a/cypress/integration/privacy_page_spec.js +++ b/cypress/integration/privacy_page_spec.js @@ -1,6 +1,6 @@ describe('Privacy View', () => { describe('Loads page', () => { - before(() => { + beforeEach(() => { cy.visit('/privacy'); }); @@ -10,7 +10,7 @@ describe('Privacy View', () => { }); describe('Loads page', () => { - before(() => { + beforeEach(() => { cy.visit('/privacy.html'); }); diff --git a/cypress/integration/terms_page_spec.js b/cypress/integration/terms_page_spec.js index 98da750284..c20e032c0d 100644 --- a/cypress/integration/terms_page_spec.js +++ b/cypress/integration/terms_page_spec.js @@ -1,6 +1,6 @@ describe('Terms View', () => { describe('Loads page', () => { - before(() => { + beforeEach(() => { cy.visit('/terms'); }); @@ -10,7 +10,7 @@ describe('Terms View', () => { }); describe('Loads page', () => { - before(() => { + beforeEach(() => { cy.visit('/terms.html'); }); diff --git a/cypress/integration/thread/action_bar_spec.js b/cypress/integration/thread/action_bar_spec.js index 1833f938a1..843d51cfe1 100644 --- a/cypress/integration/thread/action_bar_spec.js +++ b/cypress/integration/thread/action_bar_spec.js @@ -75,7 +75,7 @@ const triggerMovingThread = () => { describe('action bar renders', () => { describe('non authed', () => { - before(() => { + beforeEach(() => { cy.visit(`/thread/${publicThread.id}`); }); @@ -94,7 +94,7 @@ describe('action bar renders', () => { }); describe('authed non member', () => { - before(() => { + beforeEach(() => { cy.auth(nonMemberUser.id); cy.visit(`/thread/${publicThread.id}`); }); @@ -112,7 +112,7 @@ describe('action bar renders', () => { }); describe('authed member', () => { - before(() => { + beforeEach(() => { cy.auth(memberInChannelUser.id); cy.visit(`/thread/${publicThread.id}`); }); @@ -130,7 +130,7 @@ describe('action bar renders', () => { }); describe('authed private channel member', () => { - before(() => { + beforeEach(() => { cy.auth(memberInChannelUser.id); cy.visit(`/thread/${privateThread.id}`); }); @@ -148,7 +148,7 @@ describe('action bar renders', () => { }); describe('thread author', () => { - before(() => { + beforeEach(() => { cy.auth(publicThreadAuthor.id); cy.visit(`/thread/${publicThread.id}`); }); @@ -220,7 +220,7 @@ describe('action bar renders', () => { }); describe('channel moderator', () => { - before(() => { + beforeEach(() => { cy.auth(constants.CHANNEL_MODERATOR_USER_ID); cy.visit(`/thread/${publicThread.id}`); }); @@ -260,7 +260,7 @@ describe('action bar renders', () => { }); describe('channel owner', () => { - before(() => { + beforeEach(() => { cy.auth(constants.CHANNEL_MODERATOR_USER_ID); cy.visit(`/thread/${publicThread.id}`); }); @@ -299,7 +299,7 @@ describe('action bar renders', () => { }); describe('community moderator', () => { - before(() => { + beforeEach(() => { cy.auth(constants.COMMUNITY_MODERATOR_USER_ID); cy.visit(`/thread/${publicThread.id}`); }); @@ -350,7 +350,7 @@ describe('action bar renders', () => { }); describe('community owner', () => { - before(() => { + beforeEach(() => { cy.auth(constants.MAX_ID); cy.visit(`/thread/${publicThread.id}`); }); diff --git a/cypress/integration/thread/chat_input_spec.js b/cypress/integration/thread/chat_input_spec.js index eed59e8f82..2e47bc1fce 100644 --- a/cypress/integration/thread/chat_input_spec.js +++ b/cypress/integration/thread/chat_input_spec.js @@ -26,7 +26,7 @@ const memberInChannelUser = data.users.find(u => u.id === constants.BRIAN_ID); describe('chat input', () => { describe('non authed', () => { - before(() => { + beforeEach(() => { cy.visit(`/thread/${publicThread.id}`); }); @@ -45,7 +45,7 @@ describe('chat input', () => { }); describe('authed non member', () => { - before(() => { + beforeEach(() => { cy.auth(nonMemberUser.id); cy.visit(`/thread/${publicThread.id}`); }); @@ -84,7 +84,7 @@ describe('chat input', () => { }); describe('locked thread', () => { - before(() => { + beforeEach(() => { cy.auth(memberInChannelUser.id); cy.visit(`/thread/${lockedThread.id}`); }); @@ -96,7 +96,7 @@ describe('chat input', () => { }); describe('thread in archived channel', () => { - before(() => { + beforeEach(() => { cy.auth(memberInChannelUser.id); cy.visit(`/thread/${archivedThread.id}`); }); diff --git a/cypress/integration/thread/view_spec.js b/cypress/integration/thread/view_spec.js index 15373872ab..74ecd77767 100644 --- a/cypress/integration/thread/view_spec.js +++ b/cypress/integration/thread/view_spec.js @@ -36,7 +36,7 @@ const blockedCommunityUser = data.usersCommunities.find( describe('sidebar components on thread view', () => { describe('non authed', () => { - before(() => { + beforeEach(() => { cy.visit(`/thread/${publicThread.id}`); }); @@ -58,7 +58,7 @@ describe('sidebar components on thread view', () => { }); describe('authed non member', () => { - before(() => { + beforeEach(() => { cy.auth(nonMemberUser.id); cy.visit(`/thread/${publicThread.id}`); }); @@ -81,7 +81,7 @@ describe('sidebar components on thread view', () => { }); describe('authed member', () => { - before(() => { + beforeEach(() => { cy.auth(memberInChannelUser.id); cy.visit(`/thread/${publicThread.id}`); }); @@ -106,7 +106,7 @@ describe('sidebar components on thread view', () => { describe('public thread', () => { describe('not authed', () => { - before(() => { + beforeEach(() => { cy.visit(`/thread/${publicThread.id}`); }); @@ -132,7 +132,7 @@ describe('public thread', () => { }); describe('authed as non member', () => { - before(() => { + beforeEach(() => { cy.auth(nonMemberUser.id); cy.visit(`/thread/${publicThread.id}`); }); @@ -144,7 +144,7 @@ describe('public thread', () => { }); describe('authed as member', () => { - before(() => { + beforeEach(() => { cy.auth(memberInChannelUser.id); cy.visit(`/thread/${publicThread.id}`); }); @@ -155,7 +155,7 @@ describe('public thread', () => { }); describe('authed as blocked channel user', () => { - before(() => { + beforeEach(() => { cy.auth(blockedChannelUser.id); cy.visit(`/thread/${publicThread.id}`); }); @@ -167,7 +167,7 @@ describe('public thread', () => { }); describe('authed as blocked community user', () => { - before(() => { + beforeEach(() => { cy.auth(blockedCommunityUser.id); cy.visit(`/thread/${publicThread.id}`); }); @@ -181,7 +181,7 @@ describe('public thread', () => { describe('private thread', () => { describe('not authed', () => { - before(() => { + beforeEach(() => { cy.visit(`/thread/${privateThread.id}`); }); @@ -193,7 +193,7 @@ describe('private thread', () => { }); describe('authed as non member', () => { - before(() => { + beforeEach(() => { cy.auth(nonMemberUser.id); cy.visit(`/thread/${privateThread.id}`); }); @@ -205,7 +205,7 @@ describe('private thread', () => { }); describe('authed as member', () => { - before(() => { + beforeEach(() => { cy.auth(memberInChannelUser.id); cy.visit(`/thread/${privateThread.id}`); }); @@ -216,7 +216,7 @@ describe('private thread', () => { }); describe('authed as blocked channel user', () => { - before(() => { + beforeEach(() => { cy.auth(blockedChannelUser.id); cy.visit(`/thread/${privateThread.id}`); }); @@ -228,7 +228,7 @@ describe('private thread', () => { }); describe('authed as blocked community user', () => { - before(() => { + beforeEach(() => { cy.auth(blockedCommunityUser.id); cy.visit(`/thread/${privateThread.id}`); }); @@ -242,7 +242,7 @@ describe('private thread', () => { describe('deleted thread', () => { describe('not authed', () => { - before(() => { + beforeEach(() => { cy.visit(`/thread/${deletedThread.id}`); }); @@ -253,7 +253,7 @@ describe('deleted thread', () => { }); describe('authed', () => { - before(() => { + beforeEach(() => { cy.auth(nonMemberUser.id); cy.visit(`/thread/${deletedThread.id}`); }); diff --git a/cypress/integration/user_spec.js b/cypress/integration/user_spec.js index 0e89f9605d..033657d5d2 100644 --- a/cypress/integration/user_spec.js +++ b/cypress/integration/user_spec.js @@ -3,7 +3,7 @@ import data from '../../shared/testing/data'; const user = data.users[0]; describe('User View', () => { - before(() => { + beforeEach(() => { cy.visit(`/users/${user.username}`); }); From 9c32e42e696167288d037dcbf4ad27916258817f Mon Sep 17 00:00:00 2001 From: Maximilian Stoiber Date: Fri, 30 Mar 2018 12:36:30 +0200 Subject: [PATCH 003/207] Skip private invite link spec --- .../integration/channel/settings/private_invite_link_spec.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cypress/integration/channel/settings/private_invite_link_spec.js b/cypress/integration/channel/settings/private_invite_link_spec.js index 6b5353e3ea..4ec40993f8 100644 --- a/cypress/integration/channel/settings/private_invite_link_spec.js +++ b/cypress/integration/channel/settings/private_invite_link_spec.js @@ -8,7 +8,7 @@ const { userId: ownerInChannelId } = data.usersChannels.find( ({ channelId, isOwner }) => channelId === channel.id && isOwner ); -describe('private channel invite link settings', () => { +describe.skip('private channel invite link settings', () => { beforeEach(() => { cy.auth(ownerInChannelId); cy.visit(`/${community.slug}/${channel.slug}/settings`); From 34a39eddc8e1d29946764af5e821f2582a76a820 Mon Sep 17 00:00:00 2001 From: Maximilian Stoiber Date: Fri, 30 Mar 2018 16:51:55 +0200 Subject: [PATCH 004/207] Disable toobusy handling while testing --- shared/middlewares/toobusy.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/shared/middlewares/toobusy.js b/shared/middlewares/toobusy.js index d0e93d177a..1e28ecb201 100644 --- a/shared/middlewares/toobusy.js +++ b/shared/middlewares/toobusy.js @@ -8,7 +8,8 @@ export default ( res: express$Response, next: express$NextFunction ) => { - if (toobusy()) { + // Don't send 503s in testing, that's dumb, just wait it out + if (process.env.NODE_ENV !== 'testing' && toobusy()) { res.status(503); res.send( 'It looks like Spectrum is very busy right now, please try again in a minute.' From e4209dc2ef5f0cdc01c1c3eba9ff7ab2ef3259dd Mon Sep 17 00:00:00 2001 From: Maximilian Stoiber Date: Fri, 30 Mar 2018 16:59:38 +0200 Subject: [PATCH 005/207] Actually dont run toobusy in tests --- shared/middlewares/toobusy.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/shared/middlewares/toobusy.js b/shared/middlewares/toobusy.js index 1e28ecb201..c116b9cd51 100644 --- a/shared/middlewares/toobusy.js +++ b/shared/middlewares/toobusy.js @@ -9,7 +9,7 @@ export default ( next: express$NextFunction ) => { // Don't send 503s in testing, that's dumb, just wait it out - if (process.env.NODE_ENV !== 'testing' && toobusy()) { + if (process.env.NODE_ENV !== 'testing' && !process.env.TEST_DB && toobusy()) { res.status(503); res.send( 'It looks like Spectrum is very busy right now, please try again in a minute.' From 9ad201a6e75539b604ece3d8f7011ad924c348ec Mon Sep 17 00:00:00 2001 From: Maximilian Stoiber Date: Fri, 30 Mar 2018 17:06:44 +0200 Subject: [PATCH 006/207] Dont record video from cypress --- cypress.json | 1 + 1 file changed, 1 insertion(+) diff --git a/cypress.json b/cypress.json index 376bda3540..6a91b61798 100644 --- a/cypress.json +++ b/cypress.json @@ -3,6 +3,7 @@ "viewportWidth": 1300, "defaultCommandTimeout": 10000, "blacklistHosts": ["*.google-analytics.com"], + "videoRecording": false, "env": { "DEBUG": "src*,testing*,build*" } From 639e5fe857c7be65fa86839cacaed16516d64a93 Mon Sep 17 00:00:00 2001 From: Brian Lovin Date: Fri, 30 Mar 2018 10:18:15 -0700 Subject: [PATCH 007/207] Attempt to fix a few abstractions --- .../settings/private_invite_link_spec.js | 30 +++++--- .../community_settings_billing_spec.js | 8 ++- cypress/integration/thread/action_bar_spec.js | 69 ++++++++++--------- cypress/support/index.js | 2 + 4 files changed, 66 insertions(+), 43 deletions(-) diff --git a/cypress/integration/channel/settings/private_invite_link_spec.js b/cypress/integration/channel/settings/private_invite_link_spec.js index 4ec40993f8..b7232db9a8 100644 --- a/cypress/integration/channel/settings/private_invite_link_spec.js +++ b/cypress/integration/channel/settings/private_invite_link_spec.js @@ -8,26 +8,32 @@ const { userId: ownerInChannelId } = data.usersChannels.find( ({ channelId, isOwner }) => channelId === channel.id && isOwner ); -describe.skip('private channel invite link settings', () => { +const enable = () => { + cy.get('[data-cy="channel-overview"]').should('be.visible'); + + cy.get('[data-cy="login-with-token-settings"]').scrollIntoView(); + + cy + .get('[data-cy="toggle-token-link-invites-unchecked"]') + .should('be.visible') + .click(); + + cy.get('[data-cy="join-link-input"]').should('be.visible'); +}; + +describe('private channel invite link settings', () => { beforeEach(() => { cy.auth(ownerInChannelId); cy.visit(`/${community.slug}/${channel.slug}/settings`); }); it('should enable private invite link', () => { - cy.get('[data-cy="channel-overview"]').should('be.visible'); - - cy.get('[data-cy="login-with-token-settings"]').scrollIntoView(); - - cy - .get('[data-cy="toggle-token-link-invites-unchecked"]') - .should('be.visible') - .click(); - - cy.get('[data-cy="join-link-input"]').should('be.visible'); + enable(); }); it('should refresh invite link token', () => { + enable(); + cy.get('[data-cy="channel-overview"]').should('be.visible'); cy.get('[data-cy="login-with-token-settings"]').scrollIntoView(); @@ -58,6 +64,8 @@ describe.skip('private channel invite link settings', () => { }); it('should disable private invite link', () => { + enable(); + cy.get('[data-cy="channel-overview"]').should('be.visible'); cy.get('[data-cy="login-with-token-settings"]').scrollIntoView(); diff --git a/cypress/integration/community_settings_billing_spec.js b/cypress/integration/community_settings_billing_spec.js index 11d92999e8..3215b54e30 100644 --- a/cypress/integration/community_settings_billing_spec.js +++ b/cypress/integration/community_settings_billing_spec.js @@ -13,6 +13,10 @@ const channels = data.channels.filter( ({ communityId }) => community.id === communityId ); +const verify = () => { + cy.visit(`http://localhost:3001/api/email/validate/test-payments/verify`); +}; + describe('Community settings billing tab', () => { beforeEach(() => { cy.auth(ownerId); @@ -153,12 +157,14 @@ describe('Community settings billing tab', () => { describe('should force verification of administration email', () => { it('should verify email address', () => { - cy.visit(`http://localhost:3001/api/email/validate/test-payments/verify`); + verify(); }); }); describe('should be able to view billing settings with save administrator email', () => { it('should load community billing settings', () => { + verify(); + cy.visit(`/${community.slug}/settings`); cy .get(`[href="/${community.slug}/settings/billing"]`) diff --git a/cypress/integration/thread/action_bar_spec.js b/cypress/integration/thread/action_bar_spec.js index 843d51cfe1..d4e3c8e6d6 100644 --- a/cypress/integration/thread/action_bar_spec.js +++ b/cypress/integration/thread/action_bar_spec.js @@ -30,28 +30,20 @@ const lockThread = () => { // lock the thread cy.get('[data-cy="thread-dropdown-lock"]').contains('Lock chat'); cy.get('[data-cy="thread-dropdown-lock"]').click(); - cy.get('[data-cy="thread-dropdown-lock"]').should('be.disabled'); - cy.get('[data-cy="thread-dropdown-lock"]').should('not.be.disabled'); cy.get('[data-cy="thread-dropdown-lock"]').contains('Unlock chat'); // unlock the thread cy.get('[data-cy="thread-dropdown-lock"]').click(); - cy.get('[data-cy="thread-dropdown-lock"]').should('be.disabled'); - cy.get('[data-cy="thread-dropdown-lock"]').should('not.be.disabled'); cy.get('[data-cy="thread-dropdown-lock"]').contains('Lock chat'); }; const pinThread = () => { // pin the thread cy.get('[data-cy="thread-dropdown-pin"]').click(); - cy.get('[data-cy="thread-dropdown-pin"]').should('be.disabled'); - cy.get('[data-cy="thread-dropdown-pin"]').should('not.be.disabled'); cy.get('[data-cy="thread-dropdown-pin"]').contains('Unpin'); // unpin the thread cy.get('[data-cy="thread-dropdown-pin"]').click(); - cy.get('[data-cy="thread-dropdown-pin"]').should('be.disabled'); - cy.get('[data-cy="thread-dropdown-pin"]').should('not.be.disabled'); cy.get('[data-cy="thread-dropdown-pin"]').contains('Pin'); }; @@ -73,6 +65,13 @@ const triggerMovingThread = () => { .click('topLeft'); }; +const openSettingsDropdown = () => { + cy + .get('[data-cy="thread-actions-dropdown-trigger"]') + .should('be.visible') + .click(); +}; + describe('action bar renders', () => { describe('non authed', () => { beforeEach(() => { @@ -159,10 +158,9 @@ describe('action bar renders', () => { cy.get('[data-cy="thread-facebook-button"]').should('be.visible'); cy.get('[data-cy="thread-tweet-button"]').should('be.visible'); cy.get('[data-cy="thread-copy-link-button"]').should('be.visible'); - cy - .get('[data-cy="thread-actions-dropdown-trigger"]') - .should('be.visible') - .click(); + + openSettingsDropdown(); + cy.get('[data-cy="thread-actions-dropdown"]').should('be.visible'); // dropdown controls @@ -175,19 +173,21 @@ describe('action bar renders', () => { it('should lock the thread', () => { cy.auth(publicThreadAuthor.id); - + openSettingsDropdown(); lockThread(); }); it('should trigger delete thread', () => { cy.auth(publicThreadAuthor.id); - + openSettingsDropdown(); triggerThreadDelete(); }); it('should edit the thread', () => { cy.auth(publicThreadAuthor.id); + openSettingsDropdown(); + cy.get('[data-cy="thread-dropdown-edit"]').click(); cy.get('[data-cy="save-thread-edit-button"]').should('be.visible'); const title = 'Some new thread'; @@ -231,10 +231,9 @@ describe('action bar renders', () => { cy.get('[data-cy="thread-facebook-button"]').should('be.visible'); cy.get('[data-cy="thread-tweet-button"]').should('be.visible'); cy.get('[data-cy="thread-copy-link-button"]').should('be.visible'); - cy - .get('[data-cy="thread-actions-dropdown-trigger"]') - .should('be.visible') - .click(); + + openSettingsDropdown(); + cy.get('[data-cy="thread-actions-dropdown"]').should('be.visible'); // dropdown controls @@ -248,13 +247,14 @@ describe('action bar renders', () => { it('should lock the thread', () => { cy.auth(constants.CHANNEL_MODERATOR_USER_ID); - // lock the thread + openSettingsDropdown(); lockThread(); }); it('should trigger delete thread', () => { cy.auth(constants.CHANNEL_MODERATOR_USER_ID); + openSettingsDropdown(); triggerThreadDelete(); }); }); @@ -271,10 +271,9 @@ describe('action bar renders', () => { cy.get('[data-cy="thread-facebook-button"]').should('be.visible'); cy.get('[data-cy="thread-tweet-button"]').should('be.visible'); cy.get('[data-cy="thread-copy-link-button"]').should('be.visible'); - cy - .get('[data-cy="thread-actions-dropdown-trigger"]') - .should('be.visible') - .click(); + + openSettingsDropdown(); + cy.get('[data-cy="thread-actions-dropdown"]').should('be.visible'); // dropdown controls @@ -288,12 +287,14 @@ describe('action bar renders', () => { it('should lock the thread', () => { cy.auth(constants.CHANNEL_MODERATOR_USER_ID); + openSettingsDropdown(); lockThread(); }); it('should trigger delete thread', () => { cy.auth(constants.CHANNEL_MODERATOR_USER_ID); + openSettingsDropdown(); triggerThreadDelete(); }); }); @@ -310,10 +311,9 @@ describe('action bar renders', () => { cy.get('[data-cy="thread-facebook-button"]').should('be.visible'); cy.get('[data-cy="thread-tweet-button"]').should('be.visible'); cy.get('[data-cy="thread-copy-link-button"]').should('be.visible'); - cy - .get('[data-cy="thread-actions-dropdown-trigger"]') - .should('be.visible') - .click(); + + openSettingsDropdown(); + cy.get('[data-cy="thread-actions-dropdown"]').should('be.visible'); // dropdown controls @@ -327,24 +327,28 @@ describe('action bar renders', () => { it('should lock the thread', () => { cy.auth(constants.COMMUNITY_MODERATOR_USER_ID); + openSettingsDropdown(); lockThread(); }); it('should pin the thread', () => { cy.auth(constants.COMMUNITY_MODERATOR_USER_ID); + openSettingsDropdown(); pinThread(); }); it('should trigger moving the thread', () => { cy.auth(constants.COMMUNITY_MODERATOR_USER_ID); + openSettingsDropdown(); triggerMovingThread(); }); it('should trigger delete thread', () => { cy.auth(constants.COMMUNITY_MODERATOR_USER_ID); + openSettingsDropdown(); triggerThreadDelete(); }); }); @@ -361,10 +365,9 @@ describe('action bar renders', () => { cy.get('[data-cy="thread-facebook-button"]').should('be.visible'); cy.get('[data-cy="thread-tweet-button"]').should('be.visible'); cy.get('[data-cy="thread-copy-link-button"]').should('be.visible'); - cy - .get('[data-cy="thread-actions-dropdown-trigger"]') - .should('be.visible') - .click(); + + openSettingsDropdown(); + cy.get('[data-cy="thread-actions-dropdown"]').should('be.visible'); // dropdown controls @@ -378,24 +381,28 @@ describe('action bar renders', () => { it('should lock the thread', () => { cy.auth(constants.MAX_ID); + openSettingsDropdown(); lockThread(); }); it('should pin the thread', () => { cy.auth(constants.MAX_ID); + openSettingsDropdown(); pinThread(); }); it('should trigger moving the thread', () => { cy.auth(constants.MAX_ID); + openSettingsDropdown(); triggerMovingThread(); }); it('should trigger delete thread', () => { cy.auth(constants.MAX_ID); + openSettingsDropdown(); triggerThreadDelete(); }); }); diff --git a/cypress/support/index.js b/cypress/support/index.js index 90186bfe4a..f90f1de641 100644 --- a/cypress/support/index.js +++ b/cypress/support/index.js @@ -18,8 +18,10 @@ import './commands'; before(() => { cy.resetdb(); + cy.clearLocalStorage(); }); beforeEach(() => { cy.resetdb(); + cy.clearLocalStorage(); }); From f97c40765c07a947c446e87ab1be1d50d9a4683f Mon Sep 17 00:00:00 2001 From: Maximilian Stoiber Date: Tue, 3 Apr 2018 12:13:58 +0200 Subject: [PATCH 008/207] Use nodemon to restart the API if it crashes --- .circleci/config.yml | 2 +- package.json | 1 + yarn.lock | 15 +++++++++++++++ 3 files changed, 17 insertions(+), 1 deletion(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index 6a65eef7ea..35f29480ed 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -45,7 +45,7 @@ aliases: - &start-api name: Start the API in the background - command: TEST_DB=true yarn run dev:api + command: nodemon -x "TEST_DB=true yarn run dev:api" background: true - &start-web diff --git a/package.json b/package.json index 4ccd913af9..2bc4c57658 100644 --- a/package.json +++ b/package.json @@ -36,6 +36,7 @@ "is-html": "^1.1.0", "lint-staged": "^3.3.0", "micromatch": "^3.0.4", + "nodemon": "^1.17.3", "prettier": "^1.0.0", "puppeteer": "^0.12.0", "raw-loader": "^0.5.1", diff --git a/yarn.lock b/yarn.lock index 0c7d839681..410482fe16 100644 --- a/yarn.lock +++ b/yarn.lock @@ -7492,6 +7492,21 @@ nodemon@^1.11.0: undefsafe "^2.0.2" update-notifier "^2.3.0" +nodemon@^1.17.3: + version "1.17.3" + resolved "https://registry.yarnpkg.com/nodemon/-/nodemon-1.17.3.tgz#3b0bbc2ee05ccb43b1aef15ba05c63c7bc9b8530" + dependencies: + chokidar "^2.0.2" + debug "^3.1.0" + ignore-by-default "^1.0.1" + minimatch "^3.0.4" + pstree.remy "^1.1.0" + semver "^5.5.0" + supports-color "^5.2.0" + touch "^3.1.0" + undefsafe "^2.0.2" + update-notifier "^2.3.0" + nopt@^4.0.1: version "4.0.1" resolved "https://registry.yarnpkg.com/nopt/-/nopt-4.0.1.tgz#d0d4685afd5415193c8c7505602d0d17cd64474d" From c117f426f6cf3a3143b5f96cff165da2a8853afc Mon Sep 17 00:00:00 2001 From: Maximilian Stoiber Date: Tue, 3 Apr 2018 12:25:20 +0200 Subject: [PATCH 009/207] nodemon: command not found fixes --- .circleci/config.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.circleci/config.yml b/.circleci/config.yml index 35f29480ed..3bba099143 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -99,6 +99,7 @@ jobs: - run: *start-rethinkdb - run: sleep 10 - run: *setup-and-build-web + - run: yarn add --dev nodemon - run: *start-api - run: *start-web - run: sleep 60 From 891241c59a74648e83d3589e6f77deb50cbea8df Mon Sep 17 00:00:00 2001 From: Maximilian Stoiber Date: Tue, 3 Apr 2018 12:34:01 +0200 Subject: [PATCH 010/207] Start nodemon from package.json instead --- .circleci/config.yml | 3 +-- package.json | 1 + 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index 3bba099143..11e2be4aa8 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -45,7 +45,7 @@ aliases: - &start-api name: Start the API in the background - command: nodemon -x "TEST_DB=true yarn run dev:api" + command: yarn run dev:api:test background: true - &start-web @@ -99,7 +99,6 @@ jobs: - run: *start-rethinkdb - run: sleep 10 - run: *setup-and-build-web - - run: yarn add --dev nodemon - run: *start-api - run: *start-web - run: sleep 60 diff --git a/package.json b/package.json index 2bc4c57658..69deebffe0 100644 --- a/package.json +++ b/package.json @@ -238,6 +238,7 @@ "test": "npm run jest -- --runInBand --watch", "test:ci": "npm run jest -- --forceExit --outputFile test-results.json --json", "test:e2e": "cypress run", + "dev:api:test": "nodemon -x \"TEST_DB=true yarn run dev:api\"", "cypress:open": "cypress open", "lint": "eslint .", "flow": "flow", From 296126ee2140cce5abce8f2fad2f16845234b54a Mon Sep 17 00:00:00 2001 From: Maximilian Stoiber Date: Tue, 3 Apr 2018 13:10:04 +0200 Subject: [PATCH 011/207] Keep nodemon from restarting the API endlessly --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index 69deebffe0..42806d6a84 100644 --- a/package.json +++ b/package.json @@ -238,7 +238,7 @@ "test": "npm run jest -- --runInBand --watch", "test:ci": "npm run jest -- --forceExit --outputFile test-results.json --json", "test:e2e": "cypress run", - "dev:api:test": "nodemon -x \"TEST_DB=true yarn run dev:api\"", + "dev:api:test": "nodemon -x \"TEST_DB=true yarn run dev:api\" -w ./api", "cypress:open": "cypress open", "lint": "eslint .", "flow": "flow", From 2c740cfcb188fdb9dee4e3c621576d6e3714947d Mon Sep 17 00:00:00 2001 From: Brian Lovin Date: Tue, 3 Apr 2018 11:42:41 -0700 Subject: [PATCH 012/207] Attempt to simplify a few tests --- api/queries/channel/rootChannel.js | 16 +++++-- .../channel/settings/create_spec.js | 8 +--- .../channel/settings/delete_spec.js | 18 ++----- .../integration/channel/settings/edit_spec.js | 48 +------------------ .../settings/private_invite_link_spec.js | 20 ++------ 5 files changed, 21 insertions(+), 89 deletions(-) diff --git a/api/queries/channel/rootChannel.js b/api/queries/channel/rootChannel.js index a3cf5db4a4..0974400220 100644 --- a/api/queries/channel/rootChannel.js +++ b/api/queries/channel/rootChannel.js @@ -1,11 +1,17 @@ // @flow import type { GraphQLContext } from '../../'; import type { GetChannelArgs } from '../../models/channel'; +import UserError from '../../utils/UserError'; import { getChannelBySlug } from '../../models/channel'; -export default (_: any, args: GetChannelArgs, { loaders }: GraphQLContext) => { - if (args.id) return loaders.channel.load(args.id); - if (args.channelSlug && args.communitySlug) - return getChannelBySlug(args.channelSlug, args.communitySlug); - return null; +export default async ( + _: any, + args: GetChannelArgs, + { loaders }: GraphQLContext +) => { + if (args.id) return await loaders.channel.load(args.id); + if (args.channelSlug && args.communitySlug) { + return await getChannelBySlug(args.channelSlug, args.communitySlug); + } + return new UserError('We couldn’t find this channel'); }; diff --git a/cypress/integration/channel/settings/create_spec.js b/cypress/integration/channel/settings/create_spec.js index 814925c655..f73285122c 100644 --- a/cypress/integration/channel/settings/create_spec.js +++ b/cypress/integration/channel/settings/create_spec.js @@ -16,16 +16,10 @@ describe('create a channel', () => { beforeEach(() => { cy.auth(ownerInChannelId); // NOTE @brian: I can not get this to auth directly into /settings, having to work around for now - cy.visit(`/${community.slug}`); + cy.visit(`/${community.slug}/settings`); }); it('should go through create a channel flow', () => { - cy - .get('[data-cy="community-settings-button"]') - .scrollIntoView() - .should('be.visible') - .click(); - cy .get('[data-cy="create-channel-button"]') .scrollIntoView() diff --git a/cypress/integration/channel/settings/delete_spec.js b/cypress/integration/channel/settings/delete_spec.js index af28fadb76..76223b6851 100644 --- a/cypress/integration/channel/settings/delete_spec.js +++ b/cypress/integration/channel/settings/delete_spec.js @@ -20,17 +20,12 @@ const { userId: ownerInPrivateChannelId } = data.usersChannels.find( ); describe('deleting general channel', () => { - beforeEach(() => { + before(() => { cy.auth(ownerInChannelId); - cy.visit(`/${community.slug}/${channel.slug}`); + cy.visit(`/${community.slug}/${channel.slug}/settings`); }); it('should not allow general channel to be deleted', () => { - cy - .get('[data-cy="channel-settings-button"]') - .should('be.visible') - .click(); - cy.get('[data-cy="channel-overview"]').should('be.visible'); cy.get('[data-cy="delete-channel-button"]').should('not.be.visible'); @@ -38,17 +33,12 @@ describe('deleting general channel', () => { }); describe('deleting a channel', () => { - beforeEach(() => { + before(() => { cy.auth(ownerInPrivateChannelId); - cy.visit(`/${privateCommunity.slug}/${privateChannel.slug}`); + cy.visit(`/${privateCommunity.slug}/${privateChannel.slug}/settings`); }); it('should delete a channel', () => { - cy - .get('[data-cy="channel-settings-button"]') - .should('be.visible') - .click(); - cy.get('[data-cy="channel-overview"]').should('be.visible'); cy diff --git a/cypress/integration/channel/settings/edit_spec.js b/cypress/integration/channel/settings/edit_spec.js index 92d43f3829..10f145e317 100644 --- a/cypress/integration/channel/settings/edit_spec.js +++ b/cypress/integration/channel/settings/edit_spec.js @@ -12,21 +12,14 @@ const { userId: ownerInChannelId } = data.usersChannels.find( const NEW_NAME = 'General Update'; const NEW_DESCRIPTION = 'New description'; -const ORIGINAL_NAME = ' General'; -const ORIGINAL_DESCRIPTION = 'General chatter'; describe('edit a channel', () => { beforeEach(() => { cy.auth(ownerInChannelId); - cy.visit(`/${community.slug}/${channel.slug}`); + cy.visit(`/${community.slug}/${channel.slug}/settings`); }); it('should edit a channel', () => { - cy - .get('[data-cy="channel-settings-button"]') - .should('be.visible') - .click(); - cy.get('[data-cy="channel-overview"]').should('be.visible'); cy @@ -58,42 +51,3 @@ describe('edit a channel', () => { cy.get('[data-cy="channel-profile-full"]').contains(NEW_DESCRIPTION); }); }); - -describe('undo editing a channel', () => { - beforeEach(() => { - cy.auth(ownerInChannelId); - cy.visit(`/${community.slug}/${channel.slug}`); - }); - - it('should revert the edit', () => { - cy - .get('[data-cy="channel-settings-button"]') - .should('be.visible') - .click(); - - cy.get('[data-cy="channel-overview"]').should('be.visible'); - - cy - .get('[data-cy="channel-name-input"]') - .should('be.visible') - .click() - .clear() - .type(ORIGINAL_NAME); - - cy - .get('[data-cy="channel-description-input"]') - .should('be.visible') - .click() - .clear() - .type(ORIGINAL_DESCRIPTION); - - cy - .get('[data-cy="save-button"]') - .should('be.visible') - .click(); - - cy.get('[data-cy="save-button"]').should('be.disabled'); - - cy.get('[data-cy="save-button"]').should('not.be.disabled'); - }); -}); diff --git a/cypress/integration/channel/settings/private_invite_link_spec.js b/cypress/integration/channel/settings/private_invite_link_spec.js index b7232db9a8..aa4088ae1e 100644 --- a/cypress/integration/channel/settings/private_invite_link_spec.js +++ b/cypress/integration/channel/settings/private_invite_link_spec.js @@ -27,17 +27,12 @@ describe('private channel invite link settings', () => { cy.visit(`/${community.slug}/${channel.slug}/settings`); }); - it('should enable private invite link', () => { - enable(); - }); - - it('should refresh invite link token', () => { + it('should handle enable, reset, and disable', () => { + // enable enable(); - cy.get('[data-cy="channel-overview"]').should('be.visible'); - + // reset token cy.get('[data-cy="login-with-token-settings"]').scrollIntoView(); - cy .get('[data-cy="join-link-input"]') .invoke('val') @@ -61,15 +56,8 @@ describe('private channel invite link settings', () => { expect(val1).not.to.eq(val2); }); }); - }); - - it('should disable private invite link', () => { - enable(); - - cy.get('[data-cy="channel-overview"]').should('be.visible'); - - cy.get('[data-cy="login-with-token-settings"]').scrollIntoView(); + // disable cy .get('[data-cy="toggle-token-link-invites-checked"]') .should('be.visible') From 195f281169cc990e0e6a1f843f511999d4d8230e Mon Sep 17 00:00:00 2001 From: Maximilian Stoiber Date: Wed, 4 Apr 2018 12:49:45 +0200 Subject: [PATCH 013/207] Restrict deployments to SFO This should ensure none of our deployments go to BRU (or any other future region), which we don't want given our database is only hosted in SFO. /cc @javivelasco is this correct? I couldn't find any docs for the `regions` option but it's mentioned in the release blog post and it seems to work? --- now.json | 1 + 1 file changed, 1 insertion(+) diff --git a/now.json b/now.json index c955f21e45..e55be5e043 100644 --- a/now.json +++ b/now.json @@ -1,4 +1,5 @@ { + "regions": ["sfo1"], "env": { "S3_TOKEN": "@s3-token", "S3_SECRET": "@s3-secret", From c81c76248d7e0cca651a6f932e71de815c3b2e24 Mon Sep 17 00:00:00 2001 From: Maximilian Stoiber Date: Thu, 5 Apr 2018 18:30:53 +0200 Subject: [PATCH 014/207] Split e2e tests from unit tests on CircleCI Since e2e tests are very flakey right now, this should make it more obvious if CI has actually passed. --- .circleci/config.yml | 38 ++++++++++++++++++++++++++++---------- 1 file changed, 28 insertions(+), 10 deletions(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index 6a65eef7ea..b09489638a 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -83,8 +83,26 @@ jobs: root: . paths: . + build_web: + <<: *js_defaults + steps: + - run: *setup-and-build-web + + test_web_unit: + <<: *js_defaults + steps: + - attach_workspace: + at: ~/spectrum + - run: + name: Run Unit Tests + command: yarn run test:ci + - run: + name: Danger + when: always + command: yarn run danger ci + # Start db and servers, then run e2e and unit tests - test_web: + test_web_e2e: <<: *defaults docker: - image: circleci/node:8-browsers @@ -98,20 +116,12 @@ jobs: - run: *install-rethinkdb - run: *start-rethinkdb - run: sleep 10 - - run: *setup-and-build-web - run: *start-api - run: *start-web - run: sleep 60 - - run: - name: Run Unit Tests - command: yarn run test:ci - run: name: Run E2E Tests command: yarn run test:e2e - - run: - name: Danger - when: always - command: yarn run danger ci # Run eslint, flow etc. test_static_js: @@ -167,16 +177,24 @@ workflows: test: jobs: - checkout_environment + - build_web: + requires: + - checkout_environment - test_mobile_js: requires: - checkout_environment + - test_web_unit: + requires: + - checkout_environment + # Disabled as Expo is fixing their critical issue with Detox # - test_mobile_native: # requires: # - checkout_environment - - test_web: + - test_web_e2e: requires: - checkout_environment + - build_web - test_static_js: requires: - checkout_environment From 540e21cf6c4fae359feab5a76b79498e1fdafcd7 Mon Sep 17 00:00:00 2001 From: Maximilian Stoiber Date: Thu, 5 Apr 2018 18:38:02 +0200 Subject: [PATCH 015/207] Fix indentation --- .circleci/config.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index b09489638a..65f603eb4a 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -92,7 +92,7 @@ jobs: <<: *js_defaults steps: - attach_workspace: - at: ~/spectrum + at: ~/spectrum - run: name: Run Unit Tests command: yarn run test:ci From 67893282ccc97649af41bf287f4152f5ad1addf7 Mon Sep 17 00:00:00 2001 From: Maximilian Stoiber Date: Thu, 5 Apr 2018 18:51:20 +0200 Subject: [PATCH 016/207] Also run RDB for unit tests --- .circleci/config.yml | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/.circleci/config.yml b/.circleci/config.yml index 65f603eb4a..f67563f49f 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -86,6 +86,8 @@ jobs: build_web: <<: *js_defaults steps: + - attach_workspace: + at: ~/spectrum - run: *setup-and-build-web test_web_unit: @@ -93,6 +95,9 @@ jobs: steps: - attach_workspace: at: ~/spectrum + - run: *install-rethinkdb + - run: *start-rethinkdb + - run: sleep 10 - run: name: Run Unit Tests command: yarn run test:ci From 4edab0d71803cd6ca98e2ca7db9cce0190b52862 Mon Sep 17 00:00:00 2001 From: Tom Bonnike Date: Thu, 5 Apr 2018 20:41:00 +0200 Subject: [PATCH 017/207] Add focus styles to NavBar links --- src/views/navbar/style.js | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/views/navbar/style.js b/src/views/navbar/style.js index 8b10760758..84df487a47 100644 --- a/src/views/navbar/style.js +++ b/src/views/navbar/style.js @@ -100,13 +100,15 @@ export const Tab = styled(Link)` color: ${props => props.theme.text.reverse}; transition: ${Transition.hover.on}; - &:hover { + &:hover, + &:focus { box-shadow: inset 0 -6px 0 ${({ theme }) => theme.text.reverse}; transition: ${Transition.hover.on}; } } - &:hover { + &:hover, + &:focus { box-shadow: inset 0 -4px 0 ${({ theme }) => (process.env.NODE_ENV === 'production' ? theme.text.placeholder : theme.warn.border)}; color: ${props => props.theme.text.reverse}; transition: ${Transition.hover.on}; From edae63007b0c6af31fe95bba301dc31a87543e94 Mon Sep 17 00:00:00 2001 From: Tom Bonnike Date: Thu, 5 Apr 2018 20:44:44 +0200 Subject: [PATCH 018/207] Remove ability to focus the logo link in the NavBar --- src/views/navbar/index.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/views/navbar/index.js b/src/views/navbar/index.js index 1996f4d12f..66422483af 100644 --- a/src/views/navbar/index.js +++ b/src/views/navbar/index.js @@ -135,7 +135,7 @@ class Navbar extends React.Component { )} - + @@ -198,7 +198,7 @@ class Navbar extends React.Component { if (!loggedInUser) { return (