Browse Source

test: new role selector

pull/6378/head
mertmit 11 months ago
parent
commit
49a6d6962e
  1. 13
      packages/nc-gui/components/roles/Selector.vue
  2. 6
      tests/playwright/pages/Dashboard/ProjectView/AccessSettingsPage.ts
  3. 2
      tests/playwright/setup/index.ts

13
packages/nc-gui/components/roles/Selector.vue

@ -17,9 +17,9 @@ const inheritRef = toRef(props, 'inherit')
<NcDropdown> <NcDropdown>
<RolesBadge class="border-1" :role="roleRef" clickable :inherit="inheritRef === role" /> <RolesBadge class="border-1" :role="roleRef" clickable :inherit="inheritRef === role" />
<template #overlay> <template #overlay>
<div class="flex flex-col gap-[4px] p-1"> <div class="nc-role-select-dropdown flex flex-col gap-[4px] p-1">
<div class="flex flex-col gap-[4px]"> <div class="flex flex-col gap-[4px]">
<NcDropdownItem <div
v-for="rl in props.roles" v-for="rl in props.roles"
:key="rl" :key="rl"
class="cursor-pointer" class="cursor-pointer"
@ -27,8 +27,13 @@ const inheritRef = toRef(props, 'inherit')
:selected="rl === roleRef" :selected="rl === roleRef"
@click="props.onRoleChange(rl)" @click="props.onRoleChange(rl)"
> >
<RolesBadge class="!bg-white hover:!bg-gray-100" :role="rl" :inherit="inheritRef === rl" /> <RolesBadge
</NcDropdownItem> class="!bg-white hover:!bg-gray-100"
:class="`nc-role-select-${rl}`"
:role="rl"
:inherit="inheritRef === rl"
/>
</div>
</div> </div>
</div> </div>
</template> </template>

6
tests/playwright/pages/Dashboard/ProjectView/AccessSettingsPage.ts

@ -22,11 +22,11 @@ export class AccessSettingsPage extends BasePage {
if (userEmail === email) { if (userEmail === email) {
const roleDropdown = user.locator('.nc-collaborator-role-select'); const roleDropdown = user.locator('.nc-collaborator-role-select');
const selectedRole = await user.locator('.nc-collaborator-role-select').innerText(); const selectedRole = await user.locator('.nc-collaborator-role-select .badge-text').innerText();
await roleDropdown.click(); await roleDropdown.click();
const menu = this.rootPage.locator('.ant-select-dropdown:visible'); const menu = this.rootPage.locator('.nc-role-select-dropdown:visible');
const clickClbk = () => menu.locator(`.ant-select-item:has-text("${role}"):visible`).last().click(); const clickClbk = () => menu.locator(`.nc-role-select-${role.toLowerCase()}:visible`).last().click();
if (networkValidation && !selectedRole.includes(role)) { if (networkValidation && !selectedRole.includes(role)) {
await this.waitForResponse({ await this.waitForResponse({

2
tests/playwright/setup/index.ts

@ -384,7 +384,7 @@ const setup = async ({
email: `user@nocodb.com`, email: `user@nocodb.com`,
password: getDefaultPwd(), password: getDefaultPwd(),
}); });
await axios.post(`http://localhost:8080/api/v1/license`, { key: '' }, { headers: { 'xc-auth': admin.data.token } }); if (!isEE()) await axios.post(`http://localhost:8080/api/v1/license`, { key: '' }, { headers: { 'xc-auth': admin.data.token } });
} catch (e) { } catch (e) {
// ignore error: some roles will not have permission for license reset // ignore error: some roles will not have permission for license reset
// console.error(`Error resetting project: ${process.env.TEST_PARALLEL_INDEX}`, e); // console.error(`Error resetting project: ${process.env.TEST_PARALLEL_INDEX}`, e);

Loading…
Cancel
Save