Skip to content

Commit

Permalink
update GitServices list
Browse files Browse the repository at this point in the history
  • Loading branch information
SkorikSergey committed Jan 15, 2024
1 parent 02c74bb commit 1fa7c9f
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 18 deletions.
32 changes: 17 additions & 15 deletions tests/e2e/pageobjects/dashboard/UserPreferences.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,13 +14,14 @@ import { By } from 'selenium-webdriver';
import { DriverHelper } from '../../utils/DriverHelper';
import { Logger } from '../../utils/Logger';

enum GitService {
github = 'github',
gitlab='gitlab',
'azure-devops'='azure-devops',
'bitbucket-server-oauth1'='bitbucket-server-oauth1',
'bitbucket-server-oauth2'='bitbucket-server-oauth2'
}
enum GitServices {
GITHUB = 'github',
GITLAB = 'gitlab',
BITBUCKET_SERVER_OAUTH1 = 'bitbucket-server-oauth1',
BITBUCKET_SERVER_OAUTH2 = 'bitbucket-server-oauth2',
BITBUCKET_CLOUD_OAUTH2 = 'bitbucket-org',
AZURE_DEVOPS = 'azure-devops'
}

@injectable()
export class UserPreferences {
Expand Down Expand Up @@ -119,15 +120,16 @@ export class UserPreferences {
await this.driverHelper.waitVisibility(UserPreferences.ADD_NEW_SSH_KEY_BUTTON);
}

async getServiceConfig(service: string): Promise<string> {
const gitService: { [key: string]: string } = {
[GitService.github]: 'GitHub',
[GitService.gitlab]: 'GitLab',
[GitService['azure-devops']]: 'Microsoft Azure DevOps',
[GitService['bitbucket-server-oauth1']]: 'Bitbucket Server',
[GitService['bitbucket-server-oauth2']]: 'Bitbucket Server'
getServiceConfig(service: string): string {
const gitService: { [key: string]: string } = {
[GitServices.GITHUB]: 'GitHub',
[GitServices.GITLAB]: 'GitLab',
[GitServices.AZURE_DEVOPS]: 'Microsoft Azure DevOps',
[GitServices.BITBUCKET_CLOUD_OAUTH2]: 'Bitbucket Cloud',
[GitServices.BITBUCKET_SERVER_OAUTH1]: 'Bitbucket Server',
[GitServices.BITBUCKET_SERVER_OAUTH2]: 'Bitbucket Server'
};

return gitService[service];
}

Expand Down
6 changes: 3 additions & 3 deletions tests/e2e/specs/miscellaneous/RevokeOauth.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ import { LoginTests } from '../../tests-library/LoginTests';
import { UserPreferences } from '../../pageobjects/dashboard/UserPreferences';
import { FACTORY_TEST_CONSTANTS } from '../../constants/FACTORY_TEST_CONSTANTS';

suite(`"Revoke OAuth" test`, function (): void {
suite('"Revoke OAuth" test', function (): void {
const loginTests: LoginTests = e2eContainer.get(CLASSES.LoginTests);
const userPreferences: UserPreferences = e2eContainer.get(CLASSES.UserPreferences);
const gitService: string = FACTORY_TEST_CONSTANTS.TS_SELENIUM_FACTORY_GIT_PROVIDER || 'github';
Expand All @@ -27,8 +27,8 @@ suite(`"Revoke OAuth" test`, function (): void {
await userPreferences.checkTabsAvailability();

await userPreferences.openGitServicesTab();
const selectedService: string = await userPreferences.getServiceConfig(gitService);

const selectedService: string = userPreferences.getServiceConfig(gitService);
await userPreferences.revokeGitService(selectedService);
});
});

0 comments on commit 1fa7c9f

Please sign in to comment.