Browse Source

fix: test delete modal

pull/6420/head
sreehari jayaraj 1 year ago
parent
commit
67a4d1ce33
  1. 8
      packages/nc-gui/components/account/Token.vue
  2. 10
      tests/playwright/pages/Account/Token.ts
  3. 2
      tests/playwright/tests/db/usersAccounts/accountTokenManagement.spec.ts

8
packages/nc-gui/components/account/Token.vue

@ -174,6 +174,10 @@ const descriptionInput: VNodeRef = (el) => (el as HTMLInputElement)?.focus()
</NcButton>
</div>
</div>
<div v-if="tokens.length < 1">
<a-empty :image="Empty.PRESENTED_IMAGE_SIMPLE" :description="`${$t('general.no')} ${$t('labels.token')}`" />
</div>
<div v-for="el of tokens" :key="el.id" data-testid="nc-token-list" class="flex border-b-1 pl-5 py-3 justify-between">
<span class="text-gray-500 font-medium text-3.5 text-start w-2/9">
<GeneralTruncateText placement="top" length="25">
@ -181,12 +185,12 @@ const descriptionInput: VNodeRef = (el) => (el as HTMLInputElement)?.focus()
</GeneralTruncateText>
</span>
<span class="text-gray-500 font-medium text-3.5 text-start w-2/9">
<GeneralTruncateText placement="top" length="50">
<GeneralTruncateText placement="top" length="20">
{{ el.created_by }}
</GeneralTruncateText>
</span>
<span class="text-gray-500 font-medium text-3.5 text-start w-3/9">
<GeneralTruncateText v-if="el.token === selectedToken.id && selectedToken.isShow" placement="top" length="32">
<GeneralTruncateText v-if="el.token === selectedToken.id && selectedToken.isShow" placement="top" length="28">
{{ el.token }}
</GeneralTruncateText>
<span v-else>**********************************</span>

10
tests/playwright/pages/Account/Token.ts

@ -41,16 +41,10 @@ export class AccountTokenPage extends BasePage {
await row.locator('.nc-toggle-token-visibility').click();
}
async openRowActionMenu({ description }: { description: string }) {
const userRow = this.get().locator(`tr:has-text("${description}")`);
return userRow.locator(`.nc-token-menu`).click();
}
async deleteToken({ description }: { description: string }) {
await this.openRowActionMenu({ description });
await this.rootPage.locator('[data-testid="nc-token-row-action-icon"] .nc-delete-token').click();
await this.rootPage.locator('[data-testid="nc-token-row-action-icon"]').click();
await this.rootPage.locator('.ant-modal.active button:has-text("Delete Token")').click();
expect(await this.get().locator(`tr:has-text("${description}:visible")`).count()).toBe(0);
expect(await this.get().locator(`span:has-text("${description}:visible")`).count()).toBe(0);
}
}

2
tests/playwright/tests/db/usersAccounts/accountTokenManagement.spec.ts

@ -19,7 +19,7 @@ test.describe('User roles', () => {
await unsetup(context);
});
test.only('Create and Delete token', async () => {
test('Create and Delete token', async () => {
test.slow();
const parallelId = process.env.TEST_PARALLEL_INDEX ?? '0';
await accountTokenPage.goto();

Loading…
Cancel
Save