Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix info link for service instances tooltip #2750

Merged
merged 1 commit into from
Oct 3, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -284,7 +284,7 @@ exports[`ServiceList should render add service modal after click 1`] = `
class="emotion-29"
data-testid="icon"
height="1.25em"
id=""
id="delete-service-openhouse"
viewBox="0 0 1024 1024"
width="1.25em"
>
Expand Down Expand Up @@ -599,7 +599,7 @@ exports[`ServiceList should render delete service modal error(other) after click
class="emotion-29"
data-testid="icon"
height="1.25em"
id=""
id="delete-service-openhouse"
viewBox="0 0 1024 1024"
width="1.25em"
>
Expand Down Expand Up @@ -904,7 +904,7 @@ exports[`ServiceList should render delete service modal error(refresh) after cli
class="emotion-29"
data-testid="icon"
height="1.25em"
id=""
id="delete-service-openhouse"
viewBox="0 0 1024 1024"
width="1.25em"
>
Expand Down Expand Up @@ -1209,7 +1209,7 @@ exports[`ServiceList should render serviceList again after cancel delete 1`] = `
class="emotion-29"
data-testid="icon"
height="1.25em"
id=""
id="delete-service-openhouse"
viewBox="0 0 1024 1024"
width="1.25em"
>
Expand Down Expand Up @@ -1673,7 +1673,7 @@ exports[`ServiceList should render with services 1`] = `
class="emotion-29"
data-testid="icon"
height="1.25em"
id=""
id="delete-service-openhouse"
viewBox="0 0 1024 1024"
width="1.25em"
>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -198,7 +198,7 @@ exports[`ServiceRow should render row 1`] = `
class="emotion-8"
data-testid="icon"
height="1.25em"
id=""
id="delete-service-serviceName"
viewBox="0 0 1024 1024"
width="1.25em"
>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1509,7 +1509,7 @@ exports[`ServicePage should render 1`] = `
class="emotion-84"
data-testid="icon"
height="1.25em"
id=""
id="delete-service-bastion"
viewBox="0 0 1024 1024"
width="1.25em"
>
Expand Down Expand Up @@ -1632,7 +1632,7 @@ exports[`ServicePage should render 1`] = `
class="emotion-84"
data-testid="icon"
height="1.25em"
id=""
id="delete-service-openhouse"
viewBox="0 0 1024 1024"
width="1.25em"
>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1090,7 +1090,7 @@ exports[`DynamicInstancePage should render 1`] = `
class="emotion-36"
data-testid="icon"
height="15px"
id=""
id="instances-help-tooltip"
viewBox="0 0 1024 1024"
width="15px"
>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1113,7 +1113,7 @@ exports[`StaticInstancePage should render 1`] = `
class="emotion-36"
data-testid="icon"
height="15px"
id=""
id="instances-help-tooltip"
viewBox="0 0 1024 1024"
width="15px"
>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -76,10 +76,12 @@ describe('DynamicInstancePage', () => {
},
};
let serviceHeaderDetails = {
description:
'Here you can add / see instances which can not obtain Athenz identity because of limitations, but would be associated with your service.',
url: '',
target: '_blank',
dynamic : {
description:
'Here you can see instances which are running with this service identity',
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@chandrasekhar1996 is this what you meant to change?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yes

url: '',
target: '_blank',
}
};
let services = {
'dom.serv': {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -76,10 +76,12 @@ describe('StaticInstancePage', () => {
};

let serviceHeaderDetails = {
description:
'Here you can add / see instances which can not obtain Athenz identity because of limitations, but would be associated with your service.',
url: '',
target: '_blank',
static: {
description:
'Here you can add / see instances which can not obtain Athenz identity because of limitations, but would be associated with your service.',
url: '',
target: '_blank',
}
};
let services = {
'dom.serv': {
Expand Down
84 changes: 84 additions & 0 deletions ui/src/__tests__/spec/tests/services.spec.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,84 @@
/*
* Copyright The Athenz Authors
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/

describe('services screen tests', () => {
it('when clicking help tooltip link, it should open a tab with athenz guide', async () => {
// open browser
await browser.newUser();
await browser.url(`/`);
// select domain
let domain = 'athenz.dev.functional-test';
let testDomain = await $(`a*=${domain}`);
await browser.waitUntil(async () => await testDomain.isClickable());
await testDomain.click();

// open Services
let servicesButton = await $('div*=Services');
await browser.waitUntil(async () => await servicesButton.isClickable());
await servicesButton.click();

// add service
const serviceName = 'tooltip-link-test-service';
let addServiceButton = await $('button*=Add Service');
await addServiceButton.click();
let serviceNameInput = await $('input[id="service-name"]');
await serviceNameInput.addValue(serviceName);
let submitButton = await $('button*=Submit');
await submitButton.click();

// navigate to tooltip
let serviceInstancesButton = await $(`.//*[local-name()="svg" and @id="${'view-instances-' + serviceName}"]`);
await serviceInstancesButton.click();
// open tooltip
let instanceHelpTooltipButton = await $(`.//*[local-name()="svg" and @id="instances-help-tooltip"]`);
await instanceHelpTooltipButton.click();
// click athenz guide link
await browser.pause(1000); // wait a little so that onclick function is assigned to the anchor
let athenzGuideAnchor = await $('a*=here');
await athenzGuideAnchor.click();
await browser.pause(1000); // Just to ensure the new tab opens
// switch to opened tab
const windowHandles = await browser.getWindowHandles();
expect(windowHandles.length).toBeGreaterThan(1);
await browser.switchToWindow(windowHandles[1]);
// verify the URL of the new tab
const url = await browser.getUrl();
expect(url).toContain('athenz-guide');
});

// after - runs after the last test in order of declaration
after(async() => {
// open browser
await browser.newUser();
await browser.url(`/`);
// select domain
let domain = 'athenz.dev.functional-test';
let testDomain = await $(`a*=${domain}`);
await browser.waitUntil(async () => await testDomain.isClickable());
await testDomain.click();

// open Services
let servicesButton = await $('div*=Services');
await browser.waitUntil(async () => await servicesButton.isClickable());
await servicesButton.click();

// delete service created for the test
let serviceDeleteButton = await $('.//*[local-name()="svg" and @id="delete-service-tooltip-link-test-service"]');
await serviceDeleteButton.click();
let modalDeleteButton = await $('button*=Delete');
await modalDeleteButton.click();
});
})
2 changes: 2 additions & 0 deletions ui/src/components/header/ServiceNameHeader.js
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,7 @@ export default function ServiceNameHeader(props) {
message.push(' For more information click ');
var urlLink = (
<StyledAnchor
id={'athenz-guide-anchor'}
key={Date.now()}
onClick={() =>
window.open(
Expand All @@ -85,6 +86,7 @@ export default function ServiceNameHeader(props) {
padding-bottom='10px'
trigger={({ getTriggerProps, triggerRef }) => (
<Icon
id={'instances-help-tooltip'}
icon={'help-circle'}
{...getTriggerProps({ innerRef: triggerRef })}
isLink
Expand Down
2 changes: 2 additions & 0 deletions ui/src/components/service/ServiceRow.js
Original file line number Diff line number Diff line change
Expand Up @@ -132,6 +132,7 @@ class ServiceRow extends React.Component {
{this.props.featureFlag ? (
<TdStyled color={color} align={center}>
<Icon
id={'view-instances-' + this.props.serviceName}
icon={'data-source'}
onClick={this.toggleInstances}
color={colors.icons}
Expand Down Expand Up @@ -183,6 +184,7 @@ class ServiceRow extends React.Component {
</TdStyled>
<TdStyled color={color} align={center}>
<Icon
id={'delete-service-' + this.props.serviceName}
icon={'trash'}
onClick={this.props.onClickDeleteService}
color={colors.icons}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -247,8 +247,8 @@ const mapStateToProps = (state, props) => {
),
serviceHeaderDetails: selectDynamicServiceHeaderDetails(
state,
props.domain,
props.service
props.domainName,
props.serviceName
),
isLoading: selectIsLoading(state),
featureFlag: selectFeatureFlag(state),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -247,8 +247,8 @@ const mapStateToProps = (state, props) => {
),
serviceHeaderDetails: selectStaticServiceHeaderDetails(
state,
props.domain,
props.service
props.domainName,
props.serviceName
),
isLoading: selectIsLoading(state),
featureFlag: selectFeatureFlag(state),
Expand Down