From d769014d60f82d2ca0ade2a85634d71672dadbbc Mon Sep 17 00:00:00 2001 From: Your Name Date: Sun, 9 Jun 2024 19:04:19 +0200 Subject: [PATCH] branch testing --- .../src/tests/dgit_local.test.ts | 32 +++++++++++++++++++ .../src/components/buttons/commitmessage.tsx | 7 ++-- 2 files changed, 37 insertions(+), 2 deletions(-) diff --git a/apps/remix-ide-e2e/src/tests/dgit_local.test.ts b/apps/remix-ide-e2e/src/tests/dgit_local.test.ts index b4a0973309..ed397b2441 100644 --- a/apps/remix-ide-e2e/src/tests/dgit_local.test.ts +++ b/apps/remix-ide-e2e/src/tests/dgit_local.test.ts @@ -182,9 +182,41 @@ module.exports = { .setValue('*[data-id="newbranchname"]', 'testbranch') .click('*[data-id="sourcecontrol-create-branch"]') .waitForElementVisible('*[data-id="branches-current-branch-testbranch"]') + .pause(1000) + }, + 'publish the branch #group2': function (browser: NightwatchBrowser) { + browser + .waitForElementVisible('*[data-id="sourcecontrol-panel"]') + .click('*[data-id="sourcecontrol-panel"]') + .pause(1000) + .click('*[data-id="publishBranchButton"]') + .pause(2000) + .waitForElementNotVisible('*[data-id="publishBranchButton"]') + }, + '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')) } } +async function getBranches(path: string): Promise { + return new Promise((resolve, reject) => { + const git = spawn('git', ['branch'], { cwd: path }) + let branches = '' + git.stdout.on('data', function (data) { + console.log('stdout git branches', data.toString()) + branches += data.toString() + }) + git.stderr.on('data', function (data) { + console.log('stderr git branches', data.toString()) + reject(data.toString()) + }) + git.on('close', function () { + resolve(branches) + }) + }) +} + async function getGitLog(path: string): Promise { return new Promise((resolve, reject) => { const git = spawn('git', ['log'], { cwd: path }) diff --git a/libs/remix-ui/git/src/components/buttons/commitmessage.tsx b/libs/remix-ui/git/src/components/buttons/commitmessage.tsx index 7f4e26d344..92e25fabc6 100644 --- a/libs/remix-ui/git/src/components/buttons/commitmessage.tsx +++ b/libs/remix-ui/git/src/components/buttons/commitmessage.tsx @@ -86,10 +86,13 @@ export const CommitMessage = () => { remote: getRemote(), ref: context.currentBranch }) - await actions.pull({ + await actions.fetch({ remote: getRemote(), - ref: context.currentBranch + ref: context.currentBranch, + singleBranch: false, + relative: true }) + } const messageEnabled = () => {