From 6182c78d2bc06dac913872702bb899b75588c606 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20Collonval?= Date: Fri, 21 Jul 2023 16:53:26 +0200 Subject: [PATCH 1/4] Rename master to main --- .github/workflows/build.yml | 2 +- .github/workflows/check-release.yml | 2 +- README.md | 10 +++--- jupyterlab_git/tests/test_branch.py | 26 +++++++------- jupyterlab_git/tests/test_config.py | 6 ++-- jupyterlab_git/tests/test_handlers.py | 6 ++-- jupyterlab_git/tests/test_status.py | 34 +++++++++---------- specification/Git_REST_API.yml | 12 +++---- src/__tests__/model.spec.tsx | 8 ++--- .../test-components/BranchMenu.spec.tsx | 10 +++--- .../test-components/Toolbar.spec.tsx | 14 ++++---- src/components/GitPanel.tsx | 4 +-- src/components/NewBranchDialog.tsx | 8 ++--- ui-tests/README.md | 2 +- ui-tests/tests/git-stash.spec.ts | 12 +++---- 15 files changed, 78 insertions(+), 78 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index ecffb3cab..527505756 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -2,7 +2,7 @@ name: Build on: push: - branches: ['master'] + branches: ['main'] pull_request: branches: ['*'] diff --git a/.github/workflows/check-release.yml b/.github/workflows/check-release.yml index a58f095c9..17353384a 100644 --- a/.github/workflows/check-release.yml +++ b/.github/workflows/check-release.yml @@ -1,7 +1,7 @@ name: Check Release on: push: - branches: ["master"] + branches: ["main"] pull_request: branches: ["*"] diff --git a/README.md b/README.md index ce25cfce9..574f2edea 100644 --- a/README.md +++ b/README.md @@ -1,15 +1,15 @@ # jupyterlab-git -[![Binder](https://mybinder.org/badge_logo.svg)](https://mybinder.org/v2/gh/jupyterlab/jupyterlab-git/master?urlpath=lab/tree/examples/demo.ipynb) [![Github Actions Status](https://github.com/jupyterlab/jupyterlab-git/actions/workflows/build.yml/badge.svg)](https://github.com/jupyterlab/jupyterlab-git/actions/workflows/build.yml) [![Version](https://img.shields.io/npm/v/@jupyterlab/git.svg)](https://www.npmjs.com/package/@jupyterlab/git) [![Version](https://img.shields.io/pypi/v/jupyterlab-git.svg)](https://pypi.org/project/jupyterlab-git/) [![Downloads](https://img.shields.io/npm/dm/@jupyterlab/git.svg)](https://www.npmjs.com/package/@jupyterlab/git) [![Version](https://img.shields.io/conda/vn/conda-forge/jupyterlab-git.svg)](https://anaconda.org/conda-forge/jupyterlab-git) [![Downloads](https://img.shields.io/conda/dn/conda-forge/jupyterlab-git.svg)](https://anaconda.org/conda-forge/jupyterlab-git) +[![Binder](https://mybinder.org/badge_logo.svg)](https://mybinder.org/v2/gh/jupyterlab/jupyterlab-git/main?urlpath=lab/tree/examples/demo.ipynb) [![Github Actions Status](https://github.com/jupyterlab/jupyterlab-git/actions/workflows/build.yml/badge.svg)](https://github.com/jupyterlab/jupyterlab-git/actions/workflows/build.yml) [![Version](https://img.shields.io/npm/v/@jupyterlab/git.svg)](https://www.npmjs.com/package/@jupyterlab/git) [![Version](https://img.shields.io/pypi/v/jupyterlab-git.svg)](https://pypi.org/project/jupyterlab-git/) [![Downloads](https://img.shields.io/npm/dm/@jupyterlab/git.svg)](https://www.npmjs.com/package/@jupyterlab/git) [![Version](https://img.shields.io/conda/vn/conda-forge/jupyterlab-git.svg)](https://anaconda.org/conda-forge/jupyterlab-git) [![Downloads](https://img.shields.io/conda/dn/conda-forge/jupyterlab-git.svg)](https://anaconda.org/conda-forge/jupyterlab-git) [![All Contributors](https://img.shields.io/badge/all_contributors-29-orange.svg?style=flat-square)](#contributors-) A JupyterLab extension for version control using Git -![ui_glow_up](https://raw.githubusercontent.com/jupyterlab/jupyterlab-git/master/docs/figs/preview.gif) +![ui_glow_up](https://raw.githubusercontent.com/jupyterlab/jupyterlab-git/main/docs/figs/preview.gif) -To see the extension in action, open the example notebook included in the Binder [demo](https://mybinder.org/v2/gh/jupyterlab/jupyterlab-git/master?urlpath=lab/tree/examples/demo.ipynb). +To see the extension in action, open the example notebook included in the Binder [demo](https://mybinder.org/v2/gh/jupyterlab/jupyterlab-git/main?urlpath=lab/tree/examples/demo.ipynb). ## Requirements @@ -193,9 +193,9 @@ Possible fixes: ## Contributing -If you would like to contribute to the project, please read our [contributor documentation](https://github.com/jupyterlab/jupyterlab/blob/master/CONTRIBUTING.md). +If you would like to contribute to the project, please read our [contributor documentation](https://github.com/jupyterlab/jupyterlab/blob/main/CONTRIBUTING.md). -JupyterLab follows the official [Jupyter Code of Conduct](https://github.com/jupyter/governance/blob/master/conduct/code_of_conduct.md). +JupyterLab follows the official [Jupyter Code of Conduct](https://github.com/jupyter/governance/blob/main/conduct/code_of_conduct.md). ### Development install diff --git a/jupyterlab_git/tests/test_branch.py b/jupyterlab_git/tests/test_branch.py index 7705556cf..837c10f91 100644 --- a/jupyterlab_git/tests/test_branch.py +++ b/jupyterlab_git/tests/test_branch.py @@ -12,7 +12,7 @@ "branch,expected", [ ("refs/heads/feature-foo", False), - ("refs/heads/master", False), + ("refs/heads/main", False), ("refs/remotes/origin/feature-foo", True), ("refs/remotes/origin/HEAD", True), ("refs/stash", False), @@ -353,7 +353,7 @@ async def test_get_current_branch_detached_success(): # Given process_output = [ "* (HEAD detached at origin/feature-foo)", - " master", + " main", " remotes/origin/feature-foo", " remotes/origin/HEAD", ] @@ -406,8 +406,8 @@ async def test_get_current_branch_detached_failure(): @pytest.mark.parametrize( "branch,upstream,remotename", [ - ("feature-foo", "master", "origin/withslash"), - ("master", "master", "origin"), + ("feature-foo", "main", "origin/withslash"), + ("main", "main", "origin"), ("feature/bar", "feature-foo", ""), # Test upstream branch name starts with a letter contained in remote name ("rbranch", "rbranch", "origin"), @@ -603,12 +603,12 @@ async def test_branch_success(): # Given process_output_heads = [ "feature-foo\tabcdefghijklmnopqrstuvwxyz01234567890123\torigin/feature-foo\t*", - "master\tabcdefghijklmnopqrstuvwxyz01234567890123\torigin/master\t ", + "main\tabcdefghijklmnopqrstuvwxyz01234567890123\torigin/main\t ", "feature-bar\t01234567899999abcdefghijklmnopqrstuvwxyz\t\t ", ] process_output_remotes = [ "origin/feature-foo\tabcdefghijklmnopqrstuvwxyz01234567890123", - "origin/master\tabcdefghijklmnopqrstuvwxyz01234567890123", + "origin/main\tabcdefghijklmnopqrstuvwxyz01234567890123", ] mock_execute.side_effect = [ @@ -632,8 +632,8 @@ async def test_branch_success(): { "is_current_branch": False, "is_remote_branch": False, - "name": "master", - "upstream": "origin/master", + "name": "main", + "upstream": "origin/main", "top_commit": "abcdefghijklmnopqrstuvwxyz01234567890123", "tag": None, }, @@ -656,7 +656,7 @@ async def test_branch_success(): { "is_current_branch": False, "is_remote_branch": True, - "name": "origin/master", + "name": "origin/main", "upstream": None, "top_commit": "abcdefghijklmnopqrstuvwxyz01234567890123", "tag": None, @@ -745,14 +745,14 @@ async def test_branch_success_detached_head(): with patch("jupyterlab_git.git.execute") as mock_execute: # Given process_output_heads = [ - "master\tabcdefghijklmnopqrstuvwxyz01234567890123\torigin/master\t " + "main\tabcdefghijklmnopqrstuvwxyz01234567890123\torigin/main\t " ] process_output_remotes = [ "origin/feature-foo\tabcdefghijklmnopqrstuvwxyz01234567890123" ] detached_head_output = [ "* (HEAD detached at origin/feature-foo)", - " master", + " main", " remotes/origin/feature-foo", ] @@ -773,8 +773,8 @@ async def test_branch_success_detached_head(): { "is_current_branch": False, "is_remote_branch": False, - "name": "master", - "upstream": "origin/master", + "name": "main", + "upstream": "origin/main", "top_commit": "abcdefghijklmnopqrstuvwxyz01234567890123", "tag": None, }, diff --git a/jupyterlab_git/tests/test_config.py b/jupyterlab_git/tests/test_config.py index 4c047ed03..5fa3f8794 100644 --- a/jupyterlab_git/tests/test_config.py +++ b/jupyterlab_git/tests/test_config.py @@ -46,7 +46,7 @@ async def test_git_get_config_multiline(mock_execute, jp_fetch, jp_root_dir): '" $(git rev-parse --abbrev-ref HEAD); printf "\n' "Most-active files, with churn count\n" '"; git churn | head -7; }; f\n' - 'alias.topic-base-branch-name=!f(){ printf "master\n' + 'alias.topic-base-branch-name=!f(){ printf "main\n' '"; };f\n' 'alias.topic-start=!f(){ topic_branch="$1"; git topic-create "$topic_branch"; git topic-push; };f' ) @@ -89,7 +89,7 @@ async def test_git_get_config_accepted_multiline(mock_execute, jp_fetch, jp_root '" $(git rev-parse --abbrev-ref HEAD); printf "\n' "Most-active files, with churn count\n" '"; git churn | head -7; }; f\n' - 'alias.topic-base-branch-name=!f(){ printf "master\n' + 'alias.topic-base-branch-name=!f(){ printf "main\n' '"; };f\n' 'alias.topic-start=!f(){ topic_branch="$1"; git topic-create "$topic_branch"; git topic-push; };f' ) @@ -116,7 +116,7 @@ async def test_git_get_config_accepted_multiline(mock_execute, jp_fetch, jp_root '" $(git rev-parse --abbrev-ref HEAD); printf "\n' "Most-active files, with churn count\n" '"; git churn | head -7; }; f', - "alias.topic-base-branch-name": '!f(){ printf "master\n"; };f', + "alias.topic-base-branch-name": '!f(){ printf "main\n"; };f', }, } diff --git a/jupyterlab_git/tests/test_handlers.py b/jupyterlab_git/tests/test_handlers.py index 7aa9b0d66..b3774c912 100644 --- a/jupyterlab_git/tests/test_handlers.py +++ b/jupyterlab_git/tests/test_handlers.py @@ -238,8 +238,8 @@ async def test_branch_handler_localbranch(mock_git, jp_fetch, jp_root_dir): { "is_current_branch": False, "is_remote_branch": False, - "name": "master", - "upstream": "origin/master", + "name": "main", + "upstream": "origin/main", "top_commit": "abcdefghijklmnopqrstuvwxyz01234567890123", "tag": None, }, @@ -262,7 +262,7 @@ async def test_branch_handler_localbranch(mock_git, jp_fetch, jp_root_dir): { "is_current_branch": False, "is_remote_branch": True, - "name": "origin/master", + "name": "origin/main", "upstream": None, "top_commit": "abcdefghijklmnopqrstuvwxyz01234567890123", "tag": None, diff --git a/jupyterlab_git/tests/test_status.py b/jupyterlab_git/tests/test_status.py index e0ca02d59..ac276a358 100644 --- a/jupyterlab_git/tests/test_status.py +++ b/jupyterlab_git/tests/test_status.py @@ -14,7 +14,7 @@ [ ( ( - "## master", + "## main", "A notebook with spaces.ipynb", "M notebook with λ.ipynb", "M binary file.gif", @@ -29,7 +29,7 @@ ), { "code": 0, - "branch": "master", + "branch": "main", "remote": None, "ahead": 0, "behind": 0, @@ -74,11 +74,11 @@ ), # Empty answer ( - ("## master",), + ("## main",), (""), { "code": 0, - "branch": "master", + "branch": "main", "remote": None, "ahead": 0, "behind": 0, @@ -87,12 +87,12 @@ ), # With upstream only ( - ("## master...origin/master",), + ("## main...origin/main",), (""), { "code": 0, - "branch": "master", - "remote": "origin/master", + "branch": "main", + "remote": "origin/main", "ahead": 0, "behind": 0, "files": [], @@ -100,12 +100,12 @@ ), # Ahead only ( - ("## master...origin/master [ahead 15]",), + ("## main...origin/main [ahead 15]",), (""), { "code": 0, - "branch": "master", - "remote": "origin/master", + "branch": "main", + "remote": "origin/main", "ahead": 15, "behind": 0, "files": [], @@ -113,12 +113,12 @@ ), # Behind only ( - ("## master...origin/master [behind 5]",), + ("## main...origin/main [behind 5]",), (""), { "code": 0, - "branch": "master", - "remote": "origin/master", + "branch": "main", + "remote": "origin/main", "ahead": 0, "behind": 5, "files": [], @@ -126,12 +126,12 @@ ), # Ahead and behind ( - ("## master...origin/master [ahead 3, behind 5]",), + ("## main...origin/main [ahead 3, behind 5]",), (""), { "code": 0, - "branch": "master", - "remote": "origin/master", + "branch": "main", + "remote": "origin/main", "ahead": 3, "behind": 5, "files": [], @@ -139,7 +139,7 @@ ), # Initial commit ( - ("## No commits yet on master",), + ("## No commits yet on main",), (""), { "code": 0, diff --git a/specification/Git_REST_API.yml b/specification/Git_REST_API.yml index 2e958465e..d93bf7aee 100644 --- a/specification/Git_REST_API.yml +++ b/specification/Git_REST_API.yml @@ -811,7 +811,7 @@ on git command failure ``` # ### git pull - Fetch from and integrate with another repository or a local branch -# Request with a specified remote-repo "origin", a specified branch "master", and a "curr_fb_path" to fetch. +# Request with a specified remote-repo "origin", a specified branch "main", and a "curr_fb_path" to fetch. # URL: # ```bash @@ -821,7 +821,7 @@ on git command failure # ```bash # { # "origin": "remote-repository-to-Pull-from", -# "master": "branch-to-Pull-into", +# "main": "branch-to-Pull-into", # "curr_fb_path": "current/path/in/filebrowser/widget" # } # ``` @@ -843,13 +843,13 @@ on git command failure # ```bash # { # "code": 11, -# "command": "git pull origin master" +# "command": "git pull origin main" # "message": "Git pull command error and help tips" # } # ``` # ### git push - Update remote refs along with associated objects -# Request with a specified remote-repo "origin", a specified branch "master", and a "curr_fb_path" to push. +# Request with a specified remote-repo "origin", a specified branch "main", and a "curr_fb_path" to push. # URL: # ```bash @@ -859,7 +859,7 @@ on git command failure # ```bash # { # "origin": "remote-repository-to-Push-into", -# "master": "branch-to-Push-from", +# "main": "branch-to-Push-from", # "curr_fb_path": "current/path/in/filebrowser/widget" # } # ``` @@ -881,7 +881,7 @@ on git command failure # ```bash # { # "code": 11, -# "command": "git push origin master" +# "command": "git push origin main" # "message": "Git push command error and help tips" # } # ``` diff --git a/src/__tests__/model.spec.tsx b/src/__tests__/model.spec.tsx index 757590b96..608e0896a 100644 --- a/src/__tests__/model.spec.tsx +++ b/src/__tests__/model.spec.tsx @@ -215,7 +215,7 @@ describe('IGitExtension', () => { expect(model.status.files).toHaveLength(0); model.pathRepository = DEFAULT_REPOSITORY_PATH; - const branch = 'master'; + const branch = 'main'; await model.ready; status = { branch, @@ -236,7 +236,7 @@ describe('IGitExtension', () => { }); it('should emit a signal if when set', async () => { - const branch = 'master'; + const branch = 'main'; const status: Partial = { branch, remote: null, @@ -337,7 +337,7 @@ describe('IGitExtension', () => { { is_current_branch: true, is_remote_branch: false, - name: 'master', + name: 'main', upstream: null, top_commit: '52263564aac988a0888060becc3c76d1023e680f', tag: null @@ -354,7 +354,7 @@ describe('IGitExtension', () => { current_branch: { is_current_branch: true, is_remote_branch: false, - name: 'master', + name: 'main', upstream: null, top_commit: '52263564aac988a0888060becc3c76d1023e680f', tag: null diff --git a/src/__tests__/test-components/BranchMenu.spec.tsx b/src/__tests__/test-components/BranchMenu.spec.tsx index a82bede15..6fd5b9d16 100644 --- a/src/__tests__/test-components/BranchMenu.spec.tsx +++ b/src/__tests__/test-components/BranchMenu.spec.tsx @@ -23,7 +23,7 @@ const BRANCHES = [ { is_current_branch: true, is_remote_branch: false, - name: 'master', + name: 'main', upstream: '', top_commit: '', tag: '' @@ -194,7 +194,7 @@ describe('BranchMenu', () => { { is_current_branch: false, is_remote_branch: false, - name: 'master', + name: 'main', upstream: '', top_commit: '', tag: '' @@ -202,7 +202,7 @@ describe('BranchMenu', () => { { is_current_branch: false, is_remote_branch: true, - name: 'master', + name: 'main', upstream: '', top_commit: '', tag: '' @@ -251,7 +251,7 @@ describe('BranchMenu', () => { }); const spy = jest.spyOn(GitExtension.prototype, 'deleteBranch'); - const branchName = 'master'; + const branchName = 'main'; const menu = mount( { }); it('should call merge branch when clicked on the merge button', async () => { - const branchName = 'master'; + const branchName = 'main'; const fakeExecutioner = jest.fn(); const menu = mount( diff --git a/src/__tests__/test-components/Toolbar.spec.tsx b/src/__tests__/test-components/Toolbar.spec.tsx index ecf9b6d51..88fab43ef 100644 --- a/src/__tests__/test-components/Toolbar.spec.tsx +++ b/src/__tests__/test-components/Toolbar.spec.tsx @@ -29,20 +29,20 @@ describe('Toolbar', () => { function createProps(props?: Partial): IToolbarProps { return { - currentBranch: 'master', + currentBranch: 'main', branches: [ { is_current_branch: true, is_remote_branch: false, - name: 'master', - upstream: 'origin/master', + name: 'main', + upstream: 'origin/main', top_commit: '', tag: '' }, { is_current_branch: false, is_remote_branch: true, - name: 'origin/master', + name: 'origin/main', upstream: '', top_commit: '', tag: '' @@ -193,7 +193,7 @@ describe('Toolbar', () => { }); it('should set the `title` attribute on the button to toggle a branch menu', () => { - const currentBranch = 'master'; + const currentBranch = 'main'; const toolbar = shallow( ); @@ -251,7 +251,7 @@ describe('Toolbar', () => { { is_current_branch: true, is_remote_branch: false, - name: 'master', + name: 'main', upstream: '', top_commit: '', tag: '' @@ -304,7 +304,7 @@ describe('Toolbar', () => { { is_current_branch: true, is_remote_branch: false, - name: 'master', + name: 'main', upstream: '', top_commit: '', tag: '' diff --git a/src/components/GitPanel.tsx b/src/components/GitPanel.tsx index 3d2070c54..77b33568b 100644 --- a/src/components/GitPanel.tsx +++ b/src/components/GitPanel.tsx @@ -178,7 +178,7 @@ export class GitPanel extends React.Component { this.state = { branches: branches, - currentBranch: currentBranch ? currentBranch.name : 'master', + currentBranch: currentBranch ? currentBranch.name : 'main', files: [], remoteChangedFiles: [], nCommitsAhead: 0, @@ -265,7 +265,7 @@ export class GitPanel extends React.Component { const { currentBranch } = this.props.model; this.setState({ - currentBranch: currentBranch ? currentBranch.name : 'master', + currentBranch: currentBranch ? currentBranch.name : 'main', referenceCommit: null, challengerCommit: null }); diff --git a/src/components/NewBranchDialog.tsx b/src/components/NewBranchDialog.tsx index 1594c59cc..e78a51e83 100644 --- a/src/components/NewBranchDialog.tsx +++ b/src/components/NewBranchDialog.tsx @@ -240,7 +240,7 @@ export class NewBranchDialog extends React.Component< itemKey={(index, data) => data[index].name} itemSize={index => { const branch = branches[index]; - return [this.props.currentBranch, 'master', 'main'].includes( + return [this.props.currentBranch, 'main', 'main'].includes( branch.name ) ? CURRENT_BRANCH_HEIGHT @@ -268,9 +268,9 @@ export class NewBranchDialog extends React.Component< } else if (b.name === current) { return 1; } - if (a.name === 'master') { + if (a.name === 'main') { return -1; - } else if (b.name === 'master') { + } else if (b.name === 'main') { return 1; } if (a.name === 'main') { @@ -302,7 +302,7 @@ export class NewBranchDialog extends React.Component< desc = this.props.trans.__( 'The current branch. Pick this if you want to build on work done in this branch.' ); - } else if (['master', 'main'].includes(branch.name)) { + } else if (['main', 'main'].includes(branch.name)) { isBold = true; desc = this.props.trans.__( 'The default branch. Pick this if you want to start fresh from the default branch.' diff --git a/ui-tests/README.md b/ui-tests/README.md index a0542e8cc..2fdfb037d 100644 --- a/ui-tests/README.md +++ b/ui-tests/README.md @@ -3,7 +3,7 @@ This folder contains the integration tests of the extension. They are defined using [Playwright](https://playwright.dev/docs/intro) test runner -and [Galata](https://github.com/jupyterlab/jupyterlab/tree/master/galata) helper. +and [Galata](https://github.com/jupyterlab/jupyterlab/tree/main/galata) helper. The Playwright configuration is defined in [playwright.config.js](./playwright.config.js). diff --git a/ui-tests/tests/git-stash.spec.ts b/ui-tests/tests/git-stash.spec.ts index d4f54dd04..9d056cf13 100644 --- a/ui-tests/tests/git-stash.spec.ts +++ b/ui-tests/tests/git-stash.spec.ts @@ -48,7 +48,7 @@ test.describe('Git Stash Commands', () => { // Click drop stash on the first item const dropFirstStashBtn = await page .locator('span') - .filter({ hasText: 'notebook stash (on master)' }) + .filter({ hasText: 'notebook stash (on main)' }) .getByRole('button', { name: 'Drop stash entry' }); await dropFirstStashBtn.click(); @@ -139,7 +139,7 @@ test.describe('Git Stash Commands', () => { await expect.soft(await numberOfStashes.innerText()).toBe('(3)'); // check that our stash message showed up properly await expect - .soft(await page.getByText('some stash message (on master)')) + .soft(await page.getByText('some stash message (on main)')) .toBeTruthy(); await page.waitForTimeout(100); // Check that the stash removed the old text disappears @@ -164,12 +164,12 @@ test.describe('Git Stash Commands', () => { await page.getByText('Stash(2)').click(); await page .locator('span') - .filter({ hasText: 'stashy stash (on master)' }) + .filter({ hasText: 'stashy stash (on main)' }) .hover(); const applyStashBtn = await page .locator('span') - .filter({ hasText: 'stashy stash (on master)' }) + .filter({ hasText: 'stashy stash (on main)' }) .getByRole('button', { name: 'Apply stash entry' }); await applyStashBtn.click(); @@ -221,12 +221,12 @@ test.describe('Git Stash Commands', () => { await page .locator('span') - .filter({ hasText: 'stashy stash (on master)' }) + .filter({ hasText: 'stashy stash (on main)' }) .hover(); const popStashBtn = await page .locator('span') - .filter({ hasText: 'stashy stash (on master)' }) + .filter({ hasText: 'stashy stash (on main)' }) .getByRole('button', { name: 'Pop stash entry' }); await popStashBtn.click(); From e4a0000b65b441a266914a4fc3660bca38c94da7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20Collonval?= Date: Mon, 24 Jul 2023 14:24:03 +0200 Subject: [PATCH 2/4] Remove unneeded await --- ui-tests/tests/merge-commit.spec.ts | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/ui-tests/tests/merge-commit.spec.ts b/ui-tests/tests/merge-commit.spec.ts index 83b8adfa4..b625f067f 100644 --- a/ui-tests/tests/merge-commit.spec.ts +++ b/ui-tests/tests/merge-commit.spec.ts @@ -25,23 +25,23 @@ test.describe('Merge commit tests', () => { test('should correctly display num files changed, insertions, and deletions', async ({ page }) => { - const mergeCommit = await page.getByText("Merge branch 'sort-names'"); + const mergeCommit = page.getByText("Merge branch 'sort-names'"); await mergeCommit.click(); - const filesChanged = await mergeCommit.getByTitle('# Files Changed'); - const insertions = await mergeCommit.getByTitle('# Insertions'); - const deletions = await mergeCommit.getByTitle('# Deletions'); + const filesChanged = mergeCommit.getByTitle('# Files Changed'); + const insertions = mergeCommit.getByTitle('# Insertions'); + const deletions = mergeCommit.getByTitle('# Deletions'); await filesChanged.waitFor(); - await expect(await filesChanged.innerText()).toBe('3'); - await expect(await insertions.innerText()).toBe('18240'); - await expect(await deletions.innerText()).toBe('18239'); + expect(await filesChanged.innerText()).toBe('3'); + expect(await insertions.innerText()).toBe('18240'); + expect(await deletions.innerText()).toBe('18239'); }); test('should correctly display files changed', async ({ page }) => { - const mergeCommit = await page.getByText("Merge branch 'sort-names'"); + const mergeCommit = page.getByText("Merge branch 'sort-names'"); await mergeCommit.click(); @@ -57,7 +57,7 @@ test.describe('Merge commit tests', () => { }); test('should diff file after clicking', async ({ page }) => { - const mergeCommit = await page.getByText("Merge branch 'sort-names'"); + const mergeCommit = page.getByText("Merge branch 'sort-names'"); await mergeCommit.click(); @@ -82,7 +82,7 @@ test.describe('Merge commit tests', () => { const dialog = await page.getByRole('dialog'); await dialog.waitFor({ state: 'visible' }); - await expect(dialog).toBeTruthy(); + expect(dialog).toBeTruthy(); await dialog.getByRole('button', { name: 'Submit' }).click(); await dialog.waitFor({ state: 'detached' }); From 57003e849ec9a42c09e9f74a1271476c772d7c4c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20Collonval?= Date: Wed, 26 Jul 2023 10:18:04 +0200 Subject: [PATCH 3/4] More integration tests fixes --- ui-tests/tests/git-stash.spec.ts | 12 ++++++------ ui-tests/tests/merge-commit.spec.ts | 6 +++--- 2 files changed, 9 insertions(+), 9 deletions(-) diff --git a/ui-tests/tests/git-stash.spec.ts b/ui-tests/tests/git-stash.spec.ts index 9d056cf13..d4f54dd04 100644 --- a/ui-tests/tests/git-stash.spec.ts +++ b/ui-tests/tests/git-stash.spec.ts @@ -48,7 +48,7 @@ test.describe('Git Stash Commands', () => { // Click drop stash on the first item const dropFirstStashBtn = await page .locator('span') - .filter({ hasText: 'notebook stash (on main)' }) + .filter({ hasText: 'notebook stash (on master)' }) .getByRole('button', { name: 'Drop stash entry' }); await dropFirstStashBtn.click(); @@ -139,7 +139,7 @@ test.describe('Git Stash Commands', () => { await expect.soft(await numberOfStashes.innerText()).toBe('(3)'); // check that our stash message showed up properly await expect - .soft(await page.getByText('some stash message (on main)')) + .soft(await page.getByText('some stash message (on master)')) .toBeTruthy(); await page.waitForTimeout(100); // Check that the stash removed the old text disappears @@ -164,12 +164,12 @@ test.describe('Git Stash Commands', () => { await page.getByText('Stash(2)').click(); await page .locator('span') - .filter({ hasText: 'stashy stash (on main)' }) + .filter({ hasText: 'stashy stash (on master)' }) .hover(); const applyStashBtn = await page .locator('span') - .filter({ hasText: 'stashy stash (on main)' }) + .filter({ hasText: 'stashy stash (on master)' }) .getByRole('button', { name: 'Apply stash entry' }); await applyStashBtn.click(); @@ -221,12 +221,12 @@ test.describe('Git Stash Commands', () => { await page .locator('span') - .filter({ hasText: 'stashy stash (on main)' }) + .filter({ hasText: 'stashy stash (on master)' }) .hover(); const popStashBtn = await page .locator('span') - .filter({ hasText: 'stashy stash (on main)' }) + .filter({ hasText: 'stashy stash (on master)' }) .getByRole('button', { name: 'Pop stash entry' }); await popStashBtn.click(); diff --git a/ui-tests/tests/merge-commit.spec.ts b/ui-tests/tests/merge-commit.spec.ts index b625f067f..dc49c3539 100644 --- a/ui-tests/tests/merge-commit.spec.ts +++ b/ui-tests/tests/merge-commit.spec.ts @@ -72,14 +72,14 @@ test.describe('Merge commit tests', () => { }); test('should revert merge commit', async ({ page }) => { - const mergeCommit = await page.getByText("Merge branch 'sort-names'"); + const mergeCommit = page.getByText("Merge branch 'sort-names'", { exact: true }); await mergeCommit.click(); await page .getByRole('button', { name: 'Revert changes introduced by this commit' }) .click(); - const dialog = await page.getByRole('dialog'); + const dialog = page.getByRole('dialog'); await dialog.waitFor({ state: 'visible' }); expect(dialog).toBeTruthy(); @@ -87,7 +87,7 @@ test.describe('Merge commit tests', () => { await dialog.getByRole('button', { name: 'Submit' }).click(); await dialog.waitFor({ state: 'detached' }); - const revertMergeCommit = await page + const revertMergeCommit = page .locator('#jp-git-sessions') .getByText("Revert 'Merge branch 'sort-names''"); From 3aedba338ab51d3632025a8f0986b31c4ed0a450 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20Collonval?= Date: Wed, 26 Jul 2023 14:24:53 +0200 Subject: [PATCH 4/4] Lint the code --- ui-tests/tests/merge-commit.spec.ts | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/ui-tests/tests/merge-commit.spec.ts b/ui-tests/tests/merge-commit.spec.ts index dc49c3539..624114661 100644 --- a/ui-tests/tests/merge-commit.spec.ts +++ b/ui-tests/tests/merge-commit.spec.ts @@ -72,7 +72,9 @@ test.describe('Merge commit tests', () => { }); test('should revert merge commit', async ({ page }) => { - const mergeCommit = page.getByText("Merge branch 'sort-names'", { exact: true }); + const mergeCommit = page.getByText("Merge branch 'sort-names'", { + exact: true + }); await mergeCommit.click(); await page