mirror of
https://github.com/open-metadata/OpenMetadata.git
synced 2025-09-06 15:43:04 +00:00
65 lines
1.8 KiB
JavaScript
65 lines
1.8 KiB
JavaScript
![]() |
/*
|
||
|
* Copyright 2023 Collate.
|
||
|
* 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.
|
||
|
*/
|
||
|
import { interceptURL, verifyResponseStatusCode } from './common';
|
||
|
|
||
|
export const visitServiceDetailsPage = (service, verifyHeader = true) => {
|
||
|
// Click on settings page
|
||
|
interceptURL(
|
||
|
'GET',
|
||
|
'api/v1/teams/name/Organization?fields=*',
|
||
|
'getSettingsPage'
|
||
|
);
|
||
|
cy.get('[data-testid="appbar-item-settings"]').should('be.visible').click();
|
||
|
verifyResponseStatusCode('@getSettingsPage', 200);
|
||
|
// Services page
|
||
|
interceptURL('GET', '/api/v1/services/*', 'getServices');
|
||
|
|
||
|
cy.get('.ant-menu-title-content')
|
||
|
.contains(service.type)
|
||
|
.should('be.visible')
|
||
|
.click();
|
||
|
|
||
|
verifyResponseStatusCode('@getServices', 200);
|
||
|
|
||
|
// click on created service
|
||
|
cy.get(`[data-testid="service-name-${service.name}"]`)
|
||
|
.should('exist')
|
||
|
.should('be.visible')
|
||
|
.click();
|
||
|
|
||
|
if (verifyHeader) {
|
||
|
cy.get(`[data-testid="entity-header-name"]`)
|
||
|
.should('exist')
|
||
|
.should('be.visible')
|
||
|
.invoke('text')
|
||
|
.then((text) => {
|
||
|
expect(text).to.equal(service.name);
|
||
|
});
|
||
|
}
|
||
|
|
||
|
verifyResponseStatusCode('@getServices', 200);
|
||
|
};
|
||
|
|
||
|
export const createDataWithApi = (data, token) => {
|
||
|
data.map(({ method, url, body }) => {
|
||
|
cy.request({
|
||
|
method,
|
||
|
url,
|
||
|
auth: {
|
||
|
bearer: token,
|
||
|
},
|
||
|
body,
|
||
|
});
|
||
|
});
|
||
|
};
|