fix(test): separate playwright for oss (#17543)

* fix(test): separate playwright for oss

Run specific tests based on OSS flagged

* fix(test): playwright with fals IS_OSS
This commit is contained in:
Chirag Madlani 2024-08-22 12:47:58 +05:30 committed by GitHub
parent 43a244fbf1
commit e4927373bb
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
5 changed files with 7 additions and 158 deletions

View File

@ -98,6 +98,7 @@ jobs:
working-directory: openmetadata-ui/src/main/resources/ui/
run: npx playwright test
env:
PLAYWRIGHT_IS_OSS: true
CYPRESS_BASE_URL: "http://localhost:8585"
CYPRESS_RECORD_KEY: ${{ steps.cypress-project-id.outputs.CYPRESS_RECORD_KEY }}
CYPRESS_grepTags: ${{ steps.getCypresse2eLabels.outputs.e2eLabels }}

View File

@ -98,6 +98,7 @@ jobs:
working-directory: openmetadata-ui/src/main/resources/ui/
run: npx playwright test
env:
PLAYWRIGHT_IS_OSS: true
CYPRESS_BASE_URL: "http://localhost:8585"
CYPRESS_RECORD_KEY: ${{ steps.cypress-project-id.outputs.CYPRESS_RECORD_KEY }}
CYPRESS_grepTags: ${{ steps.getCypresse2eLabels.outputs.e2eLabels }}

View File

@ -1,155 +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';
const visitSearchApplicationPage = () => {
interceptURL(
'GET',
'/api/v1/apps/name/SearchIndexingApplication?fields=*',
'getSearchIndexingApplication'
);
cy.get(
'[data-testid="search-indexing-application-card"] [data-testid="config-btn"]'
).click();
verifyResponseStatusCode('@getSearchIndexingApplication', 200);
};
const verifyLastExecutionRun = (interceptedUrlLabel: string) => {
cy.wait(`@${interceptedUrlLabel}`).then((interception) => {
expect(interception.response.statusCode).to.eq(200);
// Validate the last execution run response
const responseData = interception.response.body;
if (responseData.data.length > 0) {
expect(responseData.data).to.have.length(1);
expect(responseData.data[0].status).to.equal('success');
}
});
};
describe('Search Index Application', { tags: 'Settings' }, () => {
beforeEach(() => {
cy.login();
interceptURL('GET', '/api/v1/apps?limit=*', 'getApplications');
cy.settingClick(GlobalSettingOptions.APPLICATIONS);
verifyResponseStatusCode('@getApplications', 200);
});
it('Verify last execution run', () => {
interceptURL(
'GET',
'/api/v1/apps/name/SearchIndexingApplication/status?offset=0&limit=1',
'lastExecutionRun'
);
visitSearchApplicationPage();
verifyLastExecutionRun('lastExecutionRun');
});
it('Edit application', () => {
interceptURL('PATCH', '/api/v1/apps/*', 'updateApplication');
visitSearchApplicationPage();
cy.get('[data-testid="edit-button"]').click();
cy.get('[data-testid="cron-type"]').click();
cy.get('.rc-virtual-list [title="None"]').click();
cy.get('.ant-modal-body [data-testid="deploy-button"]').click();
verifyResponseStatusCode('@updateApplication', 200);
cy.get('[data-testid="schedule-type"]').should('contain', 'None');
cy.get('[data-testid="configuration"]').click();
cy.get('#root\\/batchSize').type('0');
cy.get(
'[data-testid="select-widget"] > .ant-select-selector > .ant-select-selection-item'
).click();
cy.get('[data-testid="select-option-JP"]').click();
cy.get('[data-testid="submit-btn"]').click();
verifyResponseStatusCode('@updateApplication', 200);
});
it('Uninstall application', () => {
interceptURL('GET', '/api/v1/apps?limit=*', 'getApplications');
interceptURL(
'DELETE',
'/api/v1/apps/name/SearchIndexingApplication?hardDelete=true',
'deleteApplication'
);
visitSearchApplicationPage();
cy.get('[data-testid="manage-button"]').click();
cy.get('[data-testid="uninstall-button-title"]').click();
cy.get('[data-testid="save-button"]').click();
verifyResponseStatusCode('@deleteApplication', 200);
verifyResponseStatusCode('@getApplications', 200);
cy.get('[data-testid="search-indexing-application-card"]').should(
'not.exist'
);
});
it('Install application', () => {
interceptURL('GET', '/api/v1/apps/marketplace?limit=*', 'getMarketPlace');
interceptURL('POST', '/api/v1/apps', 'installApplication');
cy.get('[data-testid="add-application"]').click();
verifyResponseStatusCode('@getMarketPlace', 200);
cy.get(
'[data-testid="search-indexing-application-card"] [data-testid="config-btn"]'
).click();
cy.get('[data-testid="install-application"]').click();
cy.get('[data-testid="save-button"]').scrollIntoView().click();
cy.get('[data-testid="submit-btn"]').scrollIntoView().click();
cy.get('[data-testid="cron-type"]').click();
cy.get('.rc-virtual-list [title="None"]').click();
cy.get('[data-testid="cron-type"]').should('contain', 'None');
cy.get('[data-testid="deploy-button"]').click();
verifyResponseStatusCode('@installApplication', 201);
verifyResponseStatusCode('@getApplications', 200);
cy.get('[data-testid="search-indexing-application-card"]').should(
'be.visible'
);
});
if (Cypress.env('isOss')) {
it('Run application', () => {
interceptURL(
'GET',
'/api/v1/apps/name/SearchIndexingApplication?fields=*',
'getSearchIndexingApplication'
);
interceptURL(
'POST',
'/api/v1/apps/trigger/SearchIndexingApplication',
'triggerPipeline'
);
cy.get(
'[data-testid="search-indexing-application-card"] [data-testid="config-btn"]'
).click();
verifyResponseStatusCode('@getSearchIndexingApplication', 200);
cy.get('[data-testid="run-now-button"]').click();
verifyResponseStatusCode('@triggerPipeline', 200);
cy.wait(120000); // waiting for 2 minutes before we check if reindex was success
interceptURL(
'GET',
'/api/v1/apps/name/SearchIndexingApplication/status?offset=0&limit=1',
'lastExecutionRun'
);
cy.reload();
verifyLastExecutionRun('lastExecutionRun');
});
}
});

View File

@ -172,7 +172,7 @@ test('Search Index Application', async ({ page }) => {
expect(await card.isVisible()).toBe(true);
});
if (process.env.isOss) {
if (process.env.PLAYWRIGHT_IS_OSS) {
await test.step('Run application', async () => {
test.slow(true); // Test time shouldn't exceed while re-fetching the history API.

View File

@ -19,7 +19,9 @@ setup.use({
storageState: 'playwright/.auth/admin.json',
});
setup.describe.configure({ timeout: process.env.isOss ? 150000 : 3600000 });
setup.describe.configure({
timeout: process.env.PLAYWRIGHT_IS_OSS ? 150000 : 3600000,
});
setup(
'Run Data Insight application and wait until success',
@ -68,7 +70,7 @@ setup(
{
// Custom expect message for reporting, optional.
message: 'Wait for the Data Insight Application run to be successful',
...(process.env.isOss
...(process.env.PLAYWRIGHT_IS_OSS
? {
timeout: 120_000,
intervals: [5_000, 10_000],