pull/3097/head
filip mertens 2 years ago committed by Aniket
parent d9d8e58056
commit efbb68d799
  1. 493
      apps/remix-ide-e2e/src/tests/workspace_git.test.ts

@ -8,241 +8,268 @@ module.exports = {
before: function (browser: NightwatchBrowser, done: VoidFunction) { before: function (browser: NightwatchBrowser, done: VoidFunction) {
init(browser, done) init(browser, done)
}, },
'Should add credentials': function (browser: NightwatchBrowser) { 'Should not be able to create GIT without credentials #group1': function (browser: NightwatchBrowser) {
browser browser
.clickLaunchIcon('filePanel')
.click('*[data-id="workspaceCreate"]')
.waitForElementVisible('*[data-id="modalDialogCustomPromptTextCreate"]')
.waitForElementVisible('[data-id="fileSystemModalDialogModalFooter-react"] > button')
.waitForElementVisible({
selector: "//*[@class='text-warning' and contains(.,'You need to set a username')]",
locateStrategy: 'xpath'
})
.waitForElementPresent({
selector: '//*[@data-id="initGitRepository"][@disabled]',
locateStrategy: 'xpath'
})
.execute(function () { document.querySelector('*[data-id="modalDialogCustomPromptTextCreate"]')['value'] = 'workspace_blank' })
.click('select[id="wstemplate"]')
.click('select[id="wstemplate"] option[value=blank]')
.click('[data-id="initGitRepositoryLabel"]')
.waitForElementPresent('[data-id="fileSystemModalDialogModalFooter-react"] .modal-ok')
.execute(function () { (document.querySelector('[data-id="fileSystemModalDialogModalFooter-react"] .modal-ok') as HTMLElement).click() })
.pause(100)
.waitForElementNotPresent('*[data-id="treeViewLitreeViewItem.git"]')
.waitForElementNotVisible('[data-id="workspaceGitPanel"]')
},
'Should add credentials #group1 #group2 #group3': function (browser: NightwatchBrowser) {
browser
.clickLaunchIcon('settings') .clickLaunchIcon('settings')
.setValue('[data-id="settingsTabGithubUsername"]', 'circleci') .setValue('[data-id="settingsTabGithubUsername"]', 'circleci')
.setValue('[data-id="settingsTabGithubEmail"]', 'remix@circleci.com') .setValue('[data-id="settingsTabGithubEmail"]', 'remix@circleci.com')
.click('[data-id="settingsTabSaveGistToken"]') .click('[data-id="settingsTabSaveGistToken"]')
}, },
'Should create and initialize a GIT repository #group1': function (browser: NightwatchBrowser) { 'Should create and initialize a GIT repository #group1': function (browser: NightwatchBrowser) {
browser browser
.clickLaunchIcon('filePanel') .clickLaunchIcon('filePanel')
.waitForElementNotVisible('[data-id="workspaceGitPanel"]') .waitForElementNotVisible('[data-id="workspaceGitPanel"]')
.click('*[data-id="workspaceCreate"]') .click('*[data-id="workspaceCreate"]')
.waitForElementVisible('*[data-id="modalDialogCustomPromptTextCreate"]') .waitForElementVisible('*[data-id="modalDialogCustomPromptTextCreate"]')
.waitForElementVisible('[data-id="fileSystemModalDialogModalFooter-react"] > button') .waitForElementVisible('[data-id="fileSystemModalDialogModalFooter-react"] > button')
// eslint-disable-next-line dot-notation // eslint-disable-next-line dot-notation
.execute(function () { document.querySelector('*[data-id="modalDialogCustomPromptTextCreate"]')['value'] = 'workspace_blank' }) .execute(function () { document.querySelector('*[data-id="modalDialogCustomPromptTextCreate"]')['value'] = 'workspace_blank' })
.click('select[id="wstemplate"]') .click('select[id="wstemplate"]')
.click('select[id="wstemplate"] option[value=blank]') .click('select[id="wstemplate"] option[value=blank]')
.click('[data-id="initGitRepositoryLabel"]') .click('[data-id="initGitRepositoryLabel"]')
.waitForElementPresent('[data-id="fileSystemModalDialogModalFooter-react"] .modal-ok') .waitForElementPresent('[data-id="fileSystemModalDialogModalFooter-react"] .modal-ok')
.execute(function () { (document.querySelector('[data-id="fileSystemModalDialogModalFooter-react"] .modal-ok') as HTMLElement).click() }) .execute(function () { (document.querySelector('[data-id="fileSystemModalDialogModalFooter-react"] .modal-ok') as HTMLElement).click() })
.pause(100) .pause(100)
.waitForElementVisible('[data-id="workspaceGitPanel"]') .waitForElementVisible('[data-id="workspaceGitPanel"]')
.waitForElementContainsText('[data-id="workspaceGitBranchesDropdown"]', 'main') .waitForElementContainsText('[data-id="workspaceGitBranchesDropdown"]', 'main')
}, },
// CLONE REPOSITORY E2E START
'Should clone a repository #group2': function (browser: NightwatchBrowser) {
browser // CLONE REPOSITORY E2E START
.clickLaunchIcon('filePanel')
.useXpath() 'Should clone a repository #group2': function (browser: NightwatchBrowser) {
.click('//*[@id="workspacesMenuDropdown"]/span/i') browser
.waitForElementVisible('//*[@id="workspacesMenuDropdown"]/div/ul/a[5]') .clickLaunchIcon('filePanel')
.click('//*[@id="workspacesMenuDropdown"]/div/ul/a[5]') .useXpath()
.useCss() .click('//*[@id="workspacesMenuDropdown"]/span/i')
.waitForElementVisible('[data-id="fileSystemModalDialogModalBody-react"]') .waitForElementVisible('//*[@id="workspacesMenuDropdown"]/div/ul/a[5]')
.click('[data-id="fileSystemModalDialogModalBody-react"]') .click('//*[@id="workspacesMenuDropdown"]/div/ul/a[5]')
.waitForElementVisible('[data-id="modalDialogCustomPromptTextClone"]') .useCss()
.setValue('[data-id="modalDialogCustomPromptTextClone"]', 'https://github.com/ethereum/awesome-remix') .waitForElementVisible('[data-id="fileSystemModalDialogModalBody-react"]')
.click('[data-id="fileSystem-modal-footer-ok-react"]') .click('[data-id="fileSystemModalDialogModalBody-react"]')
.waitForElementPresent('.fa-spinner') .waitForElementVisible('[data-id="modalDialogCustomPromptTextClone"]')
.pause(5000) .setValue('[data-id="modalDialogCustomPromptTextClone"]', 'https://github.com/ethereum/awesome-remix')
.waitForElementNotPresent('.fa-spinner') .click('[data-id="fileSystem-modal-footer-ok-react"]')
.waitForElementVisible('*[data-id="treeViewLitreeViewItem.git"]') .waitForElementPresent('.fa-spinner')
.waitForElementContainsText('[data-id="workspacesSelect"]', 'awesome-remix') .pause(5000)
}, .waitForElementNotPresent('.fa-spinner')
.waitForElementVisible('*[data-id="treeViewLitreeViewItem.git"]')
'Should display dgit icon for cloned workspace #group2': function (browser: NightwatchBrowser) { .waitForElementContainsText('[data-id="workspacesSelect"]', 'awesome-remix')
browser },
.switchWorkspace('default_workspace')
.waitForElementNotVisible('[data-id="workspacesSelect"] .fa-code-branch') 'Should display dgit icon for cloned workspace #group2': function (browser: NightwatchBrowser) {
.switchWorkspace('awesome-remix') browser
.waitForElementVisible('[data-id="workspacesSelect"] .fa-code-branch') .switchWorkspace('default_workspace')
}, .waitForElementNotVisible('[data-id="workspacesSelect"] .fa-code-branch')
.switchWorkspace('awesome-remix')
'Should display non-clashing names for duplicate clone #group2': '' + function (browser: NightwatchBrowser) { .waitForElementVisible('[data-id="workspacesSelect"] .fa-code-branch')
browser },
.useXpath()
.click('//*[@id="workspacesMenuDropdown"]/span/i') 'Should display non-clashing names for duplicate clone #group2': '' + function (browser: NightwatchBrowser) {
.waitForElementVisible('//*[@id="workspacesMenuDropdown"]/div/ul/a[5]') browser
.click('//*[@id="workspacesMenuDropdown"]/div/ul/a[5]') .useXpath()
.useCss() .click('//*[@id="workspacesMenuDropdown"]/span/i')
.waitForElementVisible('[data-id="fileSystemModalDialogModalBody-react"]') .waitForElementVisible('//*[@id="workspacesMenuDropdown"]/div/ul/a[5]')
.click('[data-id="fileSystemModalDialogModalBody-react"]') .click('//*[@id="workspacesMenuDropdown"]/div/ul/a[5]')
.waitForElementVisible('[data-id="modalDialogCustomPromptTextClone"]') .useCss()
.setValue('[data-id="modalDialogCustomPromptTextClone"]', 'https://github.com/ethereum/awesome-remix') .waitForElementVisible('[data-id="fileSystemModalDialogModalBody-react"]')
.click('[data-id="fileSystem-modal-footer-ok-react"]') .click('[data-id="fileSystemModalDialogModalBody-react"]')
.pause(5000) .waitForElementVisible('[data-id="modalDialogCustomPromptTextClone"]')
.waitForElementContainsText('[data-id="workspacesSelect"]', 'awesome-remix1') .setValue('[data-id="modalDialogCustomPromptTextClone"]', 'https://github.com/ethereum/awesome-remix')
.useXpath() .click('[data-id="fileSystem-modal-footer-ok-react"]')
.click('//*[@id="workspacesMenuDropdown"]/span/i') .pause(5000)
.waitForElementVisible('//*[@id="workspacesMenuDropdown"]/div/ul/a[5]') .waitForElementContainsText('[data-id="workspacesSelect"]', 'awesome-remix1')
.click('//*[@id="workspacesMenuDropdown"]/div/ul/a[5]') .useXpath()
.useCss() .click('//*[@id="workspacesMenuDropdown"]/span/i')
.waitForElementVisible('[data-id="fileSystemModalDialogModalBody-react"]') .waitForElementVisible('//*[@id="workspacesMenuDropdown"]/div/ul/a[5]')
.click('[data-id="fileSystemModalDialogModalBody-react"]') .click('//*[@id="workspacesMenuDropdown"]/div/ul/a[5]')
.waitForElementVisible('[data-id="modalDialogCustomPromptTextClone"]') .useCss()
.setValue('[data-id="modalDialogCustomPromptTextClone"]', 'https://github.com/ethereum/awesome-remix') .waitForElementVisible('[data-id="fileSystemModalDialogModalBody-react"]')
.click('[data-id="fileSystem-modal-footer-ok-react"]') .click('[data-id="fileSystemModalDialogModalBody-react"]')
.pause(5000) .waitForElementVisible('[data-id="modalDialogCustomPromptTextClone"]')
.waitForElementContainsText('[data-id="workspacesSelect"]', 'awesome-remix2') .setValue('[data-id="modalDialogCustomPromptTextClone"]', 'https://github.com/ethereum/awesome-remix')
.useXpath() .click('[data-id="fileSystem-modal-footer-ok-react"]')
.click('//*[@id="workspacesMenuDropdown"]/span/i') .pause(5000)
.waitForElementVisible('//*[@id="workspacesMenuDropdown"]/div/ul/a[5]') .waitForElementContainsText('[data-id="workspacesSelect"]', 'awesome-remix2')
.useCss() .useXpath()
.waitForElementVisible('[data-id="fileSystemModalDialogModalBody-react"]') .click('//*[@id="workspacesMenuDropdown"]/span/i')
.click('[data-id="fileSystemModalDialogModalBody-react"]') .waitForElementVisible('//*[@id="workspacesMenuDropdown"]/div/ul/a[5]')
.waitForElementVisible('[data-id="modalDialogCustomPromptTextClone"]') .useCss()
.setValue('[data-id="modalDialogCustomPromptTextClone"]', 'https://github.com/ethereum/awesome-remix') .waitForElementVisible('[data-id="fileSystemModalDialogModalBody-react"]')
.click('[data-id="fileSystem-modal-footer-ok-react"]') .click('[data-id="fileSystemModalDialogModalBody-react"]')
.pause(5000) .waitForElementVisible('[data-id="modalDialogCustomPromptTextClone"]')
.waitForElementContainsText('[data-id="workspacesSelect"]', 'awesome-remix3') .setValue('[data-id="modalDialogCustomPromptTextClone"]', 'https://github.com/ethereum/awesome-remix')
.switchWorkspace('awesome-remix') .click('[data-id="fileSystem-modal-footer-ok-react"]')
.switchWorkspace('awesome-remix1') .pause(5000)
.switchWorkspace('awesome-remix2') .waitForElementContainsText('[data-id="workspacesSelect"]', 'awesome-remix3')
.switchWorkspace('awesome-remix3') .switchWorkspace('awesome-remix')
}, .switchWorkspace('awesome-remix1')
.switchWorkspace('awesome-remix2')
'Should display error message in modal for failed clone #group2': function (browser: NightwatchBrowser) { .switchWorkspace('awesome-remix3')
browser },
.useXpath()
.waitForElementPresent({ 'Should display error message in modal for failed clone #group2': function (browser: NightwatchBrowser) {
selector: '//i[@data-icon="workspaceDropdownMenuIcon"]', browser
locateStrategy: 'xpath', .useXpath()
}) .waitForElementPresent({
.click('//*[@id="workspacesMenuDropdown"]/span/i') selector: '//i[@data-icon="workspaceDropdownMenuIcon"]',
.waitForElementVisible('//*[@id="workspacesMenuDropdown"]/div/ul/a[5]') locateStrategy: 'xpath',
.click('//*[@id="workspacesMenuDropdown"]/div/ul/a[5]') })
.useCss() .click('//*[@id="workspacesMenuDropdown"]/span/i')
.waitForElementVisible('[data-id="fileSystemModalDialogModalBody-react"]') .waitForElementVisible('//*[@id="workspacesMenuDropdown"]/div/ul/a[5]')
.click('[data-id="fileSystemModalDialogModalBody-react"]') .click('//*[@id="workspacesMenuDropdown"]/div/ul/a[5]')
.waitForElementVisible('[data-id="modalDialogCustomPromptTextClone"]') .useCss()
.setValue('[data-id="modalDialogCustomPromptTextClone"]', 'https://github.com/ethereum/non-existent-repo') .waitForElementVisible('[data-id="fileSystemModalDialogModalBody-react"]')
.click('[data-id="fileSystem-modal-footer-ok-react"]') .click('[data-id="fileSystemModalDialogModalBody-react"]')
.pause(5000) .waitForElementVisible('[data-id="modalDialogCustomPromptTextClone"]')
.waitForElementVisible('[data-id="cloneGitRepositoryModalDialogModalBody-react"]') .setValue('[data-id="modalDialogCustomPromptTextClone"]', 'https://github.com/ethereum/non-existent-repo')
.waitForElementContainsText('[data-id="cloneGitRepositoryModalDialogModalBody-react"]', 'An error occurred: Please check that you have the correct URL for the repo. If the repo is private, you need to add your github credentials (with the valid token permissions) in Settings plugin') .click('[data-id="fileSystem-modal-footer-ok-react"]')
.click('[data-id="cloneGitRepository-modal-footer-ok-react"]') .pause(5000)
}, .waitForElementVisible('[data-id="cloneGitRepositoryModalDialogModalBody-react"]')
.waitForElementContainsText('[data-id="cloneGitRepositoryModalDialogModalBody-react"]', 'An error occurred: Please check that you have the correct URL for the repo. If the repo is private, you need to add your github credentials (with the valid token permissions) in Settings plugin')
// CLONE REPOSITORY E2E END .click('[data-id="cloneGitRepository-modal-footer-ok-react"]')
},
// GIT BRANCHES E2E START
'Should show all cloned repo branches #group3': function (browser: NightwatchBrowser) { // CLONE REPOSITORY E2E END
browser
.clickLaunchIcon('filePanel') // GIT BRANCHES E2E START
.waitForElementNotVisible('[data-id="workspaceGitPanel"]') 'Should show all cloned repo branches #group3': function (browser: NightwatchBrowser) {
.useXpath() browser
.click('//*[@id="workspacesMenuDropdown"]/span/i') .clickLaunchIcon('filePanel')
.waitForElementVisible('//*[@id="workspacesMenuDropdown"]/div/ul/a[5]') .waitForElementNotVisible('[data-id="workspaceGitPanel"]')
.click('//*[@id="workspacesMenuDropdown"]/div/ul/a[5]') .useXpath()
.useCss() .click('//*[@id="workspacesMenuDropdown"]/span/i')
.waitForElementVisible('[data-id="fileSystemModalDialogModalBody-react"]') .waitForElementVisible('//*[@id="workspacesMenuDropdown"]/div/ul/a[5]')
.click('[data-id="fileSystemModalDialogModalBody-react"]') .click('//*[@id="workspacesMenuDropdown"]/div/ul/a[5]')
.waitForElementVisible('[data-id="modalDialogCustomPromptTextClone"]') .useCss()
.setValue('[data-id="modalDialogCustomPromptTextClone"]', 'https://github.com/ioedeveloper/test-branch-change') .waitForElementVisible('[data-id="fileSystemModalDialogModalBody-react"]')
.click('[data-id="fileSystem-modal-footer-ok-react"]') .click('[data-id="fileSystemModalDialogModalBody-react"]')
.waitForElementPresent('.fa-spinner') .waitForElementVisible('[data-id="modalDialogCustomPromptTextClone"]')
.pause(5000) .setValue('[data-id="modalDialogCustomPromptTextClone"]', 'https://github.com/ioedeveloper/test-branch-change')
.waitForElementNotPresent('.fa-spinner') .click('[data-id="fileSystem-modal-footer-ok-react"]')
.waitForElementContainsText('[data-id="workspacesSelect"]', 'test-branch-change') .waitForElementPresent('.fa-spinner')
.waitForElementVisible('[data-id="workspaceGitPanel"]') .pause(5000)
.click('[data-id="workspaceGitBranchesDropdown"]') .waitForElementNotPresent('.fa-spinner')
.waitForElementVisible('[data-id="custom-dropdown-menu"]') .waitForElementContainsText('[data-id="workspacesSelect"]', 'test-branch-change')
.waitForElementContainsText('[data-id="custom-dropdown-items"]', 'origin/dev') .waitForElementVisible('[data-id="workspaceGitPanel"]')
.waitForElementContainsText('[data-id="custom-dropdown-items"]', 'origin/production') .click('[data-id="workspaceGitBranchesDropdown"]')
.waitForElementContainsText('[data-id="custom-dropdown-items"]', 'origin/setup') .waitForElementVisible('[data-id="custom-dropdown-menu"]')
.expect.element('[data-id="workspaceGit-main"]').text.to.contain('✓ ') .waitForElementContainsText('[data-id="custom-dropdown-items"]', 'origin/dev')
}, .waitForElementContainsText('[data-id="custom-dropdown-items"]', 'origin/production')
.waitForElementContainsText('[data-id="custom-dropdown-items"]', 'origin/setup')
'Should a checkout to a remote branch #group3': function (browser: NightwatchBrowser) { .expect.element('[data-id="workspaceGit-main"]').text.to.contain('✓ ')
browser },
.waitForElementVisible('[data-id="custom-dropdown-menu"]')
.waitForElementContainsText('[data-id="custom-dropdown-items"]', 'origin/dev') 'Should a checkout to a remote branch #group3': function (browser: NightwatchBrowser) {
.waitForElementPresent('[data-id="workspaceGit-origin/dev"]') browser
.click('[data-id="workspaceGit-origin/dev"]') .waitForElementVisible('[data-id="custom-dropdown-menu"]')
.pause(5000) .waitForElementContainsText('[data-id="custom-dropdown-items"]', 'origin/dev')
.waitForElementPresent('[data-id="treeViewDivtreeViewItemdev.ts"]') .waitForElementPresent('[data-id="workspaceGit-origin/dev"]')
.click('[data-id="workspaceGitBranchesDropdown"]') .click('[data-id="workspaceGit-origin/dev"]')
.expect.element('[data-id="workspaceGit-dev"]').text.to.contain('✓ ') .pause(5000)
}, .waitForElementPresent('[data-id="treeViewDivtreeViewItemdev.ts"]')
.click('[data-id="workspaceGitBranchesDropdown"]')
'Should search for a branch (local and remote) #group3': function (browser: NightwatchBrowser) { .expect.element('[data-id="workspaceGit-dev"]').text.to.contain('✓ ')
browser },
.waitForElementVisible('[data-id="custom-dropdown-menu"]')
.waitForElementPresent('[data-id="workspaceGitInput"]') 'Should search for a branch (local and remote) #group3': function (browser: NightwatchBrowser) {
.sendKeys('[data-id="workspaceGitInput"]', 'setup') browser
.waitForElementNotPresent('[data-id="workspaceGit-origin/dev"]') .waitForElementVisible('[data-id="custom-dropdown-menu"]')
.waitForElementNotPresent('[data-id="workspaceGit-origin/production"]') .waitForElementPresent('[data-id="workspaceGitInput"]')
.waitForElementNotPresent('[data-id="workspaceGit-dev"]') .sendKeys('[data-id="workspaceGitInput"]', 'setup')
.waitForElementNotPresent('[data-id="workspaceGit-main"]') .waitForElementNotPresent('[data-id="workspaceGit-origin/dev"]')
.waitForElementPresent('[data-id="workspaceGit-origin/setup"]') .waitForElementNotPresent('[data-id="workspaceGit-origin/production"]')
}, .waitForElementNotPresent('[data-id="workspaceGit-dev"]')
.waitForElementNotPresent('[data-id="workspaceGit-main"]')
'Should checkout to a new local branch #group3': function (browser: NightwatchBrowser) { .waitForElementPresent('[data-id="workspaceGit-origin/setup"]')
browser },
.waitForElementVisible('[data-id="custom-dropdown-menu"]')
.waitForElementPresent('[data-id="workspaceGitInput"]') 'Should checkout to a new local branch #group3': function (browser: NightwatchBrowser) {
.clearValue('[data-id="workspaceGitInput"]') browser
.sendKeys('[data-id="workspaceGitInput"]', 'newLocalBranch') .waitForElementVisible('[data-id="custom-dropdown-menu"]')
.waitForElementContainsText('[data-id="workspaceGitCreateNewBranch"]', `Create branch: newLocalBranch from 'dev'`) .waitForElementPresent('[data-id="workspaceGitInput"]')
.click('[data-id="workspaceGitCreateNewBranch"]') .clearValue('[data-id="workspaceGitInput"]')
.pause(2000) .sendKeys('[data-id="workspaceGitInput"]', 'newLocalBranch')
.click('[data-id="workspaceGitBranchesDropdown"]') .waitForElementContainsText('[data-id="workspaceGitCreateNewBranch"]', `Create branch: newLocalBranch from 'dev'`)
.waitForElementVisible('[data-id="custom-dropdown-menu"]') .click('[data-id="workspaceGitCreateNewBranch"]')
.expect.element('[data-id="workspaceGit-newLocalBranch"]').text.to.contain('✓ ') .pause(2000)
}, .click('[data-id="workspaceGitBranchesDropdown"]')
.waitForElementVisible('[data-id="custom-dropdown-menu"]')
'Should checkout to an exisiting local branch #group3': function (browser: NightwatchBrowser) { .expect.element('[data-id="workspaceGit-newLocalBranch"]').text.to.contain('✓ ')
browser },
.waitForElementVisible('[data-id="custom-dropdown-menu"]')
.waitForElementPresent('[data-id="workspaceGitInput"]') 'Should checkout to an exisiting local branch #group3': function (browser: NightwatchBrowser) {
.clearValue('[data-id="workspaceGitInput"]') browser
.sendKeys('[data-id="workspaceGitInput"]', [browser.Keys.SPACE, browser.Keys.BACK_SPACE]) .waitForElementVisible('[data-id="custom-dropdown-menu"]')
.waitForElementPresent('[data-id="workspaceGit-main"]') .waitForElementPresent('[data-id="workspaceGitInput"]')
.click('[data-id="workspaceGit-main"]') .clearValue('[data-id="workspaceGitInput"]')
.pause(2000) .sendKeys('[data-id="workspaceGitInput"]', [browser.Keys.SPACE, browser.Keys.BACK_SPACE])
.waitForElementNotPresent('[data-id="treeViewDivtreeViewItemdev.ts"]') .waitForElementPresent('[data-id="workspaceGit-main"]')
.waitForElementPresent('[data-id="treeViewDivtreeViewItemmain.ts"]') .click('[data-id="workspaceGit-main"]')
.click('[data-id="workspaceGitBranchesDropdown"]') .pause(2000)
.expect.element('[data-id="workspaceGit-main"]').text.to.contain('✓ ') .waitForElementNotPresent('[data-id="treeViewDivtreeViewItemdev.ts"]')
}, .waitForElementPresent('[data-id="treeViewDivtreeViewItemmain.ts"]')
.click('[data-id="workspaceGitBranchesDropdown"]')
'Should prevent checkout to a branch if local changes exists #group3': function (browser: NightwatchBrowser) { .expect.element('[data-id="workspaceGit-main"]').text.to.contain('✓ ')
browser },
.renamePath('README.md', 'README.txt', 'README.txt')
.waitForElementVisible('[data-id="workspaceGitBranchesDropdown"]') 'Should prevent checkout to a branch if local changes exists #group3': function (browser: NightwatchBrowser) {
.click('[data-id="workspaceGitBranchesDropdown"]') browser
.waitForElementVisible('[data-id="workspaceGit-dev"]') .renamePath('README.md', 'README.txt', 'README.txt')
.click('[data-id="workspaceGit-dev"]') .waitForElementVisible('[data-id="workspaceGitBranchesDropdown"]')
.waitForElementVisible('[data-id="switchBranchModalDialogContainer-react"]') .click('[data-id="workspaceGitBranchesDropdown"]')
.waitForElementContainsText('[data-id="switchBranchModalDialogModalBody-react"]', 'Your local changes to the following files would be overwritten by checkout.') .waitForElementVisible('[data-id="workspaceGit-dev"]')
.click('[data-id="switchBranchModalDialogModalFooter-react"]') .click('[data-id="workspaceGit-dev"]')
.click('[data-id="switchBranch-modal-footer-cancel-react"]') .waitForElementVisible('[data-id="switchBranchModalDialogContainer-react"]')
.pause(2000) .waitForElementContainsText('[data-id="switchBranchModalDialogModalBody-react"]', 'Your local changes to the following files would be overwritten by checkout.')
.click('[data-id="workspaceGitBranchesDropdown"]') .click('[data-id="switchBranchModalDialogModalFooter-react"]')
.expect.element('[data-id="workspaceGit-main"]').text.to.contain('✓ ') .click('[data-id="switchBranch-modal-footer-cancel-react"]')
}, .pause(2000)
.click('[data-id="workspaceGitBranchesDropdown"]')
'Should force checkout to a branch with exisiting local changes #group3': function (browser: NightwatchBrowser) { .expect.element('[data-id="workspaceGit-main"]').text.to.contain('✓ ')
browser },
.waitForElementVisible('[data-id="workspaceGit-dev"]')
.click('[data-id="workspaceGit-dev"]') 'Should force checkout to a branch with exisiting local changes #group3': function (browser: NightwatchBrowser) {
.waitForElementVisible('[data-id="switchBranchModalDialogContainer-react"]') browser
.waitForElementContainsText('[data-id="switchBranchModalDialogModalBody-react"]', 'Your local changes to the following files would be overwritten by checkout.') .waitForElementVisible('[data-id="workspaceGit-dev"]')
.click('[data-id="switchBranchModalDialogModalFooter-react"]') .click('[data-id="workspaceGit-dev"]')
.click('[data-id="switchBranch-modal-footer-ok-react"]') .waitForElementVisible('[data-id="switchBranchModalDialogContainer-react"]')
.pause(2000) .waitForElementContainsText('[data-id="switchBranchModalDialogModalBody-react"]', 'Your local changes to the following files would be overwritten by checkout.')
.click('[data-id="workspaceGitBranchesDropdown"]') .click('[data-id="switchBranchModalDialogModalFooter-react"]')
.expect.element('[data-id="workspaceGit-dev"]').text.to.contain('✓ ') .click('[data-id="switchBranch-modal-footer-ok-react"]')
}, .pause(2000)
.click('[data-id="workspaceGitBranchesDropdown"]')
// GIT BRANCHES E2E END .expect.element('[data-id="workspaceGit-dev"]').text.to.contain('✓ ')
},
tearDown: sauce
// GIT BRANCHES E2E END
tearDown: sauce
} }
Loading…
Cancel
Save