Skip to content

Commit

Permalink
Revert: "chore: test that SDK respects alias (#710)" (#717)
Browse files Browse the repository at this point in the history
This reverts commit b86ee28.
  • Loading branch information
loweisz authored May 18, 2021
1 parent c23185a commit 4ab6e48
Show file tree
Hide file tree
Showing 7 changed files with 2 additions and 98 deletions.
46 changes: 0 additions & 46 deletions test/cypress/integration/entry-editor-aliased.spec.ts

This file was deleted.

9 changes: 0 additions & 9 deletions test/cypress/utils/paths.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,16 +2,11 @@ import { role } from './role'

const activeSpaceId = Cypress.env('activeSpaceId')
const activeEnvironmentId = Cypress.env('activeEnvironmentId')
const activeAliasId = Cypress.env('activeAliasId')

export function entriesList() {
return `/spaces/${activeSpaceId}/environments/${activeEnvironmentId}/entries`
}

export function entriesListAliased() {
return `/spaces/${activeSpaceId}/environments/${activeAliasId}/entries`
}

export function pageExtensionMaster(extensionId: string) {
return `/spaces/${activeSpaceId}/extensions/${extensionId}`
}
Expand All @@ -24,10 +19,6 @@ export function entry(id: string) {
return `${entriesList()}/${id}`
}

export function entryAliased(id: string) {
return `${entriesListAliased()}/${id}`
}

export function assetsList() {
return `/spaces/${activeSpaceId}/environments/${activeEnvironmentId}/assets`
}
Expand Down
17 changes: 1 addition & 16 deletions test/integration/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@ import {
} from './tasks/create-configuration-files'
import createEnvironment from './tasks/create-new-environment'
import deleteEnvironment from './tasks/delete-new-environment'
import deleteEnvironmentAlias from './tasks/delete-new-environment-alias'
import deleteStaleEnvironments from './tasks/delete-stale-environments'
import deployExtensions from './tasks/deploy-extensions'
import runCypress from './tasks/run-cypress'
Expand Down Expand Up @@ -47,18 +46,9 @@ function listAllEnvironmentVariables() {
}

let tempEnvironmentId: any
let tempAliasId: any
const tempEntries: { environmentId: string; entryId: string }[] = []

const cleanup = async () => {
if (tempAliasId) {
try {
await asyncRetry(() => deleteEnvironmentAlias(tempAliasId), { retries: 3 })
} catch (e) {
console.log(e)
throw new Error('Failed to remove environment alias')
}
}
if (tempEnvironmentId) {
try {
await asyncRetry(() => deleteEnvironment(tempEnvironmentId), { retries: 3 })
Expand Down Expand Up @@ -87,14 +77,12 @@ const run = async () => {
}

try {
const { environmentId, aliasId } = await asyncRetry(
tempEnvironmentId = await asyncRetry(
() => {
return createEnvironment()
},
{ retries: 3 }
)
tempEnvironmentId = environmentId
tempAliasId = aliasId
} catch (e) {
console.log(e)
throw new Error('Failed to create a new environment')
Expand All @@ -114,7 +102,6 @@ const run = async () => {
environmentId: tempEnvironmentId,
role: 'admin',
entries: entryIds,
aliasId: tempAliasId,
})
await runCypress('admin')

Expand All @@ -125,7 +112,6 @@ const run = async () => {
environmentId: tempEnvironmentId,
role: 'editor',
entries: entryIds,
aliasId: tempAliasId,
})
await runCypress('editor', true)

Expand All @@ -141,7 +127,6 @@ const run = async () => {
environmentId: 'master-test',
role: 'editorMasterOnly',
entries: newEntryIds,
aliasId: tempAliasId,
})
await runCypress('editorMasterOnly', true)
}
Expand Down
2 changes: 0 additions & 2 deletions test/integration/local.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@ const config = {
spaceId: process.env.CONTENTFUL_SPACE_ID!,
baseUrl: process.env.CONTENTFUL_APP!,
environmentId: process.env.CONTENTFUL_LOCAL_TESTING_ENV!,
aliasId: process.env.CONTENTFUL_LOCAL_TESTING_ALIAS!,
testLocalSdk: process.env.TEST_LOCAL_SDK === 'true',
}

Expand Down Expand Up @@ -60,7 +59,6 @@ async function run() {
managementToken: config.managementToken,
spaceId: config.spaceId,
environmentId: config.environmentId,
aliasId: config.aliasId,
role: 'admin',
entries: entryIds,
})
Expand Down
3 changes: 0 additions & 3 deletions test/integration/tasks/create-configuration-files.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,21 +6,18 @@ export async function createCypressConfiguration({
environmentId,
role,
entries,
aliasId,
}: {
managementToken: string
spaceId: string
environmentId: string
role: string
entries: Record<string, string>
aliasId: string
}) {
printStepTitle(`${role}: Creating Cypress configuration based on environment variables`)
writeJSONFile(resolvePath('cypress.env.json'), {
managementToken,
activeSpaceId: spaceId,
activeEnvironmentId: environmentId,
activeAliasId: aliasId,
role,
entries,
})
Expand Down
7 changes: 1 addition & 6 deletions test/integration/tasks/create-new-environment.ts
Original file line number Diff line number Diff line change
Expand Up @@ -33,10 +33,5 @@ export default async () => {

console.log(`New "${environmentId}" environment is created`)

const aliasId = nanoid()
const alias = (await space.createEnvironmentAliasWithId(aliasId, { environment })) as any

console.log(`New "${aliasId}" alias is created`)

return { environmentId, aliasId: alias.sys.id }
return environmentId
}
16 changes: 0 additions & 16 deletions test/integration/tasks/delete-new-environment-alias.ts

This file was deleted.

0 comments on commit 4ab6e48

Please sign in to comment.