Skip to content

Commit

Permalink
Revert config request on loading list page
Browse files Browse the repository at this point in the history
  • Loading branch information
ferhoyos committed Sep 9, 2024
1 parent 1089174 commit 5fe65e0
Show file tree
Hide file tree
Showing 3 changed files with 37 additions and 39 deletions.
54 changes: 28 additions & 26 deletions plugin/cypress/integration/kiali/common/istio_config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -224,25 +224,26 @@ Given('a {string} AuthorizationPolicy in the {string} namespace', function (name
this.targetAuthorizationPolicy = name;
});

Given(
'a {string} AuthorizationPolicy in the {string} namespace in the {string} cluster',
function (name: string, namespace: string, cluster: string) {
let cluster_context;
if (cluster === 'west') {
cluster_context = CLUSTER2_CONTEXT;
} else {
cluster_context = CLUSTER1_CONTEXT;
}
Given('a {string} AuthorizationPolicy in the {string} namespace in the {string} cluster', function (
name: string,
namespace: string,
cluster: string
) {
let cluster_context;
if (cluster === 'west') {
cluster_context = CLUSTER2_CONTEXT;
} else {
cluster_context = CLUSTER1_CONTEXT;
}

cy.exec(`kubectl delete AuthorizationPolicy ${name} -n ${namespace} --context ${cluster_context}`, {
failOnNonZeroExit: false
});
cy.exec(`echo '${minimalAuthorizationPolicy(name, namespace)}' | kubectl apply --context ${cluster_context} -f -`);
cy.exec(`kubectl delete AuthorizationPolicy ${name} -n ${namespace} --context ${cluster_context}`, {
failOnNonZeroExit: false
});
cy.exec(`echo '${minimalAuthorizationPolicy(name, namespace)}' | kubectl apply --context ${cluster_context} -f -`);

this.targetNamespace = namespace;
this.targetAuthorizationPolicy = name;
}
);
this.targetNamespace = namespace;
this.targetAuthorizationPolicy = name;
});

Given('the AuthorizationPolicy has a from-source rule for {string} namespace', function (namespace: string) {
cy.exec(
Expand All @@ -268,16 +269,17 @@ Given('the AuthorizationPolicy has a to-operation rule with {string} host', func
);
});

Given(
'a {string} DestinationRule in the {string} namespace for {string} host',
function (name: string, namespace: string, host: string) {
cy.exec(`kubectl delete DestinationRule ${name} -n ${namespace}`, { failOnNonZeroExit: false });
cy.exec(`echo '${minimalDestinationRule(name, namespace, host)}' | kubectl apply -f -`);
Given('a {string} DestinationRule in the {string} namespace for {string} host', function (
name: string,
namespace: string,
host: string
) {
cy.exec(`kubectl delete DestinationRule ${name} -n ${namespace}`, { failOnNonZeroExit: false });
cy.exec(`echo '${minimalDestinationRule(name, namespace, host)}' | kubectl apply -f -`);

this.targetNamespace = namespace;
this.targetDestinationRule = name;
}
);
this.targetNamespace = namespace;
this.targetDestinationRule = name;
});

Given('the DestinationRule has a {string} subset for {string} labels', function (subset: string, labels: string) {
cy.exec(
Expand Down
20 changes: 8 additions & 12 deletions plugin/cypress/integration/kiali/common/navigation.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,20 +10,16 @@ enum detailType {

Given('user is at the {string} list page', (page: string) => {
// enable toggles on the list pages so that they can be tested
// cy.intercept(`**/api/config`, request => {
// request.reply(response => {
// response.body['kialiFeatureFlags']['uiDefaults']['list']['showIncludeToggles'] = true;
// return response;
// });
// }).as('config');
cy.intercept(`${Cypress.config('baseUrl')}/api/config`, request => {
request.reply(response => {
response.body['kialiFeatureFlags']['uiDefaults']['list']['showIncludeToggles'] = true;
return response;
});
}).as('config');

// Forcing "Pause" to not cause unhandled promises from the browser when cypress is testing
cy.visit({ url: `${Cypress.config('baseUrl')}/console/${page}?refresh=0` });

cy.request({ method: 'GET', url: `/api/config` }).then(response => {
response.body['kialiFeatureFlags']['uiDefaults']['list']['showIncludeToggles'] = true;
return response;
});
cy.visit(`${Cypress.config('baseUrl')}/console/${page}?refresh=0`);
cy.wait('@config');
});

Given('user is at the {string} page', (page: string) => {
Expand Down
2 changes: 1 addition & 1 deletion plugin/cypress/integration/kiali/common/table.ts
Original file line number Diff line number Diff line change
Expand Up @@ -120,7 +120,7 @@ export const hasAtLeastOneClass = (expectedClasses: string[]): (($el: HTMLElemen
//
// Be aware of these assumptions when using this func.
export const getColWithRowText = (rowSearchText: string, colName: string): Cypress.Chainable => {
return cy.get('thead').contains('tr', rowSearchText).find(`th[data-label="${colName}"]`);
return cy.get('tbody').contains('tr', rowSearchText).find(`td[data-label="${colName}"]`);
};

// getCellsForCol returns every cell matching the table header name or
Expand Down

0 comments on commit 5fe65e0

Please sign in to comment.