Skip to content

Commit

Permalink
Update Test scenarios/specs order and added test for zenhub#887
Browse files Browse the repository at this point in the history
  • Loading branch information
nirajCITZ committed Sep 5, 2023
1 parent 0a5c95b commit ae9be16
Show file tree
Hide file tree
Showing 19 changed files with 276 additions and 270 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/aps-cypress-e2e.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ name: Build and Deploy Cypress and Execute Tests

on:
push:
branches: ['test', 'cypress*']
branches: ['test', 'cypress/*']

env:
DASHBOARD_PROJECT_ID: ${{ secrets.CY_DASHBOARD_PRJ_ID }}
Expand Down
8 changes: 8 additions & 0 deletions e2e/cypress/pageObjects/apiDirectory.ts
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,14 @@ class ApiDirectoryPage {
cy.get(this.submitBtn).click()
}

checkInactiveEnvironmentAccessReqOption(product: any, app: any){
cy.contains('a', product.name, { timeout: 10000 }).should('be.visible');
cy.contains(product.name).click()
cy.get(this.rqstAccessBtn).click()
cy.get(this.appSelect).select(app.name)
cy.get('[data-testid=access-rqst-app-env-' + product.environment + ']').should('not.exist');
}

isProductDisplay(productName: string, expResult: boolean) {
cy.get("button").then(($btn) => {
var flag = true
Expand Down
15 changes: 15 additions & 0 deletions e2e/cypress/pageObjects/authProfile.ts
Original file line number Diff line number Diff line change
Expand Up @@ -165,6 +165,21 @@ class AuthorizationProfile {
cy.contains(issuerURL).should('exist')
cy.visit(this.path)
}

deleteAuthProfile(authProfileName: string) {
cy.wait(2000)
let authProfileText
cy.get(this.profileTable).find('tr').each(($e1, index, $list) => {
authProfileText = $e1.find('td:nth-child(1)').text();
if (authProfileText===authProfileName) {
cy.wrap($e1).find('button').eq(1).click()
cy.wait(2000)
cy.wrap($e1).find('button').last().click({force: true})
cy.verifyToastMessage(authProfileName +' deleted')
return false
}
})
}
}

export default AuthorizationProfile
6 changes: 6 additions & 0 deletions e2e/cypress/pageObjects/myAccess.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ class myAccessPage {
regenerateCredentialCloseBtn: string = '[data-testid=regenerate-credentials-done-button]'
collectCredentialsBtn: string = '[data-testid="generate-credentials-button"]'
clientIDValueTxt: string = '[data-testid="sa-new-creds-client-id"]'
cancelRequestAccessRequest: string = '[data-testid="access-request-cancel-button"]'
path: string = '/devportal/access'


Expand All @@ -37,6 +38,11 @@ class myAccessPage {
cy.get(this.closeRequestAccesss).click()
}

cancelRequestAccessPopUp()
{
cy.get(this.cancelRequestAccessRequest).click()
}

saveReGenAPIKeyValue(): void {
cy.get(this.apiKyeValueTxt).invoke('val').then(($apiKey: any) => {
cy.saveState('newApiKey', $apiKey)
Expand Down
286 changes: 143 additions & 143 deletions e2e/cypress/tests/01-api-key/03-request-access-inactive-env.cy.ts
Original file line number Diff line number Diff line change
@@ -1,143 +1,143 @@
// import ApiDirectoryPage from '../../pageObjects/apiDirectory'
// import ApplicationPage from '../../pageObjects/applications'
// import HomePage from '../../pageObjects/home'
// import LoginPage from '../../pageObjects/login'
// import NamespaceAccessPage from '../../pageObjects/namespaceAccess'
// import Products from '../../pageObjects/products'
// import MyAccessPage from '../../pageObjects/myAccess'

// describe('Change an Active environment to Inactive', () => {
// const login = new LoginPage()
// const home = new HomePage()
// const na = new NamespaceAccessPage()
// const pd = new Products()

// before(() => {
// cy.visit('/')
// cy.deleteAllCookies()
// cy.reload()
// })

// beforeEach(() => {
// cy.preserveCookies()
// cy.fixture('apiowner').as('apiowner')
// // cy.visit(login.path)
// })

// it('authenticates Janis (api owner)', () => {
// cy.get('@apiowner').then(({ user, namespace }: any) => {
// cy.login(user.credentials.username, user.credentials.password)
// cy.log('Logged in!')
// home.useNamespace(namespace)
// })
// })

// it('Navigate to Products Page', () => {
// cy.visit(pd.path)
// })

// it('Change the current active environment to inactive state', () => {
// cy.get('@apiowner').then(({ product }: any) => {
// pd.editProductEnvironment(product.name, product.environment.name)
// pd.editProductEnvironmentConfig(product.environment.config, true)
// })
// })

// after(() => {
// cy.logout()
// cy.clearLocalStorage({ log: true })
// cy.deleteAllCookies()
// })
// })

// describe('Verify enactive environment in rrequest access pop up', () => {
// const apiDir = new ApiDirectoryPage()
// const app = new ApplicationPage()
// const myAccessPage = new MyAccessPage()

// before(() => {
// cy.visit('/')
// cy.deleteAllCookies()
// cy.reload()
// })

// beforeEach(() => {
// cy.preserveCookies()
// cy.fixture('developer').as('developer')
// // cy.visit(login.path)
// })

// it('authenticates Harley (developer)', () => {
// cy.get('@developer').then(({ user }: any) => {
// cy.login(user.credentials.username, user.credentials.password)
// })
// })

// it('creates an application', () => {
// cy.visit(app.path)
// cy.get('@developer').then(({ application }: any) => {
// app.createApplication(application)
// })
// })

// it('Verify that inactive environment is not displayed', () => {
// cy.visit(apiDir.path)
// cy.get('@developer').then(({ product, application }: any) => {
// apiDir.checkInactiveEnvironmentAccessReqOption(product, application)
// })
// })

// it('Close the popup by click on Cancel button', () => {
// myAccessPage.cancelRequestAccessPopUp()
// })

// after(() => {
// cy.logout()
// cy.clearLocalStorage({ log: true })
// cy.deleteAllCookies()
// })
// })

// describe('Change an the environment back to active', () => {
// const login = new LoginPage()
// const home = new HomePage()
// const na = new NamespaceAccessPage()
// const pd = new Products()

// before(() => {
// cy.visit('/')
// cy.deleteAllCookies()
// cy.reload()
// })

// beforeEach(() => {
// cy.preserveCookies()
// cy.fixture('apiowner').as('apiowner')
// // cy.visit(login.path)
// })

// it('authenticates Janis (api owner)', () => {
// cy.get('@apiowner').then(({ user, namespace }: any) => {
// cy.login(user.credentials.username, user.credentials.password)
// cy.log('Logged in!')
// home.useNamespace(namespace)
// })
// })

// it('Navigate to Products Page', () => {
// cy.visit(pd.path)
// })

// it('Change the environment back to active state', () => {
// cy.get('@apiowner').then(({ product }: any) => {
// pd.editProductEnvironment(product.name, product.environment.name)
// pd.editProductEnvironmentConfig(product.environment.config)
// })
// })

// after(() => {
// cy.logout()
// cy.clearLocalStorage({ log: true })
// cy.deleteAllCookies()
// })
// })
import ApiDirectoryPage from '../../pageObjects/apiDirectory'
import ApplicationPage from '../../pageObjects/applications'
import HomePage from '../../pageObjects/home'
import LoginPage from '../../pageObjects/login'
import NamespaceAccessPage from '../../pageObjects/namespaceAccess'
import Products from '../../pageObjects/products'
import MyAccessPage from '../../pageObjects/myAccess'

describe('Change an Active environment to Inactive', () => {
const login = new LoginPage()
const home = new HomePage()
const na = new NamespaceAccessPage()
const pd = new Products()

before(() => {
cy.visit('/')
cy.deleteAllCookies()
cy.reload()
})

beforeEach(() => {
cy.preserveCookies()
cy.fixture('apiowner').as('apiowner')
// cy.visit(login.path)
})

it('authenticates Janis (api owner)', () => {
cy.get('@apiowner').then(({ user, namespace }: any) => {
cy.login(user.credentials.username, user.credentials.password)
cy.log('Logged in!')
home.useNamespace(namespace)
})
})

it('Navigate to Products Page', () => {
cy.visit(pd.path)
})

it('Change the current active environment to inactive state', () => {
cy.get('@apiowner').then(({ product }: any) => {
pd.editProductEnvironment(product.name, product.environment.name)
pd.editProductEnvironmentConfig(product.environment.config, true)
})
})

after(() => {
cy.logout()
cy.clearLocalStorage({ log: true })
cy.deleteAllCookies()
})
})

describe('Verify enactive environment in rrequest access pop up', () => {
const apiDir = new ApiDirectoryPage()
const app = new ApplicationPage()
const myAccessPage = new MyAccessPage()

before(() => {
cy.visit('/')
cy.deleteAllCookies()
cy.reload()
})

beforeEach(() => {
cy.preserveCookies()
cy.fixture('developer').as('developer')
// cy.visit(login.path)
})

it('authenticates Harley (developer)', () => {
cy.get('@developer').then(({ user }: any) => {
cy.login(user.credentials.username, user.credentials.password)
})
})

it('creates an application', () => {
cy.visit(app.path)
cy.get('@developer').then(({ application }: any) => {
app.createApplication(application)
})
})

it('Verify that inactive environment is not displayed', () => {
cy.visit(apiDir.path)
cy.get('@developer').then(({ product, application }: any) => {
apiDir.checkInactiveEnvironmentAccessReqOption(product, application)
})
})

it('Close the popup by click on Cancel button', () => {
myAccessPage.cancelRequestAccessPopUp()
})

after(() => {
cy.logout()
cy.clearLocalStorage({ log: true })
cy.deleteAllCookies()
})
})

describe('Change an the environment back to active', () => {
const login = new LoginPage()
const home = new HomePage()
const na = new NamespaceAccessPage()
const pd = new Products()

before(() => {
cy.visit('/')
cy.deleteAllCookies()
cy.reload()
})

beforeEach(() => {
cy.preserveCookies()
cy.fixture('apiowner').as('apiowner')
// cy.visit(login.path)
})

it('authenticates Janis (api owner)', () => {
cy.get('@apiowner').then(({ user, namespace }: any) => {
cy.login(user.credentials.username, user.credentials.password)
cy.log('Logged in!')
home.useNamespace(namespace)
})
})

it('Navigate to Products Page', () => {
cy.visit(pd.path)
})

it('Change the environment back to active state', () => {
cy.get('@apiowner').then(({ product }: any) => {
pd.editProductEnvironment(product.name, product.environment.name)
pd.editProductEnvironmentConfig(product.environment.config)
})
})

after(() => {
cy.logout()
cy.clearLocalStorage({ log: true })
cy.deleteAllCookies()
})
})
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@ describe('Verify GWA get commands', () => {
it('Verify "gwa get" for dataset', () => {
cy.get('@apiowner').then(({ product }: any) => {
cy.executeCliCommand('gwa get datasets').then((response) => {
debugger
expect(response.stdout).not.to.contain(product);
})
})
Expand Down Expand Up @@ -70,6 +71,7 @@ describe('Verify GWA get commands', () => {
it('Verify "gwa get" for products', () => {
cy.get('@apiowner').then(({ product }: any) => {
cy.executeCliCommand('gwa get products').then((response) => {
debugger
expect(response.stdout).not.to.contain(product);
})
})
Expand Down
Loading

0 comments on commit ae9be16

Please sign in to comment.