|
|
|
@ -19,26 +19,36 @@ export class ChildList extends BasePage {
|
|
|
|
|
// title: Child list
|
|
|
|
|
// button: Link to 'City'
|
|
|
|
|
// icon: reload
|
|
|
|
|
await expect(this.get().locator(`.ant-modal-title`)).toHaveText(`Child list`); |
|
|
|
|
expect(await this.get().locator(`text=/Link to '.*${linkField}'/i`).isVisible()).toBeTruthy(); |
|
|
|
|
expect(await this.get().locator(`[data-testid="nc-child-list-reload"]`).isVisible()).toBeTruthy(); |
|
|
|
|
|
|
|
|
|
// child list body validation (card count, card title)
|
|
|
|
|
const cardCount = cardTitle.length; |
|
|
|
|
await this.get().locator('.ant-modal-content').waitFor(); |
|
|
|
|
{ |
|
|
|
|
const childList = this.get().locator(`.ant-card`); |
|
|
|
|
const childCards = await childList.count(); |
|
|
|
|
expect(childCards).toEqual(cardCount); |
|
|
|
|
let isOk = false; |
|
|
|
|
let count = 0; |
|
|
|
|
let childList; |
|
|
|
|
|
|
|
|
|
while (!isOk && count < 5) { |
|
|
|
|
try { |
|
|
|
|
childList = this.get().getByTestId('nc-child-list-item'); |
|
|
|
|
const childCards = await childList.count(); |
|
|
|
|
if (childCards === cardCount) { |
|
|
|
|
isOk = true; |
|
|
|
|
} |
|
|
|
|
} catch (e) { |
|
|
|
|
await this.rootPage.waitForTimeout(100); |
|
|
|
|
} finally { |
|
|
|
|
count++; |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
expect(childList).toBeDefined(); |
|
|
|
|
|
|
|
|
|
for (let i = 0; i < cardCount; i++) { |
|
|
|
|
await childList.nth(i).locator('.name').waitFor({ state: 'visible' }); |
|
|
|
|
await childList.nth(i).locator('.name').scrollIntoViewIfNeeded(); |
|
|
|
|
await childList.nth(i).locator('.nc-display-value').waitFor({ state: 'visible' }); |
|
|
|
|
await childList.nth(i).locator('.nc-display-value').scrollIntoViewIfNeeded(); |
|
|
|
|
await this.rootPage.waitForTimeout(100); |
|
|
|
|
expect(await childList.nth(i).locator('.name').textContent()).toContain(cardTitle[i]); |
|
|
|
|
// icon: unlink
|
|
|
|
|
// icon: delete
|
|
|
|
|
expect(await childList.nth(i).locator(`[data-testid="nc-child-list-icon-unlink"]`).isVisible()).toBeTruthy(); |
|
|
|
|
expect(await childList.nth(i).locator(`[data-testid="nc-child-list-icon-delete"]`).isVisible()).toBeTruthy(); |
|
|
|
|
expect(await childList.nth(i).locator('.nc-display-value').textContent()).toContain(cardTitle[i]); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
@ -49,7 +59,7 @@ export class ChildList extends BasePage {
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
async openLinkRecord({ linkTableTitle }: { linkTableTitle: string }) { |
|
|
|
|
const openActions = () => this.get().locator(`text=/Link to '.*${linkTableTitle}'/i`).click(); |
|
|
|
|
const openActions = () => this.get().getByTestId('nc-child-list-button-link-to').click(); |
|
|
|
|
await this.waitForResponse({ |
|
|
|
|
requestUrlPathToMatch: '/exclude', |
|
|
|
|
httpMethodsToMatch: ['GET'], |
|
|
|
|