addons/isl/integrationTests/mergeConflictsMultiple.test.tsxblame
View source
b69ab311/**
b69ab312 * Copyright (c) Meta Platforms, Inc. and affiliates.
b69ab313 *
b69ab314 * This source code is licensed under the MIT license found in the
b69ab315 * LICENSE file in the root directory of this source tree.
b69ab316 */
b69ab317
b69ab318import {act, screen, waitFor, within} from '@testing-library/react';
b69ab319import {initRepo} from './setup';
b69ab3110
b69ab3111describe('multiple merge conflicts integration test', () => {
b69ab3112 it('shows conflicts, supports resolving, and continuing the operation', async () => {
b69ab3113 const {cleanup, sl, drawdag, writeFileInRepo, refresh} = await initRepo();
b69ab3114
b69ab3115 const {MergeConflictTestUtils, ignoreRTL} = await import('../src/testQueries');
b69ab3116 const {
b69ab3117 expectInMergeConflicts,
b69ab3118 expectNotInMergeConflicts,
b69ab3119 waitForContinueButtonNotDisabled,
b69ab3120 clickContinueConflicts,
b69ab3121 } = MergeConflictTestUtils;
b69ab3122
b69ab3123 await act(() =>
b69ab3124 drawdag(`
b69ab3125 C
b69ab3126 |
b69ab3127 B
b69ab3128 |
b69ab3129 A
b69ab3130 .
b69ab3131python:
b69ab3132commit('C', files={"file2.txt": "baz\\n"})
b69ab3133commit('B', files={"file1.txt": "foo\\n"})
b69ab3134commit('A', files={"file1.txt": "base\\n", "file2.txt": "base\\n"})
b69ab3135 `),
b69ab3136 );
b69ab3137
b69ab3138 await act(async () => {
b69ab3139 await sl(['goto', 'desc(A)']);
b69ab3140 await writeFileInRepo('file1.txt', 'conflict');
b69ab3141 await writeFileInRepo('file2.txt', 'conflict');
b69ab3142 // this amend onto B will hit conflicts with C
b69ab3143 await sl(['amend', '--rebase']).catch(() => undefined);
b69ab3144 });
b69ab3145
b69ab3146 await waitFor(() => expectInMergeConflicts());
b69ab3147 await waitFor(() =>
b69ab3148 within(screen.getByTestId('commit-tree-root')).getByText(ignoreRTL('file1.txt')),
b69ab3149 );
b69ab3150
b69ab3151 await act(async () => {
b69ab3152 await sl(['resolve', '--tool', 'internal:union', 'file1.txt']);
b69ab3153 });
b69ab3154 refresh();
b69ab3155
b69ab3156 await waitForContinueButtonNotDisabled();
b69ab3157 clickContinueConflicts();
b69ab3158
b69ab3159 await waitFor(() =>
b69ab3160 within(screen.getByTestId('commit-tree-root')).getByText(ignoreRTL('file2.txt')),
b69ab3161 );
b69ab3162 await act(async () => {
b69ab3163 await sl(['resolve', '--tool', 'internal:union', 'file2.txt']);
b69ab3164 });
b69ab3165 refresh();
b69ab3166
b69ab3167 await waitForContinueButtonNotDisabled();
b69ab3168 clickContinueConflicts();
b69ab3169
b69ab3170 await waitFor(() => expectNotInMergeConflicts());
b69ab3171
b69ab3172 await act(cleanup);
b69ab3173 });
b69ab3174});