diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2021-12-16 00:11:32 +0300 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2021-12-16 00:11:32 +0300 |
commit | 1c898dc5c10bbedf94386d917259153d73608495 (patch) | |
tree | f939cf185da9e96f7aba2200fa5ac74deffd71f9 /spec/frontend_integration | |
parent | 22baaecaa84003c554f35752a729331e956d7659 (diff) |
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'spec/frontend_integration')
-rw-r--r-- | spec/frontend_integration/ide/helpers/ide_helper.js | 14 | ||||
-rw-r--r-- | spec/frontend_integration/ide/helpers/start.js | 4 | ||||
-rw-r--r-- | spec/frontend_integration/ide/user_opens_ide_spec.js | 6 |
3 files changed, 15 insertions, 9 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'); }); }); |