diff --git a/tests/e2e/specs/factory/RefusedOAuthFactory.spec.ts b/tests/e2e/specs/factory/RefusedOAuthFactory.spec.ts index 27967ce3f67..a927ce2b9b9 100644 --- a/tests/e2e/specs/factory/RefusedOAuthFactory.spec.ts +++ b/tests/e2e/specs/factory/RefusedOAuthFactory.spec.ts @@ -16,7 +16,6 @@ import { EditorView, InputBox, Locators, - ModalDialog, NewScmView, SingleScmProvider, TextEditor, @@ -53,6 +52,7 @@ suite( let projectSection: ViewSection; let scmProvider: SingleScmProvider; + let rest: SingleScmProvider[]; let scmContextMenu: ContextMenu; // test specific data @@ -72,13 +72,11 @@ suite( await browserTabsUtil.navigateTo(FACTORY_TEST_CONSTANTS.TS_SELENIUM_FACTORY_URL()); }); - if (OAUTH_CONSTANTS.TS_SELENIUM_GIT_PROVIDER_OAUTH) { - test(`Authorize with a ${FACTORY_TEST_CONSTANTS.TS_SELENIUM_FACTORY_GIT_PROVIDER} OAuth and deny access`, async function (): Promise { - await oauthPage.login(); - await oauthPage.waitOauthPage(); - await oauthPage.denyAccess(); - }); - } + test(`Authorize with a ${FACTORY_TEST_CONSTANTS.TS_SELENIUM_FACTORY_GIT_PROVIDER} OAuth and deny access`, async function (): Promise { + await oauthPage.login(); + await oauthPage.waitOauthPage(); + await oauthPage.denyAccess(); + }); test('Obtain workspace name from workspace loader page', async function (): Promise { await workspaceHandlingTests.obtainWorkspaceNameFromStartingPage(); @@ -96,29 +94,31 @@ suite( await projectAndFileTests.waitWorkspaceReadinessForCheCodeEditor(); }); - test('Check if a project folder has been created', async function (): Promise { - testRepoProjectName = StringUtil.getProjectNameFromGitUrl(FACTORY_TEST_CONSTANTS.TS_SELENIUM_FACTORY_GIT_REPO_URL); - projectSection = await projectAndFileTests.getProjectViewSession(); - expect(await projectAndFileTests.getProjectTreeItem(projectSection, testRepoProjectName), 'Project folder was not imported').not - .undefined; - }); - - test('Accept the project as a trusted one', async function (): Promise { - await projectAndFileTests.performTrustAuthorDialog(); - }); - if (FACTORY_TEST_CONSTANTS.TS_SELENIUM_IS_PRIVATE_FACTORY_GIT_REPO) { - test('Check that project can not be cloned', async function (): Promise { - await driverHelper.waitVisibility(webCheCodeLocators.Dialog.message); - const workspaceDoesNotExistDialog: ModalDialog = new ModalDialog(); - const message: string = await workspaceDoesNotExistDialog.getMessage(); - expect(message).contains('space does not exist'); + test('Check that a project folder has not been cloned', async function (): Promise { + testRepoProjectName = StringUtil.getProjectNameFromGitUrl(FACTORY_TEST_CONSTANTS.TS_SELENIUM_FACTORY_GIT_REPO_URL); + await driverHelper.waitVisibility(webCheCodeLocators.ScmView.multiProviderItem); + await projectAndFileTests.performTrustAuthorDialog(); + const isProjectFolderUnable: string = await driverHelper.waitAndGetElementAttribute( + (webCheCodeLocators.TreeItem as any).projectFolderItem, + 'aria-label' + ); + expect(isProjectFolderUnable).to.contain( + '/projects/' + testRepoProjectName + ' • Unable to resolve workspace folder (Unable to resolve nonexistent file' + ); + }); + } else { + test('Check if a project folder has been created', async function (): Promise { + testRepoProjectName = StringUtil.getProjectNameFromGitUrl(FACTORY_TEST_CONSTANTS.TS_SELENIUM_FACTORY_GIT_REPO_URL); + projectSection = await projectAndFileTests.getProjectViewSession(); + expect(await projectAndFileTests.getProjectTreeItem(projectSection, testRepoProjectName), 'Project folder was not imported') + .not.undefined; }); - test('Check that project files were not imported', async function (): Promise { - expect(await projectAndFileTests.getProjectTreeItem(projectSection, label), 'Project files were found').to.be.undefined; + test('Accept the project as a trusted one', async function (): Promise { + await projectAndFileTests.performTrustAuthorDialog(); }); - } else { + test('Check if the project files were imported', async function (): Promise { expect(await projectAndFileTests.getProjectTreeItem(projectSection, label), 'Project files were not imported').not .undefined; @@ -142,7 +142,6 @@ suite( await sourceControl.openView(); const scmView: NewScmView = new NewScmView(); await driverHelper.waitVisibility(webCheCodeLocators.ScmView.inputField); - let rest: SingleScmProvider[]; [scmProvider, ...rest] = await scmView.getProviders(); Logger.debug(`scmView.getProviders: "${JSON.stringify(scmProvider)}, ${rest}"`); });