diff --git a/src/components/GitPanel.tsx b/src/components/GitPanel.tsx index caf4dc1c..2acb17ab 100644 --- a/src/components/GitPanel.tsx +++ b/src/components/GitPanel.tsx @@ -788,15 +788,17 @@ export class GitPanel extends React.Component { try { const author = await this._hasIdentity(this.props.model.pathRepository); - const message = this.props.trans.__('Committing changes...'); + const notificationMsg = this.props.trans.__('Committing changes...'); if (id !== null) { Notification.update({ id, - message, + message: notificationMsg, autoClose: false }); } else { - id = Notification.emit(message, 'in-progress', { autoClose: false }); + id = Notification.emit(notificationMsg, 'in-progress', { + autoClose: false + }); } if (this.state.commitAmend) { diff --git a/ui-tests/tests/commit.spec.ts b/ui-tests/tests/commit.spec.ts new file mode 100644 index 00000000..f21a0abd --- /dev/null +++ b/ui-tests/tests/commit.spec.ts @@ -0,0 +1,44 @@ +import { expect, test } from '@jupyterlab/galata'; +import path from 'path'; +import { extractFile } from './utils'; + +const baseRepositoryPath = 'test-repository.tar.gz'; +test.use({ autoGoto: false }); + +test.describe('Commit', () => { + test.beforeEach(async ({ page, request, tmpPath }) => { + await extractFile( + request, + path.resolve(__dirname, 'data', baseRepositoryPath), + path.join(tmpPath, 'repository.tar.gz') + ); + + // URL for merge conflict example repository + await page.goto(`tree/${tmpPath}/test-repository`); + }); + + test('should commit a change', async ({ page }) => { + await page + .getByRole('listitem', { name: 'Name: another_file.txt' }) + .dblclick(); + await page + .getByLabel('another_file.txt') + .getByRole('textbox') + .fill('My new content'); + await page.keyboard.press('Control+s'); + + await page.getByRole('tab', { name: 'Git' }).click(); + await page.getByTitle('another_file.txt • Modified').hover(); + await page.getByRole('button', { name: 'Stage this change' }).click(); + + await page + .getByPlaceholder('Summary (Ctrl+Enter to commit)') + .fill('My new commit'); + + await page.getByRole('button', { name: 'Commit', exact: true }).click(); + + await page.getByRole('tab', { name: 'History' }).click(); + + await expect(page.getByText('My new commit')).toBeVisible(); + }); +});