2.1 KB75 lines
Blame
1/**
2 * Copyright (c) Meta Platforms, Inc. and affiliates.
3 *
4 * This source code is licensed under the MIT license found in the
5 * LICENSE file in the root directory of this source tree.
6 */
7
8import {act, screen, waitFor, within} from '@testing-library/react';
9import {initRepo} from './setup';
10
11describe('multiple merge conflicts integration test', () => {
12 it('shows conflicts, supports resolving, and continuing the operation', async () => {
13 const {cleanup, sl, drawdag, writeFileInRepo, refresh} = await initRepo();
14
15 const {MergeConflictTestUtils, ignoreRTL} = await import('../src/testQueries');
16 const {
17 expectInMergeConflicts,
18 expectNotInMergeConflicts,
19 waitForContinueButtonNotDisabled,
20 clickContinueConflicts,
21 } = MergeConflictTestUtils;
22
23 await act(() =>
24 drawdag(`
25 C
26 |
27 B
28 |
29 A
30 .
31python:
32commit('C', files={"file2.txt": "baz\\n"})
33commit('B', files={"file1.txt": "foo\\n"})
34commit('A', files={"file1.txt": "base\\n", "file2.txt": "base\\n"})
35 `),
36 );
37
38 await act(async () => {
39 await sl(['goto', 'desc(A)']);
40 await writeFileInRepo('file1.txt', 'conflict');
41 await writeFileInRepo('file2.txt', 'conflict');
42 // this amend onto B will hit conflicts with C
43 await sl(['amend', '--rebase']).catch(() => undefined);
44 });
45
46 await waitFor(() => expectInMergeConflicts());
47 await waitFor(() =>
48 within(screen.getByTestId('commit-tree-root')).getByText(ignoreRTL('file1.txt')),
49 );
50
51 await act(async () => {
52 await sl(['resolve', '--tool', 'internal:union', 'file1.txt']);
53 });
54 refresh();
55
56 await waitForContinueButtonNotDisabled();
57 clickContinueConflicts();
58
59 await waitFor(() =>
60 within(screen.getByTestId('commit-tree-root')).getByText(ignoreRTL('file2.txt')),
61 );
62 await act(async () => {
63 await sl(['resolve', '--tool', 'internal:union', 'file2.txt']);
64 });
65 refresh();
66
67 await waitForContinueButtonNotDisabled();
68 clickContinueConflicts();
69
70 await waitFor(() => expectNotInMergeConflicts());
71
72 await act(cleanup);
73 });
74});
75