Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'spec/frontend_integration/ide/ide_integration_spec.js')
-rw-r--r--spec/frontend_integration/ide/ide_integration_spec.js47
1 files changed, 37 insertions, 10 deletions
diff --git a/spec/frontend_integration/ide/ide_integration_spec.js b/spec/frontend_integration/ide/ide_integration_spec.js
index 91d89c26ec1..c4d0c4df8de 100644
--- a/spec/frontend_integration/ide/ide_integration_spec.js
+++ b/spec/frontend_integration/ide/ide_integration_spec.js
@@ -1,17 +1,10 @@
-/**
- * WARNING: WIP
- *
- * Please do not copy from this spec or use it as an example for anything.
- *
- * This is in place to iteratively set up the frontend integration testing environment
- * and will be improved upon in a later iteration.
- *
- * See https://gitlab.com/gitlab-org/gitlab/-/issues/208800 for more information.
- */
import { TEST_HOST } from 'helpers/test_constants';
+import { waitForText } from 'helpers/wait_for_text';
import { useOverclockTimers } from 'test_helpers/utils/overclock_timers';
+import { createCommitId } from 'test_helpers/factories/commit_id';
import { initIde } from '~/ide';
import extendStore from '~/ide/stores/extend';
+import * as ideHelper from './ide_helper';
const TEST_DATASET = {
emptyStateSvgPath: '/test/empty_state.svg',
@@ -59,4 +52,38 @@ describe('WebIDE', () => {
expect(root).toMatchSnapshot();
});
+
+ it('user commits changes', async () => {
+ createComponent();
+
+ await ideHelper.createFile('foo/bar/test.txt', 'Lorem ipsum dolar sit');
+ await ideHelper.deleteFile('foo/bar/.gitkeep');
+ await ideHelper.commit();
+
+ const commitId = createCommitId(1);
+ const commitShortId = commitId.slice(0, 8);
+
+ await waitForText('All changes are committed');
+ await waitForText(commitShortId);
+
+ expect(mockServer.db.branches.findBy({ name: 'master' }).commit).toMatchObject({
+ short_id: commitShortId,
+ id: commitId,
+ message: 'Update foo/bar/test.txt\nDeleted foo/bar/.gitkeep',
+ __actions: [
+ {
+ action: 'create',
+ content: 'Lorem ipsum dolar sit\n',
+ encoding: 'text',
+ file_path: 'foo/bar/test.txt',
+ last_commit_id: '',
+ },
+ {
+ action: 'delete',
+ encoding: 'text',
+ file_path: 'foo/bar/.gitkeep',
+ },
+ ],
+ });
+ });
});