-
Notifications
You must be signed in to change notification settings - Fork 997
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
Browse the repository at this point in the history
* fix(ui): consider all the tags as tier which are children of Tier classification * add playwright * wip tier cleanup * fix async select list loading issue * address comments * update variable
- Loading branch information
1 parent
166d9ef
commit a034a97
Showing
9 changed files
with
200 additions
and
42 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
94 changes: 94 additions & 0 deletions
94
openmetadata-ui/src/main/resources/ui/playwright/support/tag/TagClass.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,94 @@ | ||
/* | ||
* 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 { APIRequestContext, Page } from '@playwright/test'; | ||
import { visitClassificationPage } from '../../utils/tag'; | ||
import { getRandomLastName } from '../../utils/user'; | ||
|
||
type ResponseDataType = { | ||
style?: { | ||
color: string; | ||
}; | ||
description: string; | ||
displayName: string; | ||
classification: { | ||
id: string; | ||
type: 'classification'; | ||
name: string; | ||
fullyQualifiedName: string; | ||
description: string; | ||
displayName: string; | ||
deleted: boolean; | ||
href: string; | ||
}; | ||
name: string; | ||
id: string; | ||
fullyQualifiedName: string; | ||
}; | ||
|
||
export type TagData = { | ||
style?: { | ||
color: string; | ||
}; | ||
description: string; | ||
displayName: string; | ||
classification: string; | ||
name: string; | ||
}; | ||
|
||
export class TagClass { | ||
randomName = getRandomLastName(); | ||
data: TagData = { | ||
name: `pw-tier-${this.randomName}`, | ||
displayName: `PW Tier ${this.randomName}`, | ||
description: 'Tier tag for the Collate platform', | ||
style: { | ||
color: '#FFD700', | ||
}, | ||
classification: 'Tier', | ||
}; | ||
|
||
responseData: ResponseDataType; | ||
|
||
constructor(tag: Partial<TagData>) { | ||
this.data.classification = tag.classification ?? this.data.classification; | ||
} | ||
|
||
async visitPage(page: Page) { | ||
await visitClassificationPage( | ||
page, | ||
this.responseData.classification.displayName | ||
); | ||
} | ||
|
||
async create(apiContext: APIRequestContext) { | ||
const response = await apiContext.post('/api/v1/tags', { | ||
data: this.data, | ||
}); | ||
|
||
this.responseData = await response.json(); | ||
|
||
return await response.json(); | ||
} | ||
|
||
get() { | ||
return this.responseData; | ||
} | ||
|
||
async delete(apiContext: APIRequestContext) { | ||
const response = await apiContext.delete( | ||
`/api/v1/tags/${this.responseData.id}?recursive=true&hardDelete=true` | ||
); | ||
|
||
return await response.json(); | ||
} | ||
} |
29 changes: 29 additions & 0 deletions
29
openmetadata-ui/src/main/resources/ui/playwright/utils/tag.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
/* | ||
* 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 { Page } from '@playwright/test'; | ||
import { SidebarItem } from '../constant/sidebar'; | ||
import { redirectToHomePage } from './common'; | ||
import { sidebarClick } from './sidebar'; | ||
|
||
export const visitClassificationPage = async ( | ||
page: Page, | ||
classificationName: string | ||
) => { | ||
await redirectToHomePage(page); | ||
const classificationResponse = page.waitForResponse( | ||
'/api/v1/classifications?**' | ||
); | ||
await sidebarClick(page, SidebarItem.TAGS); | ||
await classificationResponse; | ||
await page.getByRole('menuitem', { name: classificationName }).click(); | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.