Skip to content

Commit

Permalink
Fix rendering issue for multiple APIRules (kyma-project#1069)
Browse files Browse the repository at this point in the history
* Fix host link when multiple APIRules exist

* Add release notes

* Update release notes

* Add retries to reduce flakiness of tests

* Make tests more reliable by using scrollIntoView

* Fix scrolling issue with APIRule name

* Make host in APIRules only a text field to have more reliable rendering and less UI logic

* Remove unused code

---------

Co-authored-by: Marek Kołodziejczak <[email protected]>
  • Loading branch information
2 people authored and nataliasitko committed May 27, 2024
1 parent 949396a commit cc63347
Show file tree
Hide file tree
Showing 7 changed files with 35 additions and 37 deletions.
2 changes: 1 addition & 1 deletion config/ui-extensions/apirules/dataSources
Original file line number Diff line number Diff line change
Expand Up @@ -15,4 +15,4 @@ virtualServices:
group: networking.istio.io
version: v1beta1
namespace: null
filter: '$item.metadata.labels."apirule.gateway.kyma-project.io/v1beta1" = $root.metadata.name & "." & $root.metadata.namespace'
filter: '$item.metadata.labels."apirule.gateway.kyma-project.io/v1beta1" = $root.metadata.name & "." & $root.metadata.namespace'
2 changes: 0 additions & 2 deletions config/ui-extensions/apirules/list
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
- name: host
widget: ExternalLink
source: spec.host
link: 'status.APIRuleStatus.code = "OK" ? "https://" & $virtualServices().items[0].spec.hosts[0] : ""'
- name: service-name
source: '$string(spec.service.name) ? ($string(spec.service.name) & " (port: " & $string(spec.service.port) & ")") : ""'
widget: ResourceLink
Expand Down
4 changes: 4 additions & 0 deletions docs/release-notes/2.4.0.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,3 +2,7 @@

- Change Ory Oathkeeper's scaling to be based only on CPU utilization. This adjustment ensures that the scaling is more responsive to traffic changes, as Oathkeeper memory utilization is not a good indicator of the traffic load.
- Introduce APIRule in version `v1beta2` [#996](https://github.com/kyma-project/api-gateway/pull/996)

## Bug Fixes

- Fix rendering of APIRule list when multiple APIRules exist [#1069](https://github.com/kyma-project/api-gateway/pull/1069)
2 changes: 1 addition & 1 deletion tests/ui/tests/cypress.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -35,5 +35,5 @@ module.exports = defineConfig({
},
retries: {
runMode: 2,
}
},
});
2 changes: 1 addition & 1 deletion tests/ui/tests/support/commands.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ declare global {
filterWithNoValue(): Chainable<JQuery>
inputClearAndType(selector: string, newValue: string): void
hasStatusLabel(status: Status): void
hasTableRowWithLink(hrefValue: string): void
hasTableRowNumberContaining(row: number, value: string): void
}
}
}
8 changes: 4 additions & 4 deletions tests/ui/tests/support/list.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,8 @@ Cypress.Commands.add('clickGenericListLink', (resourceName: string) : void => {
.click();
});

Cypress.Commands.add('hasTableRowWithLink', (hrefValue: string) : void => {
cy.get('ui5-table-row')
.find('ui5-link')
.should('have.attr', 'href', hrefValue)
Cypress.Commands.add('hasTableRowNumberContaining', (row: number, value: string) : void => {
cy.get(`ui5-table-row[slot="default-${row}"]`)
.contains(value)
.should('be.visible')
});
52 changes: 24 additions & 28 deletions tests/ui/tests/tests/api-rule.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -137,6 +137,30 @@ context("API Rule", () => {
cy.contains('https://trusted.com').should('exist');
});

it("should display multiple rules are in the list", () => {

cy.createApiRule({
name: apiRuleName,
namespace: namespaceName,
service: serviceName,
host: apiRuleName,
handler: "no_auth",
});

const secondApiRuleName = `${apiRuleName}-second`
cy.createApiRule({
name: secondApiRuleName,
namespace: namespaceName,
service: serviceName,
host: secondApiRuleName,
handler: "no_auth",
});

cy.navigateToApiRuleList(namespaceName);
cy.hasTableRowNumberContaining(1, apiRuleName);
cy.hasTableRowNumberContaining(2, secondApiRuleName);
});

it('should update CORS policy', () => {

cy.createApiRule({
Expand Down Expand Up @@ -202,20 +226,6 @@ context("API Rule", () => {

context("Host", () => {
context("when APIRule is in OK state", () => {
it('should build correct link in list view', () => {
cy.createApiRule({
name: apiRuleName,
namespace: namespaceName,
service: serviceName,
host: apiRuleName,
handler: "no_auth",
});

cy.navigateToApiRuleList(namespaceName);

cy.hasTableRowWithLink(`https://${apiRuleName}.local.kyma.dev`);

});

it('should build correct link in details view', () => {
cy.createApiRule({
Expand All @@ -233,20 +243,6 @@ context("API Rule", () => {
})

context("when APIRule is not in OK state", () => {
it('should have dummy link in list view', () => {
cy.createApiRule({
name: apiRuleName,
namespace: namespaceName,
service: "not_existent",
host: apiRuleName,
handler: "no_auth",
});

cy.navigateToApiRuleList(namespaceName);

cy.hasTableRowWithLink(`https://${apiRuleName}`);

});

it('should have dummy link in details view', () => {
cy.createApiRule({
Expand Down

0 comments on commit cc63347

Please sign in to comment.