|
| 1 | +import { expect, test } from '@jupyterlab/galata'; |
| 2 | +import path from 'path'; |
| 3 | +import { extractFile } from './utils'; |
| 4 | + |
| 5 | +const baseRepositoryPath = 'test-repository.tar.gz'; |
| 6 | +test.use({ autoGoto: false }); |
| 7 | + |
| 8 | +test.describe('Commit', () => { |
| 9 | + test.beforeEach(async ({ page, request, tmpPath }) => { |
| 10 | + await extractFile( |
| 11 | + request, |
| 12 | + path.resolve(__dirname, 'data', baseRepositoryPath), |
| 13 | + path.join(tmpPath, 'repository.tar.gz') |
| 14 | + ); |
| 15 | + |
| 16 | + // URL for merge conflict example repository |
| 17 | + await page.goto(`tree/${tmpPath}/test-repository`); |
| 18 | + }); |
| 19 | + |
| 20 | + test('should commit a change', async ({ page }) => { |
| 21 | + await page |
| 22 | + .getByRole('listitem', { name: 'Name: another_file.txt' }) |
| 23 | + .dblclick(); |
| 24 | + await page |
| 25 | + .getByLabel('another_file.txt') |
| 26 | + .getByRole('textbox') |
| 27 | + .fill('My new content'); |
| 28 | + await page.keyboard.press('Control+s'); |
| 29 | + |
| 30 | + await page.getByRole('tab', { name: 'Git' }).click(); |
| 31 | + await page.getByTitle('another_file.txt • Modified').hover(); |
| 32 | + await page.getByRole('button', { name: 'Stage this change' }).click(); |
| 33 | + |
| 34 | + await page |
| 35 | + .getByPlaceholder('Summary (Ctrl+Enter to commit)') |
| 36 | + .fill('My new commit'); |
| 37 | + |
| 38 | + await page.getByRole('button', { name: 'Commit', exact: true }).click(); |
| 39 | + |
| 40 | + await page.getByRole('tab', { name: 'History' }).click(); |
| 41 | + |
| 42 | + await expect(page.getByText('My new commit')).toBeVisible(); |
| 43 | + }); |
| 44 | +}); |
0 commit comments