Skip to content

Commit

Permalink
add extra constant for downstream test (#3037)
Browse files Browse the repository at this point in the history
  • Loading branch information
appuk authored Aug 22, 2024
1 parent 672e838 commit 4127233
Showing 1 changed file with 44 additions and 0 deletions.
44 changes: 44 additions & 0 deletions cypress/support/constants.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,11 @@ import { EdaCredential } from '../../frontend/eda/interfaces/EdaCredential';
import { EdaDecisionEnvironment } from '../../frontend/eda/interfaces/EdaDecisionEnvironment';
import { EdaProject } from '../../frontend/eda/interfaces/EdaProject';
import { EdaRulebookActivation } from '../../frontend/eda/interfaces/EdaRulebookActivation';
import { Repository } from '../../frontend/hub/administration/repositories/Repository';
import { HubNamespace } from '../../frontend/hub/namespaces/HubNamespace';
import { HubRemote } from '../../frontend/hub/administration/remotes/Remotes';
import { randomString } from '../../framework/utils/random-string';
import { ContentTypeEnum } from '../../frontend/hub/interfaces/expanded/ContentType';

export enum SERVER_NAME {
AWX_SERVER = 'AWX Ansible Server',
Expand Down Expand Up @@ -57,3 +62,42 @@ export const user_team_access_tab_resources: AccessTabResource[] = [
role: 'Eda Credential Admin',
},
];

const testSignature: string = randomString(5, undefined, { isLowercase: true });
function generateRemoteName(): string {
return `test-${testSignature}-remote-${randomString(5, undefined, { isLowercase: true })}`;
}

type ResourceObjectHub = HubNamespace | Repository | HubRemote;

export interface HubResource {
name: string;
creation: (() => Cypress.Chainable<ResourceObjectHub>) | null;
deletion: ((resourceObjectHub: ResourceObjectHub) => Cypress.Chainable<void>) | null;
content_type: ContentTypeEnum;
permission: string;
}

export const hub_resources_roles_tab: HubResource[] = [
{
name: 'Repository',
creation: () => cy.createHubRepository() as Cypress.Chainable<ResourceObjectHub>,
deletion: (resourceObjectHub) => cy.deleteHubRepository(resourceObjectHub as Repository),
content_type: ContentTypeEnum.Repository,
permission: 'galaxy.view_ansiblerepository',
},
{
name: 'Remote',
creation: () => cy.createRemote(generateRemoteName()) as Cypress.Chainable<ResourceObjectHub>,
deletion: null,
content_type: ContentTypeEnum.CollectionRemote,
permission: 'galaxy.view_collectionremote',
},
{
name: 'Namespace',
creation: () => cy.createHubNamespace() as Cypress.Chainable<ResourceObjectHub>,
deletion: (resourceObject) => cy.deleteHubNamespace(resourceObject as HubNamespace),
content_type: ContentTypeEnum.Namespace,
permission: 'galaxy.view_namespace',
},
];

0 comments on commit 4127233

Please sign in to comment.