diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2021-12-20 13:37:47 +0000 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2021-12-20 13:37:47 +0000 |
commit | aee0a117a889461ce8ced6fcf73207fe017f1d99 (patch) | |
tree | 891d9ef189227a8445d83f35c1b0fc99573f4380 /spec/frontend_integration | |
parent | 8d46af3258650d305f53b819eabf7ab18d22f59e (diff) | |
download | gitlab-ce-aee0a117a889461ce8ced6fcf73207fe017f1d99.tar.gz |
Add latest changes from gitlab-org/gitlab@14-6-stable-eev14.6.0-rc42
Diffstat (limited to 'spec/frontend_integration')
5 files changed, 19 insertions, 18 deletions
diff --git a/spec/frontend_integration/ide/helpers/ide_helper.js b/spec/frontend_integration/ide/helpers/ide_helper.js index 56b2e298aa3..54a522324f5 100644 --- a/spec/frontend_integration/ide/helpers/ide_helper.js +++ b/spec/frontend_integration/ide/helpers/ide_helper.js @@ -192,6 +192,13 @@ export const commit = async ({ newBranch = false, newMR = false, newBranchName = switchLeftSidebarTab('Commit'); screen.getByTestId('begin-commit-button').click(); + await waitForMonacoEditor(); + + const mrCheck = await screen.findByLabelText('Start a new merge request'); + if (Boolean(mrCheck.checked) !== newMR) { + mrCheck.click(); + } + if (!newBranch) { const option = await screen.findByLabelText(/Commit to .+ branch/); option.click(); @@ -201,12 +208,9 @@ export const commit = async ({ newBranch = false, newMR = false, newBranchName = const branchNameInput = await screen.findByTestId('ide-new-branch-name'); fireEvent.input(branchNameInput, { target: { value: newBranchName } }); - - const mrCheck = await screen.findByLabelText('Start a new merge request'); - if (Boolean(mrCheck.checked) !== newMR) { - mrCheck.click(); - } } screen.getByText('Commit').click(); + + await waitForMonacoEditor(); }; diff --git a/spec/frontend_integration/ide/helpers/start.js b/spec/frontend_integration/ide/helpers/start.js index 4451c1ee946..3c5ed9dfe20 100644 --- a/spec/frontend_integration/ide/helpers/start.js +++ b/spec/frontend_integration/ide/helpers/start.js @@ -4,16 +4,18 @@ import setWindowLocation from 'helpers/set_window_location_helper'; import { TEST_HOST } from 'helpers/test_constants'; import { initIde } from '~/ide'; import extendStore from '~/ide/stores/extend'; +import { getProject, getEmptyProject } from 'jest/../frontend_integration/test_helpers/fixtures'; import { IDE_DATASET } from './mock_data'; export default (container, { isRepoEmpty = false, path = '', mrId = '' } = {}) => { const projectName = isRepoEmpty ? 'lorem-ipsum-empty' : 'lorem-ipsum'; const pathSuffix = mrId ? `merge_requests/${mrId}` : `tree/master/-/${path}`; + const project = isRepoEmpty ? getEmptyProject() : getProject(); setWindowLocation(`${TEST_HOST}/-/ide/project/gitlab-test/${projectName}/${pathSuffix}`); const el = document.createElement('div'); - Object.assign(el.dataset, IDE_DATASET); + Object.assign(el.dataset, IDE_DATASET, { project: JSON.stringify(project) }); container.appendChild(el); const vm = initIde(el, { extendStore }); diff --git a/spec/frontend_integration/ide/user_opens_ide_spec.js b/spec/frontend_integration/ide/user_opens_ide_spec.js index f56cd008d1c..c9d78d1de8f 100644 --- a/spec/frontend_integration/ide/user_opens_ide_spec.js +++ b/spec/frontend_integration/ide/user_opens_ide_spec.js @@ -34,10 +34,10 @@ describe('IDE: User opens IDE', () => { expect(await screen.findByText('No files')).toBeDefined(); }); - it('shows a "New file" button', async () => { - const button = await screen.findByTitle('New file'); + it('shows a "New file" button', () => { + const buttons = screen.queryAllByTitle('New file'); - expect(button.tagName).toEqual('BUTTON'); + expect(buttons.map((x) => x.tagName)).toContain('BUTTON'); }); }); diff --git a/spec/frontend_integration/test_helpers/setup/index.js b/spec/frontend_integration/test_helpers/setup/index.js index 946ccbec00c..0c16592f2e2 100644 --- a/spec/frontend_integration/test_helpers/setup/index.js +++ b/spec/frontend_integration/test_helpers/setup/index.js @@ -1,4 +1,4 @@ -import '../../../frontend/test_setup'; +import 'helpers/shared_test_setup'; import './setup_globals'; import './setup_axios'; import './setup_serializers'; diff --git a/spec/frontend_integration/test_helpers/setup/setup_globals.js b/spec/frontend_integration/test_helpers/setup/setup_globals.js index b63a9a96372..ac5aeb1dd72 100644 --- a/spec/frontend_integration/test_helpers/setup/setup_globals.js +++ b/spec/frontend_integration/test_helpers/setup/setup_globals.js @@ -1,15 +1,10 @@ -import { setTestTimeout } from 'helpers/timeout'; +import { initializeTestTimeout } from 'helpers/timeout'; + +initializeTestTimeout(process.env.CI ? 20000 : 7000); beforeEach(() => { window.gon = { api_version: 'v4', relative_url_root: '', }; - - setTestTimeout(7000); - jest.useRealTimers(); -}); - -afterEach(() => { - jest.useFakeTimers(); }); |