Skip to content

Commit

Permalink
resolve fails on delete-resources tests
Browse files Browse the repository at this point in the history
  • Loading branch information
rustyjux committed Aug 14, 2024
1 parent 921d936 commit ff77d4a
Show file tree
Hide file tree
Showing 2 changed files with 38 additions and 7 deletions.
1 change: 0 additions & 1 deletion e2e/cypress/tests/01-api-key/00-get-started.cy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,6 @@ describe('Gateway Get Started page', () => {
it('authenticates Janis (api owner) to get the user session token', () => {
cy.getUserSessionTokenValue('', false).then((value) => {
userSession = value
console.log('first user session', userSession)
})
})

Expand Down
44 changes: 38 additions & 6 deletions e2e/cypress/tests/10-clear-resources/05-delete-resources.cy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,16 @@ import NameSpacePage from '../../pageObjects/namespace'
import Products from '../../pageObjects/products'
import ServiceAccountsPage from '../../pageObjects/serviceAccounts'

const cleanedUrl = Cypress.env('BASE_URL').replace(/^http?:\/\//i, "");

describe('Delete created resources', () => {
const login = new LoginPage()
const home = new HomePage()
const sa = new ServiceAccountsPage()
const pd = new Products()
const ns = new NameSpacePage
let flag: boolean
let userSession: any

before(() => {
cy.visit('/')
Expand All @@ -30,6 +33,9 @@ describe('Delete created resources', () => {
cy.get('@common-testdata').then(({ deleteResources }: any) => {
cy.login(user.credentials.username, user.credentials.password)
cy.activateGateway(deleteResources.namespace);
cy.getUserSessionTokenValue(deleteResources.namespace, false).then((value) => {
userSession = value
})
})
})
})
Expand Down Expand Up @@ -57,11 +63,21 @@ describe('Delete created resources', () => {
sa.deleteAllServiceAccounts()
})

it('Delete Namespace', () => {
it('Set token with gwa config command', () => {
cy.exec('gwa config set --token ' + userSession, { timeout: 3000, failOnNonZeroExit: false }).then((response) => {
expect(response.stdout).to.contain("Config settings saved")
});
})

it('Set environment with gwa config command', () => {
cy.executeCliCommand('gwa config set --host ' + cleanedUrl + ' --scheme http').then((response) => {
expect(response.stdout).to.contain("Config settings saved")
});
})

it('Delete Namespace (CLI)', () => {
cy.get('@common-testdata').then(({ deleteResources }: any) => {
cy.visit(ns.detailPath)
ns.deleteNamespace(deleteResources.namespace)
cy.wait(10000)
cy.deleteGatewayCli(deleteResources.namespace, true)
});
});

Expand All @@ -71,14 +87,30 @@ describe('Delete created resources', () => {
cy.wrap(null).then(() => {
return cy.getGateways();
}).then((result) => {
console.log(result);
const namespaceNames = result.map((ns: { name: any }) => ns.name);
console.log(namespaceNames);
expect(namespaceNames).to.not.include(deleteResources.namespace);
});
});
});

it('Verify delete namespace works from the UI', () => {
cy.createGateway().then((response) => {
const namespace = response.gatewayId
cy.log('New namespace created: ' + namespace)
cy.activateGateway(namespace);
cy.visit(ns.detailPath)
ns.deleteNamespace(namespace)

cy.visit('/')
cy.wrap(null).then(() => {
return cy.getGateways();
}).then((result) => {
const namespaceNames = result.map((ns: { name: any }) => ns.name);
expect(namespaceNames).to.not.include(namespace);
});
});
});

after(() => {
cy.logout()

Expand Down

0 comments on commit ff77d4a

Please sign in to comment.