diff --git a/cypress/CYPRESS.md b/cypress/CYPRESS.md index 859ddc08d1..b18caae5d8 100644 --- a/cypress/CYPRESS.md +++ b/cypress/CYPRESS.md @@ -28,7 +28,6 @@ End-to-End tests for our project are located in the `cypress/e2e` directory. The - Each test should be independent and capable of running on its own without relying on the state created by previous tests. - Ideally, tests should not rely on a previously created resource, and whenever possible, the test should create the resources it needs. - - There are several tests using `Global Organization` and `Global Project` that are created as part of the `login` process. This should be avoided whenever possible, as it was identified as a possible source of flakiness in the tests. - Create the resources in the test itself or in a `before` block, and clean them up in an `after` block. - If certain resources were created during deployment, those should not be deleted as part of the test runs. - Avoid tests that require execution in a specific order. diff --git a/cypress/support/auth.ts b/cypress/support/auth.ts index 04d28ff165..80d4fbda0c 100644 --- a/cypress/support/auth.ts +++ b/cypress/support/auth.ts @@ -19,8 +19,6 @@ Cypress.Commands.add('login', () => { switch (devBaseUrlPort) { case '4101': cy.awxLogin(); - cy.createGlobalOrganization(); - cy.createGlobalProject(); break; case '4102': cy.hubLogin(); diff --git a/cypress/support/awx-commands.ts b/cypress/support/awx-commands.ts index 936f02c4e1..3351254e80 100644 --- a/cypress/support/awx-commands.ts +++ b/cypress/support/awx-commands.ts @@ -1355,50 +1355,6 @@ Cypress.Commands.add('cancelJob', (job: Job) => { cy.requestPost(`${job.url}cancel/`, {}); }); -const GLOBAL_PROJECT_NAME = 'Global Project'; -const GLOBAL_PROJECT_DESCRIPTION = 'Global Read Only Project for E2E tests'; -const GLOBAL_PROJECT_SCM_URL = 'https://github.com/ansible/ansible-ui'; -const GLOBAL_ORG_NAME = 'Global Platform Level Organization'; -const GLOBAL_ORG_DESCRIPTION = 'DO NOT DELETE: Global Organization'; - -/** Create a global organization if it doesn't exist. */ -Cypress.Commands.add('createGlobalOrganization', function () { - cy.requestGet>(awxAPI`/organizations?name=${GLOBAL_ORG_NAME}`) - .its('results') - .then((orgResults: Organization[]) => { - if (orgResults.length === 0) { - cy.requestPost, Partial>( - awxAPI`/organizations/`, - { name: GLOBAL_ORG_NAME, description: GLOBAL_ORG_DESCRIPTION } - ); - cy.wait(100).then(() => cy.createGlobalOrganization()); - } else { - cy.wrap(orgResults[0]).as('globalAwxOrganization'); - } - }); -}); - -/** Create a global project if it doesn't exist. */ -Cypress.Commands.add('createGlobalProject', function () { - const globalAwxOrganization = this.globalAwxOrganization as Organization; - cy.requestGet>(awxAPI`/projects?name=${GLOBAL_PROJECT_NAME}`) - .its('results') - .then((projectResults: Project[]) => { - if (projectResults.length === 0) { - cy.requestPost, Partial>(awxAPI`/projects/`, { - name: GLOBAL_PROJECT_NAME, - description: GLOBAL_PROJECT_DESCRIPTION, - organization: globalAwxOrganization.id, - scm_type: 'git', - scm_url: GLOBAL_PROJECT_SCM_URL, - }); - cy.wait(100).then(() => cy.createGlobalProject()); - } else { - cy.wrap(projectResults[0]).as('globalProject'); - } - }); -}); - Cypress.Commands.add( 'createCustomAWXApplicationFromUI', ( diff --git a/cypress/support/commands.d.ts b/cypress/support/commands.d.ts index cf841724dd..72697c614f 100644 --- a/cypress/support/commands.d.ts +++ b/cypress/support/commands.d.ts @@ -909,8 +909,6 @@ declare global { ): Chainable; createAwxInstance(hostname: string, listener_port?: number): Chainable; createAwxLabel(label: Partial>): Chainable