### Improved tenant assignment flow This PR improves the tenant assignment flow. I know a lot of users liked the previous flow where the field was not injected into the document. But the original flow, confused many of users because the tenant filter (top left) was being used to set the tenant on the document _and_ filter the list view. This change shown below is aiming to solve both of those groups with a slightly different approach. As always, feedback is welcome while we try to really make this plugin work for everyone. https://github.com/user-attachments/assets/ceee8b3a-c5f5-40e9-8648-f583e2412199 Added 2 new localization strings: ``` // shown in the 3 dot menu 'assign-tenant-button-label': 'Assign Tenant', // shown when needing to assign a tenant to a NEW document 'assign-tenant-modal-title': 'Assign "{{title}}"', ``` Removed 2 localization strings: ``` 'confirm-modal-tenant-switch--body', 'confirm-modal-tenant-switch--heading' ```
41 lines
1.9 KiB
TypeScript
41 lines
1.9 KiB
TypeScript
import type { Page } from '@playwright/test'
|
|
|
|
import { expect } from '@playwright/test'
|
|
|
|
export async function openNav(page: Page): Promise<void> {
|
|
// wait for the preferences/media queries to either open or close the nav
|
|
await expect(page.locator('.template-default--nav-hydrated')).toBeVisible()
|
|
|
|
// close all open modals
|
|
const dialogs = await page.locator('dialog[open]').elementHandles()
|
|
for (let i = 0; i < dialogs.length; i++) {
|
|
await page.keyboard.press('Escape')
|
|
}
|
|
|
|
// check to see if the nav is already open and if not, open it
|
|
// use the `--nav-open` modifier class to check if the nav is open
|
|
// this will prevent clicking nav links that are bleeding off the screen
|
|
if (await page.locator('.template-default.template-default--nav-open').isVisible()) {
|
|
return
|
|
}
|
|
|
|
// playwright: get first element with .nav-toggler which is VISIBLE (not hidden), could be 2 elements with .nav-toggler on mobile and desktop but only one is visible
|
|
await page.locator('.nav-toggler >> visible=true').click()
|
|
await expect(page.locator('.nav--nav-animate[inert], .nav--nav-hydrated[inert]')).toBeHidden()
|
|
await expect(page.locator('.template-default.template-default--nav-open')).toBeVisible()
|
|
}
|
|
|
|
export async function closeNav(page: Page): Promise<void> {
|
|
// wait for the preferences/media queries to either open or close the nav
|
|
await expect(page.locator('.template-default--nav-hydrated')).toBeVisible()
|
|
|
|
// check to see if the nav is already closed and if so, return early
|
|
if (!(await page.locator('.template-default.template-default--nav-open').isVisible())) {
|
|
return
|
|
}
|
|
|
|
// playwright: get first element with .nav-toggler which is VISIBLE (not hidden), could be 2 elements with .nav-toggler on mobile and desktop but only one is visible
|
|
await page.locator('.nav-toggler >> visible=true').click()
|
|
await expect(page.locator('.template-default.template-default--nav-open')).toBeHidden()
|
|
}
|