Commit 6f761edc authored by Illya Klymov's avatar Illya Klymov Committed by Martin Wortschack

Add sync: false to entire codebase

This commit adds sync: false to our tests, preparing
for VTU upgrade
parent 62052283
...@@ -70,10 +70,11 @@ describe('Design management router', () => { ...@@ -70,10 +70,11 @@ describe('Design management router', () => {
it('pushes designs detail component', () => { it('pushes designs detail component', () => {
router.push('/designs/1'); router.push('/designs/1');
return vm.vm.$nextTick().then(() => {
const detail = vm.find(DesignDetail); const detail = vm.find(DesignDetail);
expect(detail.exists()).toBe(true); expect(detail.exists()).toBe(true);
expect(detail.props('id')).toEqual('1'); expect(detail.props('id')).toEqual('1');
}); });
}); });
});
}); });
...@@ -144,8 +144,11 @@ describe('dashboard', () => { ...@@ -144,8 +144,11 @@ describe('dashboard', () => {
it('should get the page info from the state', () => { it('should get the page info from the state', () => {
store.state.pageInfo = { totalResults: 100 }; store.state.pageInfo = { totalResults: 100 };
return wrapper.vm.$nextTick().then(() => {
expect(wrapper.find(ProjectSelector).props('totalResults')).toBe(100); expect(wrapper.find(ProjectSelector).props('totalResults')).toBe(100);
}); });
}); });
}); });
});
}); });
...@@ -95,10 +95,12 @@ describe('MavenInstallation', () => { ...@@ -95,10 +95,12 @@ describe('MavenInstallation', () => {
it('should track when the setup tab is clicked', () => { it('should track when the setup tab is clicked', () => {
setupTab().trigger('click'); setupTab().trigger('click');
return wrapper.vm.$nextTick(() => {
expect(eventSpy).toHaveBeenCalledWith(undefined, TrackingActions.REGISTRY_SETUP, { expect(eventSpy).toHaveBeenCalledWith(undefined, TrackingActions.REGISTRY_SETUP, {
label, label,
}); });
}); });
});
it('should track when the installation tab is clicked', () => { it('should track when the installation tab is clicked', () => {
setupTab().trigger('click'); setupTab().trigger('click');
......
...@@ -90,10 +90,12 @@ describe('NpmInstallation', () => { ...@@ -90,10 +90,12 @@ describe('NpmInstallation', () => {
it('should track when the setup tab is clicked', () => { it('should track when the setup tab is clicked', () => {
setupTab().trigger('click'); setupTab().trigger('click');
return wrapper.vm.$nextTick().then(() => {
expect(eventSpy).toHaveBeenCalledWith(undefined, TrackingActions.REGISTRY_SETUP, { expect(eventSpy).toHaveBeenCalledWith(undefined, TrackingActions.REGISTRY_SETUP, {
label, label,
}); });
}); });
});
it('should track when the installation tab is clicked', () => { it('should track when the installation tab is clicked', () => {
setupTab().trigger('click'); setupTab().trigger('click');
......
...@@ -90,16 +90,20 @@ describe('blocking mr input root', () => { ...@@ -90,16 +90,20 @@ describe('blocking mr input root', () => {
createComponent({ existingRefs: ['!1'] }); createComponent({ existingRefs: ['!1'] });
removeRef(0); removeRef(0);
return wrapper.vm.$nextTick().then(() => {
expectShouldUpdateRefsToBe(true); expectShouldUpdateRefsToBe(true);
}); });
});
it('is true after a ref is added', () => { it('is true after a ref is added', () => {
createComponent(); createComponent();
addTokenizedInput('foo'); addTokenizedInput('foo');
return wrapper.vm.$nextTick(() => {
expectShouldUpdateRefsToBe(true); expectShouldUpdateRefsToBe(true);
}); });
}); });
});
describe('remove_hidden_blocking_merge_requests', () => { describe('remove_hidden_blocking_merge_requests', () => {
const expectRemoveHiddenBlockingMergeRequestsToBe = createHiddenInputExpectation( const expectRemoveHiddenBlockingMergeRequestsToBe = createHiddenInputExpectation(
...@@ -129,8 +133,10 @@ describe('blocking mr input root', () => { ...@@ -129,8 +133,10 @@ describe('blocking mr input root', () => {
makeComponentWithHiddenMrs(); makeComponentWithHiddenMrs();
removeRef(2); removeRef(2);
return wrapper.vm.$nextTick().then(() => {
expectRemoveHiddenBlockingMergeRequestsToBe(true); expectRemoveHiddenBlockingMergeRequestsToBe(true);
}); });
}); });
}); });
});
}); });
...@@ -56,9 +56,11 @@ describe('EpicsSelect', () => { ...@@ -56,9 +56,11 @@ describe('EpicsSelect', () => {
issueId: 123, issueId: 123,
}); });
return wrapper.vm.$nextTick().then(() => {
expect(wrapper.vm.$store.state.issueId).toBe(123); expect(wrapper.vm.$store.state.issueId).toBe(123);
}); });
}); });
});
describe('initialEpic', () => { describe('initialEpic', () => {
it('should update `selectedEpic` within state when prop is updated', () => { it('should update `selectedEpic` within state when prop is updated', () => {
...@@ -66,9 +68,11 @@ describe('EpicsSelect', () => { ...@@ -66,9 +68,11 @@ describe('EpicsSelect', () => {
initialEpic: mockEpic2, initialEpic: mockEpic2,
}); });
return wrapper.vm.$nextTick().then(() => {
expect(wrapper.vm.$store.state.selectedEpic).toBe(mockEpic2); expect(wrapper.vm.$store.state.selectedEpic).toBe(mockEpic2);
}); });
}); });
});
describe('initialEpicLoading', () => { describe('initialEpicLoading', () => {
it('should update `selectedEpic` within state when prop is updated', () => { it('should update `selectedEpic` within state when prop is updated', () => {
......
...@@ -216,6 +216,8 @@ describe('ClusterFormDropdown', () => { ...@@ -216,6 +216,8 @@ describe('ClusterFormDropdown', () => {
$(dropdownEl).trigger('shown.bs.dropdown'); $(dropdownEl).trigger('shown.bs.dropdown');
return vm.vm.$nextTick(() => {
expect(vm.find(DropdownSearchInput).props('focused')).toBe(true); expect(vm.find(DropdownSearchInput).props('focused')).toBe(true);
}); });
});
}); });
...@@ -197,8 +197,10 @@ describe('EksClusterConfigurationForm', () => { ...@@ -197,8 +197,10 @@ describe('EksClusterConfigurationForm', () => {
it('sets RoleDropdown hasErrors to true when loading roles failed', () => { it('sets RoleDropdown hasErrors to true when loading roles failed', () => {
rolesState.loadingItemsError = new Error(); rolesState.loadingItemsError = new Error();
return Vue.nextTick().then(() => {
expect(findRoleDropdown().props('hasErrors')).toEqual(true); expect(findRoleDropdown().props('hasErrors')).toEqual(true);
}); });
});
it('sets isLoadingRegions to RegionDropdown loading property', () => { it('sets isLoadingRegions to RegionDropdown loading property', () => {
regionsState.isLoadingItems = true; regionsState.isLoadingItems = true;
...@@ -215,8 +217,10 @@ describe('EksClusterConfigurationForm', () => { ...@@ -215,8 +217,10 @@ describe('EksClusterConfigurationForm', () => {
it('sets loadingRegionsError to RegionDropdown error property', () => { it('sets loadingRegionsError to RegionDropdown error property', () => {
regionsState.loadingItemsError = new Error(); regionsState.loadingItemsError = new Error();
return Vue.nextTick().then(() => {
expect(findRegionDropdown().props('hasErrors')).toEqual(true); expect(findRegionDropdown().props('hasErrors')).toEqual(true);
}); });
});
it('disables KeyPairDropdown when no region is selected', () => { it('disables KeyPairDropdown when no region is selected', () => {
expect(findKeyPairDropdown().props('disabled')).toBe(true); expect(findKeyPairDropdown().props('disabled')).toBe(true);
...@@ -245,8 +249,10 @@ describe('EksClusterConfigurationForm', () => { ...@@ -245,8 +249,10 @@ describe('EksClusterConfigurationForm', () => {
it('sets KeyPairDropdown hasErrors to true when loading key pairs fails', () => { it('sets KeyPairDropdown hasErrors to true when loading key pairs fails', () => {
keyPairsState.loadingItemsError = new Error(); keyPairsState.loadingItemsError = new Error();
return Vue.nextTick().then(() => {
expect(findKeyPairDropdown().props('hasErrors')).toEqual(true); expect(findKeyPairDropdown().props('hasErrors')).toEqual(true);
}); });
});
it('disables VpcDropdown when no region is selected', () => { it('disables VpcDropdown when no region is selected', () => {
expect(findVpcDropdown().props('disabled')).toBe(true); expect(findVpcDropdown().props('disabled')).toBe(true);
...@@ -275,8 +281,10 @@ describe('EksClusterConfigurationForm', () => { ...@@ -275,8 +281,10 @@ describe('EksClusterConfigurationForm', () => {
it('sets VpcDropdown hasErrors to true when loading vpcs fails', () => { it('sets VpcDropdown hasErrors to true when loading vpcs fails', () => {
vpcsState.loadingItemsError = new Error(); vpcsState.loadingItemsError = new Error();
return Vue.nextTick().then(() => {
expect(findVpcDropdown().props('hasErrors')).toEqual(true); expect(findVpcDropdown().props('hasErrors')).toEqual(true);
}); });
});
it('disables SubnetDropdown when no vpc is selected', () => { it('disables SubnetDropdown when no vpc is selected', () => {
expect(findSubnetDropdown().props('disabled')).toBe(true); expect(findSubnetDropdown().props('disabled')).toBe(true);
...@@ -305,8 +313,10 @@ describe('EksClusterConfigurationForm', () => { ...@@ -305,8 +313,10 @@ describe('EksClusterConfigurationForm', () => {
it('sets SubnetDropdown hasErrors to true when loading subnets fails', () => { it('sets SubnetDropdown hasErrors to true when loading subnets fails', () => {
subnetsState.loadingItemsError = new Error(); subnetsState.loadingItemsError = new Error();
return Vue.nextTick().then(() => {
expect(findSubnetDropdown().props('hasErrors')).toEqual(true); expect(findSubnetDropdown().props('hasErrors')).toEqual(true);
}); });
});
it('disables SecurityGroupDropdown when no vpc is selected', () => { it('disables SecurityGroupDropdown when no vpc is selected', () => {
expect(findSecurityGroupDropdown().props('disabled')).toBe(true); expect(findSecurityGroupDropdown().props('disabled')).toBe(true);
...@@ -335,8 +345,10 @@ describe('EksClusterConfigurationForm', () => { ...@@ -335,8 +345,10 @@ describe('EksClusterConfigurationForm', () => {
it('sets SecurityGroupDropdown hasErrors to true when loading security groups fails', () => { it('sets SecurityGroupDropdown hasErrors to true when loading security groups fails', () => {
securityGroupsState.loadingItemsError = new Error(); securityGroupsState.loadingItemsError = new Error();
return Vue.nextTick().then(() => {
expect(findSecurityGroupDropdown().props('hasErrors')).toEqual(true); expect(findSecurityGroupDropdown().props('hasErrors')).toEqual(true);
}); });
});
describe('when region is selected', () => { describe('when region is selected', () => {
const region = { name: 'us-west-2' }; const region = { name: 'us-west-2' };
......
...@@ -57,7 +57,9 @@ describe('error tracking settings app', () => { ...@@ -57,7 +57,9 @@ describe('error tracking settings app', () => {
it('disables the button when saving', () => { it('disables the button when saving', () => {
store.state.settingsLoading = true; store.state.settingsLoading = true;
return wrapper.vm.$nextTick(() => {
expect(wrapper.find('.js-error-tracking-button').attributes('disabled')).toBeTruthy(); expect(wrapper.find('.js-error-tracking-button').attributes('disabled')).toBeTruthy();
}); });
}); });
});
}); });
...@@ -24,8 +24,10 @@ describe('MR Popover', () => { ...@@ -24,8 +24,10 @@ describe('MR Popover', () => {
it('shows skeleton-loader while apollo is loading', () => { it('shows skeleton-loader while apollo is loading', () => {
wrapper.vm.$apollo.loading = true; wrapper.vm.$apollo.loading = true;
return wrapper.vm.$nextTick().then(() => {
expect(wrapper.element).toMatchSnapshot(); expect(wrapper.element).toMatchSnapshot();
}); });
});
describe('loaded state', () => { describe('loaded state', () => {
it('matches the snapshot', () => { it('matches the snapshot', () => {
......
...@@ -66,40 +66,52 @@ describe('Repository last commit component', () => { ...@@ -66,40 +66,52 @@ describe('Repository last commit component', () => {
it('renders commit widget', () => { it('renders commit widget', () => {
factory(); factory();
return vm.vm.$nextTick(() => {
expect(vm.element).toMatchSnapshot(); expect(vm.element).toMatchSnapshot();
}); });
});
it('renders short commit ID', () => { it('renders short commit ID', () => {
factory(); factory();
return vm.vm.$nextTick(() => {
expect(vm.find('.label-monospace').text()).toEqual('12345678'); expect(vm.find('.label-monospace').text()).toEqual('12345678');
}); });
});
it('hides pipeline components when pipeline does not exist', () => { it('hides pipeline components when pipeline does not exist', () => {
factory(createCommitData({ pipeline: null })); factory(createCommitData({ pipeline: null }));
return vm.vm.$nextTick(() => {
expect(vm.find('.js-commit-pipeline').exists()).toBe(false); expect(vm.find('.js-commit-pipeline').exists()).toBe(false);
}); });
});
it('renders pipeline components', () => { it('renders pipeline components', () => {
factory(); factory();
return vm.vm.$nextTick(() => {
expect(vm.find('.js-commit-pipeline').exists()).toBe(true); expect(vm.find('.js-commit-pipeline').exists()).toBe(true);
}); });
});
it('hides author component when author does not exist', () => { it('hides author component when author does not exist', () => {
factory(createCommitData({ author: null })); factory(createCommitData({ author: null }));
return vm.vm.$nextTick(() => {
expect(vm.find('.js-user-link').exists()).toBe(false); expect(vm.find('.js-user-link').exists()).toBe(false);
expect(vm.find(UserAvatarLink).exists()).toBe(false); expect(vm.find(UserAvatarLink).exists()).toBe(false);
}); });
});
it('does not render description expander when description is null', () => { it('does not render description expander when description is null', () => {
factory(createCommitData({ description: null })); factory(createCommitData({ description: null }));
return vm.vm.$nextTick(() => {
expect(vm.find('.text-expander').exists()).toBe(false); expect(vm.find('.text-expander').exists()).toBe(false);
expect(vm.find('.commit-row-description').exists()).toBe(false); expect(vm.find('.commit-row-description').exists()).toBe(false);
}); });
});
it('expands commit description when clicking expander', () => { it('expands commit description when clicking expander', () => {
factory(createCommitData({ description: 'Test description' })); factory(createCommitData({ description: 'Test description' }));
...@@ -113,6 +125,8 @@ describe('Repository last commit component', () => { ...@@ -113,6 +125,8 @@ describe('Repository last commit component', () => {
it('renders the signature HTML as returned by the backend', () => { it('renders the signature HTML as returned by the backend', () => {
factory(createCommitData({ signatureHtml: '<button>Verified</button>' })); factory(createCommitData({ signatureHtml: '<button>Verified</button>' }));
return vm.vm.$nextTick().then(() => {
expect(vm.element).toMatchSnapshot(); expect(vm.element).toMatchSnapshot();
}); });
});
}); });
...@@ -49,7 +49,9 @@ describe('DropdownSearchInputComponent', () => { ...@@ -49,7 +49,9 @@ describe('DropdownSearchInputComponent', () => {
wrapper.setProps({ focused: true }); wrapper.setProps({ focused: true });
return wrapper.vm.$nextTick().then(() => {
expect(inputEl.focus).toHaveBeenCalled(); expect(inputEl.focus).toHaveBeenCalled();
}); });
}); });
});
}); });
...@@ -147,10 +147,13 @@ describe('UserAvatarList', () => { ...@@ -147,10 +147,13 @@ describe('UserAvatarList', () => {
it('with collapse clicked, it renders avatars up to breakpoint', () => { it('with collapse clicked, it renders avatars up to breakpoint', () => {
clickButton(); clickButton();
return wrapper.vm.$nextTick(() => {
const links = wrapper.findAll(UserAvatarLink); const links = wrapper.findAll(UserAvatarLink);
expect(links.length).toEqual(TEST_BREAKPOINT); expect(links.length).toEqual(TEST_BREAKPOINT);
}); });
}); });
}); });
});
}); });
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment