Skip to content

Commit

Permalink
fix test errors, dataset as part of Product yaml, positive assertion …
Browse files Browse the repository at this point in the history
…for request access button
  • Loading branch information
Elson9 committed Apr 11, 2024
1 parent 6977b0f commit 265f282
Show file tree
Hide file tree
Showing 6 changed files with 24 additions and 21 deletions.
5 changes: 3 additions & 2 deletions e2e/cypress/fixtures/tthidden-jwt.yml
Original file line number Diff line number Diff line change
Expand Up @@ -67,12 +67,13 @@ record_publish_date: '2021-05-27'
---
kind: Product
name: Two Tiered Hidden Product
appId: 'KFH78YU956RE'
appId: 'LFH78YU956RE'
dataset: two-tier-service-dataset
environments:
- name: dev
active: true
approval: false
flow: kong-api-key-acl
appId: '406CB7CF'
appId: '506CB7CF'
services: [two-tier-service-dev]

5 changes: 3 additions & 2 deletions e2e/cypress/fixtures/tthidden-key-auth.yml
Original file line number Diff line number Diff line change
Expand Up @@ -51,11 +51,12 @@ record_publish_date: '2021-05-27'
---
kind: Product
name: Two Tiered Hidden Product
appId: 'KFH78YU956RE'
appId: 'LFH78YU956RE'
dataset: two-tier-service-dataset
environments:
- name: dev
active: true
approval: false
flow: kong-api-key-acl
appId: '406CB7CF'
appId: '506CB7CF'
services: [two-tier-service-dev]
7 changes: 6 additions & 1 deletion e2e/cypress/pageObjects/apiDirectory.ts
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,12 @@ class ApiDirectoryPage {
checkTwoTieredIcon(productName: string) {

This comment has been minimized.

Copy link
@rustyjux

rustyjux Apr 12, 2024

Contributor

This command is no longer used but it looks like things are tee'd up to use it to check the two-tiered non-hidden case.

const pname: string = productName.toLowerCase().replaceAll(' ', '-')
var ele: string = `[data-testid=two-tiered-icon-${pname}]`
cy.get(ele).should('not.exist')
cy.get(ele).should('exist')
}

checkTwoTieredHiddenButton() {
var ele: string = '[data-testid=request-access-button-two-tiered-hidden]'
cy.get(ele).should('exist')
}

addOrganizationAndOrgUnit(product: any) {
Expand Down
19 changes: 4 additions & 15 deletions e2e/cypress/tests/09-update-product-env/09-two-tiered-hidden.cy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -77,21 +77,13 @@ describe('Verify Two Tiered Hidden', () => {
})
})

it('set the Dataset for the Product', () => {
cy.visit(pd.path)
cy.get('@apiowner').then(({ twoTieredHidden }: any) => {
pd.updateDatasetNameToCatelogue(twoTieredHidden.product.name, twoTieredHidden.product.environment.name)
})
})

it('Verify that product is formatted correctly in public directory', () => {
cy.visit(apiDir.path)
cy.get('@apiowner').then(({ twoTieredHidden }: any) => {
let product = twoTieredHidden.product
apiDir.selectProduct(product.serviceName)
cy.get(apiDir.rqstAccessBtn).should('exist')
apiDir.checkProductIcon(product.name, 'RiEarthFill')
apiDir.checkTwoTieredIcon(product.name)
apiDir.checkTwoTieredHiddenButton()
})
})

Expand All @@ -101,9 +93,8 @@ describe('Verify Two Tiered Hidden', () => {
cy.get('@apiowner').then(({ twoTieredHidden }: any) => {
let product = twoTieredHidden.product
apiDir.selectProduct(product.serviceName)
cy.get(apiDir.rqstAccessBtn).should('exist')
apiDir.checkProductIcon(product.name, 'RiEarthFill')
apiDir.checkTwoTieredIcon(product.name)
apiDir.checkTwoTieredHiddenButton()
})
})

Expand All @@ -118,9 +109,8 @@ describe('Verify Two Tiered Hidden', () => {
cy.get('@apiowner').then(({ twoTieredHidden }: any) => {
let product = twoTieredHidden.product
apiDir.selectProduct(product.serviceName)
cy.get(apiDir.rqstAccessBtn).should('exist')
apiDir.checkProductIcon(product.name, 'RiEarthFill')
apiDir.checkTwoTieredIcon(product.name)
apiDir.checkTwoTieredHiddenButton()
})
})

Expand All @@ -130,9 +120,8 @@ describe('Verify Two Tiered Hidden', () => {
cy.get('@apiowner').then(({ twoTieredHidden }: any) => {
let product = twoTieredHidden.product
apiDir.selectProduct(product.serviceName)
cy.get(apiDir.rqstAccessBtn).should('exist')
apiDir.checkProductIcon(product.name, 'RiEarthFill')
apiDir.checkTwoTieredIcon(product.name)
apiDir.checkTwoTieredHiddenButton()
})
})

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@ interface AccessRequestDialogProps {
preview: boolean;
open?: boolean;
variant?: 'inline' | 'button';
dataTestId?: string;
}

const AccessRequestDialog: React.FC<AccessRequestDialogProps> = ({
Expand All @@ -48,6 +49,7 @@ const AccessRequestDialog: React.FC<AccessRequestDialogProps> = ({
preview,
open,
variant,
dataTestId,
}) => {
const client = useQueryClient();
const auth = useAuth();
Expand Down Expand Up @@ -165,7 +167,7 @@ const AccessRequestDialog: React.FC<AccessRequestDialogProps> = ({
<Button
disabled={disabled}
onClick={onOpen}
data-testid="request-access-button"
data-testid={dataTestId ? dataTestId : "request-access-button"}
variant={isInline ? 'link' : 'primary'}
fontWeight="600"
color="white"
Expand Down
5 changes: 5 additions & 0 deletions src/nextapp/components/api-product-item/api-product-item.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,11 @@ const ApiProductItem: React.FC<ApiProductItemProps> = ({
id={id}
name={data.name}
preview={preview}
dataTestId={
isTieredHidden
? 'request-access-button-two-tiered-hidden'
: 'request-access-button'
}
/>
) : null}
</Flex>
Expand Down

0 comments on commit 265f282

Please sign in to comment.