Add playwright test for healthcheck (#17542)

* add tests in playwright

* refactor: remove unused changes

* refcator: remove yarn lock change
This commit is contained in:
Sweta Agarwalla 2024-08-22 13:10:27 +05:30 committed by GitHub
parent e4927373bb
commit cf347adf72
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 48 additions and 49 deletions

View File

@ -1,49 +0,0 @@
/*
* Copyright 2024 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/common';
import { GlobalSettingOptions } from '../../constants/settings.constant';
describe('Health Check for Openmetadata', () => {
before(() => {
cy.login();
});
it('All 5 checks should be successful', () => {
interceptURL('GET', '/api/v1/system/status', 'getOMStatus');
cy.settingClick(GlobalSettingOptions.OM_HEALTH);
verifyResponseStatusCode('@getOMStatus', 200);
cy.get('[data-testid="database"] .success-status').should(
'have.text',
'Success'
);
cy.get('[data-testid="searchInstance"] .success-status').should(
'have.text',
'Success'
);
cy.get('[data-testid="pipelineServiceClient"] .success-status').should(
'have.text',
'Success'
);
cy.get('[data-testid="jwks"] .success-status').should(
'have.text',
'Success'
);
cy.get('[data-testid="migrations"] .success-status').should(
'have.text',
'Success'
);
});
});

View File

@ -0,0 +1,48 @@
/*
* Copyright 2024 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 { expect, test } from '@playwright/test';
import { GlobalSettingOptions } from '../../constant/settings';
import { redirectToHomePage } from '../../utils/common';
import { settingClick } from '../../utils/sidebar';
// use the admin user to login
test.use({ storageState: 'playwright/.auth/admin.json' });
test.describe('Health Check for OpenMetadata', () => {
test.beforeEach(async ({ page }) => {
await redirectToHomePage(page);
});
test('All 5 checks should be successful', async ({ page }) => {
const healthResponse = page.waitForResponse('/api/v1/system/status');
await settingClick(page, GlobalSettingOptions.OM_HEALTH);
await healthResponse;
await expect(
page.locator('[data-testid="database"] .success-status')
).toHaveText('Success');
await expect(
page.locator('[data-testid="searchInstance"] .success-status')
).toHaveText('Success');
await expect(
page.locator('[data-testid="pipelineServiceClient"] .success-status')
).toHaveText('Success');
await expect(
page.locator('[data-testid="jwks"] .success-status')
).toHaveText('Success');
await expect(
page.locator('[data-testid="migrations"] .success-status')
).toHaveText('Success');
});
});