branch testing

pull/4791/head
Your Name 5 months ago
parent 5de0383552
commit 1af49cb949
  1. 67
      apps/remix-ide-e2e/src/tests/dgit_local.test.ts
  2. 2
      libs/remix-ui/git/src/components/panels/branches.tsx
  3. 2
      libs/remix-ui/git/src/components/panels/branches/branchdifferencedetails.tsx
  4. 4
      libs/remix-ui/git/src/components/panels/branches/localbranchdetails.tsx
  5. 2
      libs/remix-ui/git/src/components/panels/branches/remotebranchedetails.tsx
  6. 2
      libs/remix-ui/git/src/components/panels/commits.tsx
  7. 2
      libs/remix-ui/git/src/components/panels/commits/commitdetailsitem.tsx
  8. 7
      libs/remix-ui/git/src/lib/gitactions.ts

@ -196,6 +196,73 @@ module.exports = {
'check if the branch is published #group2': async function (browser: NightwatchBrowser) {
const branches = await getBranches('/tmp/git/bare.git')
browser.assert.ok(branches.includes('testbranch'))
},
'add file to new branch #group2': function (browser: NightwatchBrowser) {
browser.
addFile('test.txt', { content: 'hello world' }, 'README.md')
.clickLaunchIcon('dgit')
.waitForElementVisible({
selector: "//*[@data-status='new-untracked' and @data-file='/test.txt']",
locateStrategy: 'xpath'
})
.waitForElementVisible('*[data-id="addToGitChangestest.txt"]')
.pause(1000)
.click('*[data-id="addToGitChangestest.txt"]')
.waitForElementVisible({
selector: "//*[@data-status='added-staged' and @data-file='/test.txt']",
locateStrategy: 'xpath'
})
.setValue('*[data-id="commitMessage"]', 'testcommit')
.click('*[data-id="commitButton"]')
.pause(1000)
},
'check if the commit is ahead in the branches list #group2': function (browser: NightwatchBrowser) {
browser
.waitForElementVisible('*[data-id="branches-panel"]')
.click('*[data-id="branches-panel"]')
.waitForElementVisible('*[data-id="branches-current-branch-testbranch"]')
.click({
selector: "//*[@data-id='branches-panel-content']//*[@data-id='branches-current-branch-testbranch']",
locateStrategy: 'xpath',
suppressNotFoundErrors: true
})
.click({
selector: "//*[@data-id='branches-panel-content']//*[@data-id='commits-panel-ahead']",
locateStrategy: 'xpath',
suppressNotFoundErrors: true
})
.click({
selector: "//*[@data-id='branches-panel-content']//*[@data-id='branchdifference-commits-testbranch-ahead']//*[@data-id='commit-summary-testcommit-ahead']",
locateStrategy: 'xpath',
})
.click({
selector: "//*[@data-id='branches-panel-content']//*[@data-id='branchdifference-commits-testbranch-ahead']//*[@data-id='commit-change-added-test.txt']",
locateStrategy: 'xpath',
})
.click({
selector: "//*[@data-id='branches-panel-content']//*[@data-id='local-branch-commits-testbranch']//*[@data-id='commit-summary-testcommit-ahead']",
locateStrategy: 'xpath',
})
.waitForElementVisible({
selector: "//*[@data-id='branches-panel-content']//*[@data-id='local-branch-commits-testbranch']//*[@data-id='commit-change-added-test.txt']",
locateStrategy: 'xpath',
})
},
'switch back to master #group2': function (browser: NightwatchBrowser) {
browser
.click({
selector: "//*[@data-id='branches-panel-content']//*[@data-id='branches-toggle-branch-master']",
locateStrategy: 'xpath',
})
.waitForElementVisible({
selector: "//*[@data-id='branches-panel-content']//*[@data-id='branches-toggle-current-branch-master']",
locateStrategy: 'xpath',
})
},
'check if test file is gone #group2': function (browser: NightwatchBrowser) {
browser
.clickLaunchIcon('filePanel')
.waitForElementNotPresent('*[data-id="treeViewLitreeViewItemtest.txt"]')
}
}

@ -18,7 +18,7 @@ export const Branches = () => {
return (
<>
<div className="pt-1">
<div data-id='branches-panel-content' className="pt-1">
{context.branches && context.branches.length ?
<div>
{context.branches && context.branches.filter((branch, index) => !branch.remote).map((branch, index) => {

@ -36,7 +36,7 @@ export const BranchDifferenceDetails = (props: BrancheDifferenceProps) => {
<Accordion activeKey={activePanel} defaultActiveKey="">
<CommitsNavigation ahead={ahead} behind={behind} branch={branch} remote={remote} title={title} eventKey="0" activePanel={activePanel} callback={setActivePanel} />
<Accordion.Collapse className="pl-2 border-left ml-1" eventKey="0">
<div className="ml-1">
<div data-id={`branchdifference-commits-${branch.name}${ahead?'-ahead':''}${behind?'-behind':''}`} className="ml-1">
{commits && commits.map((commit, index) => {
return (
<CommitDetails branch={branch} getCommitChanges={getCommitChanges} key={index} checkout={()=>{}} commit={commit}></CommitDetails>

@ -68,14 +68,16 @@ export const LocalBranchDetails = (props: BrancheDetailsProps) => {
<>
<div className="ml-1">
<BranchDifferences branch={branch}></BranchDifferences>
<div data-id={`local-branch-commits-${branch && branch.name}`}>
{context.localBranchCommits && Object.entries(context.localBranchCommits).map(([key, value]) => {
if (key == branch.name) {
return value.map((commit, index) => {
return (<CommitDetails branch={branch} key={index} getCommitChanges={getCommitChanges} checkout={checkoutCommit} commit={commit}></CommitDetails>)
})
}
})}
</div>
</div>
{hasNextPage && <GitUIButton className="mb-1 ml-2 btn btn-sm" onClick={loadNextPage}>Load more</GitUIButton>}
</>

@ -92,7 +92,7 @@ export const RemoteBranchDetails = (props: BrancheDetailsProps) => {
<BrancheDetailsNavigation checkout={checkout} branch={branch} eventKey="0" activePanel={activePanel} callback={setActivePanel} />
<Accordion.Collapse className="pl-2 border-left ml-1" eventKey="0">
<>
<div className="ml-1">
<div data-id={`remote-branch-commits-${branch && branch.name}`} className="ml-1">
{context.remoteBranchCommits && Object.entries(context.remoteBranchCommits).map(([key, value]) => {
if (key == branch.name) {
return value.map((page, index) => {

@ -48,7 +48,7 @@ export const Commits = () => {
<>
{context.commits && context.commits.length ?
<><BranchDifferences branch={context.currentBranch}></BranchDifferences><div>
<div className="pt-1">
<div data-id={`commits-current-branch-${context.currentBranch && context.currentBranch.name}`} className="pt-1">
{context.commits && context.commits.map((commit, index) => {
return (
<CommitDetails branch={context.currentBranch} getCommitChanges={getCommitChanges} key={index} checkout={checkout} commit={commit}></CommitDetails>

@ -36,7 +36,7 @@ export const CommitDetailsItems = (props: CCommitDetailsItemsProps) => {
</>)
}
return (<>
<div data-id={`commit-change-${path.basename(commitChange.path)}`} className={`d-flex w-100 d-flex flex-row commitdetailsitem ${isAheadOfRepo ? 'text-success' : ''}`}>
<div data-id={`commit-change-${commitChange.type}-${path.basename(commitChange.path)}`} className={`d-flex w-100 d-flex flex-row commitdetailsitem ${isAheadOfRepo ? 'text-success' : ''}`}>
<div className='pointer gitfile long-and-truncated' onClick={async () => await openChanges(commitChange)}>
<span className='font-weight-bold long-and-truncated'>{path.basename(commitChange.path)}</span>
<div className='text-secondary long-and-truncated'> {commitChange.path}</div>

@ -748,9 +748,16 @@ export const fetchBranch = async (branch: branch, page: number) => {
if (page == 1) {
dispatch(resetRemoteBranchCommits({ branch }))
}
try {
const { owner, repo } = await getRepoDetails(branch.remote.url);
const rc = await plugin.call('dgitApi', 'remotecommits', { token, owner: owner, repo: repo, branch: branch.name, length, page });
dispatch(setRemoteBranchCommits({ branch, commits: rc }))
} catch (e) {
sendToGitLog({
type: 'error',
message: `Error fetching remote commits: ${e.message}`
})
}
return
}

Loading…
Cancel
Save