-
Notifications
You must be signed in to change notification settings - Fork 7
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #670 from bcgov/dev
Release Login Refresh Shared IdP Org Assignment
- Loading branch information
Showing
234 changed files
with
8,383 additions
and
3,047 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,85 @@ | ||
class GatewayServicePage { | ||
|
||
path: string = '/manager/services' | ||
userNameInput: string = '[data-testid="nsa-gua-email-field"]' | ||
grantUserAccessBtn: string = '[data-testid="nsa-grant-access-btn"]' | ||
serviceTable: string = '[data-testid="matrixDetailsTable"]' | ||
clearAllFilterBtn: string = '[data-testid="btn-filter-clear-all"]' | ||
filterType: string = '[data-testid="filter-type-select"]' | ||
filterValue: string = '[data-testid="consumer-filters-select"]' | ||
filterApplyBtn: string = '[data-testid="btn-filter-apply"]' | ||
|
||
getTestIdEnvName(env: string): string { | ||
switch (env) { | ||
case "Development": | ||
return "dev" | ||
case "Production": | ||
return "prod" | ||
default: | ||
return env.toLowerCase() | ||
} | ||
} | ||
|
||
expandServiceDetails(productName: string, envName: string) { | ||
let pname: string = productName.toLowerCase().replaceAll(' ', '-') | ||
let env = this.getTestIdEnvName(envName); | ||
cy.get(`[data-testid=${pname}-${env}-metrics-details]`).click() | ||
} | ||
|
||
verifyRequestCount(productName: string, envName: string, count: number) { | ||
let pname: string = productName.toLowerCase().replaceAll(' ', '-') | ||
let env = this.getTestIdEnvName(envName); | ||
cy.get(`[data-testid=${pname}-${env}-totalRequest]`).then(($value) => { | ||
let countValue = $value.text() | ||
assert.equal(countValue, count.toString()) | ||
}) | ||
} | ||
|
||
verifyHostName(hostName: string) { | ||
cy.contains('Host').next('dd').then(($value) => { | ||
let hostValue = $value.text() | ||
assert.equal(hostValue, hostName) | ||
}) | ||
} | ||
|
||
verifyTagsName(tagsName: string) { | ||
cy.contains('Tags').next('dd').find('span').then(($value) => { | ||
let hostValue = $value.text() | ||
assert.equal(hostValue, tagsName) | ||
}) | ||
} | ||
|
||
verifyRouteName(service: string, route: string) { | ||
cy.get(`[data-testid^=${service}-service-details`).then(($value) => { | ||
let routeValue = $value.text() | ||
debugger | ||
assert.equal(routeValue, route) | ||
}) | ||
} | ||
|
||
verifyFilterResultsForGatewayService(filterType: string, filterValue: string, expectedResult: string, labelValue?: any) { | ||
cy.wait(2000) | ||
this.filterGatewayServiceByTypeAndValue(filterType, filterValue) | ||
cy.wait(2000) | ||
cy.get(this.serviceTable).find("tbody").find("tr").then((row) => { | ||
expect(row.length.toString()).eq(expectedResult) | ||
if (filterType === 'Environment') { | ||
let environment = row.find('td:nth-child(2)').find('span').text() | ||
assert.equal(environment,filterValue) | ||
} | ||
}) | ||
|
||
} | ||
|
||
filterGatewayServiceByTypeAndValue(type: string, value: string) { | ||
cy.get("body").then($body => { | ||
if ($body.find(this.clearAllFilterBtn).length > 0) { | ||
cy.get(this.clearAllFilterBtn, { timeout: 2000 }).click() | ||
} | ||
}); | ||
cy.get(this.filterType).select(type).invoke('val') | ||
cy.get(this.filterValue).select(value).invoke('val') | ||
cy.get(this.filterApplyBtn).click() | ||
} | ||
} | ||
export default GatewayServicePage |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
72 changes: 72 additions & 0 deletions
72
e2e/cypress/tests/05-gateway-services/01-gateway-service-details-spec.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,72 @@ | ||
import ApiDirectoryPage from '../../pageObjects/apiDirectory' | ||
import GatewayServicePage from '../../pageObjects/gatewayService' | ||
import HomePage from '../../pageObjects/home' | ||
import LoginPage from '../../pageObjects/login' | ||
import MyAccessPage from '../../pageObjects/myAccess' | ||
import NamespaceAccessPage from '../../pageObjects/namespaceAccess' | ||
|
||
describe('Verify Gateway Service details', () => { | ||
const login = new LoginPage() | ||
const apiDir = new ApiDirectoryPage() | ||
const myAccessPage = new MyAccessPage() | ||
const home = new HomePage() | ||
const na = new NamespaceAccessPage() | ||
const gs = new GatewayServicePage() | ||
|
||
before(() => { | ||
cy.visit('/') | ||
cy.deleteAllCookies() | ||
cy.reload() | ||
}) | ||
|
||
beforeEach(() => { | ||
cy.preserveCookies() | ||
cy.fixture('apiowner').as('apiowner') | ||
}) | ||
|
||
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 Gateway Service Page', () => { | ||
cy.intercept('POST', '/gql/api').as('createBoard') | ||
cy.visit(gs.path) | ||
cy.wait(2000) | ||
}) | ||
|
||
it('Expand Gateway service details pane', () => { | ||
cy.get('@apiowner').then(({ product }: any) => { | ||
gs.expandServiceDetails(product.environment.config.serviceName, product.environment.name) | ||
}) | ||
}) | ||
|
||
it('Verify total requests counts', () => { | ||
cy.get('@apiowner').then(({ product }: any) => { | ||
gs.verifyRequestCount(product.environment.config.serviceName, product.environment.name, 0) | ||
}) | ||
}) | ||
|
||
it('Verify the routes details ', () => { | ||
cy.get('@apiowner').then(({ product }: any) => { | ||
gs.verifyRouteName(product.environment.config.serviceName, 'https://a-service-for-newplatform.api.gov.bc.ca/') | ||
}) | ||
}) | ||
|
||
it('Verify the host details ', () => { | ||
gs.verifyHostName('httpbin.org') | ||
}) | ||
|
||
it('Verify the Tags details ', () => { | ||
gs.verifyTagsName('ns.newplatform') | ||
}) | ||
|
||
after(() => { | ||
cy.logout() | ||
cy.clearLocalStorage({ log: true }) | ||
cy.deleteAllCookies() | ||
}) | ||
}) |
44 changes: 44 additions & 0 deletions
44
e2e/cypress/tests/05-gateway-services/02-filter-gateway-service.spec.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
import ConsumersPage from '../../pageObjects/consumers' | ||
import LoginPage from '../../pageObjects/login' | ||
import HomePage from '../../pageObjects/home' | ||
import ProductPage from '../../pageObjects/products' | ||
import GatewayServicePage from '../../pageObjects/gatewayService' | ||
|
||
describe('Filter Gateway Services Spec', () => { | ||
const login = new LoginPage() | ||
const consumers = new ConsumersPage() | ||
const home = new HomePage() | ||
const gs = new GatewayServicePage() | ||
|
||
before(() => { | ||
cy.visit('/') | ||
cy.deleteAllCookies() | ||
cy.reload() | ||
}) | ||
|
||
beforeEach(() => { | ||
cy.preserveCookies() | ||
cy.fixture('apiowner').as('apiowner') | ||
}) | ||
|
||
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 Gateway Service Page', () => { | ||
cy.visit(gs.path) | ||
cy.wait(2000) | ||
}) | ||
|
||
it('verify that Gateway service filters as per given parameter', () => { | ||
cy.get('@apiowner').then(({ product }: any) => { | ||
gs.verifyFilterResultsForGatewayService('Products', product.name, '2') | ||
gs.verifyFilterResultsForGatewayService('Environment', product.environment.name, '1') | ||
gs.verifyFilterResultsForGatewayService('Environment', product.test_environment.name, '1') | ||
}) | ||
}) | ||
}) |
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
Oops, something went wrong.