| b69ab31 | | | 1 | /** |
| b69ab31 | | | 2 | * Copyright (c) Meta Platforms, Inc. and affiliates. |
| b69ab31 | | | 3 | * |
| b69ab31 | | | 4 | * This source code is licensed under the MIT license found in the |
| b69ab31 | | | 5 | * LICENSE file in the root directory of this source tree. |
| b69ab31 | | | 6 | */ |
| b69ab31 | | | 7 | |
| b69ab31 | | | 8 | import {act, screen, waitFor, within} from '@testing-library/react'; |
| b69ab31 | | | 9 | import {initRepo} from './setup'; |
| b69ab31 | | | 10 | |
| b69ab31 | | | 11 | describe('merge conflicts integration test', () => { |
| b69ab31 | | | 12 | it('shows conflicts, supports resolving, and continuing the operation', async () => { |
| b69ab31 | | | 13 | const {cleanup, sl, drawdag, writeFileInRepo, refresh} = await initRepo(); |
| b69ab31 | | | 14 | const {ignoreRTL} = await import('../src/testQueries'); |
| b69ab31 | | | 15 | await act(() => |
| b69ab31 | | | 16 | drawdag(` |
| b69ab31 | | | 17 | C |
| b69ab31 | | | 18 | | |
| b69ab31 | | | 19 | B |
| b69ab31 | | | 20 | | |
| b69ab31 | | | 21 | A |
| b69ab31 | | | 22 | . |
| b69ab31 | | | 23 | python: |
| b69ab31 | | | 24 | commit('C', files={"file1.txt": "bar\\n"}) |
| b69ab31 | | | 25 | commit('B', files={"file1.txt": "foo\\n"}) |
| b69ab31 | | | 26 | commit('A', files={"file1.txt": "base\\n"}) |
| b69ab31 | | | 27 | `), |
| b69ab31 | | | 28 | ); |
| b69ab31 | | | 29 | |
| b69ab31 | | | 30 | await act(async () => { |
| b69ab31 | | | 31 | await sl(['goto', 'desc(B)']); |
| b69ab31 | | | 32 | await writeFileInRepo('file1.txt', 'conflict'); |
| b69ab31 | | | 33 | // this amend onto B will hit conflicts with C |
| b69ab31 | | | 34 | await sl(['amend', '--rebase']).catch(() => undefined); |
| b69ab31 | | | 35 | }); |
| b69ab31 | | | 36 | refresh(); |
| b69ab31 | | | 37 | |
| b69ab31 | | | 38 | await waitFor(() => |
| b69ab31 | | | 39 | within(screen.getByTestId('commit-tree-root')).getByText('Unresolved Merge Conflicts'), |
| b69ab31 | | | 40 | ); |
| b69ab31 | | | 41 | await waitFor(() => |
| b69ab31 | | | 42 | within(screen.getByTestId('commit-tree-root')).getByText(ignoreRTL('file1.txt')), |
| b69ab31 | | | 43 | ); |
| b69ab31 | | | 44 | |
| b69ab31 | | | 45 | await act(cleanup); |
| b69ab31 | | | 46 | }); |
| b69ab31 | | | 47 | }); |