mirror of
https://github.com/AppFlowy-IO/AppFlowy-Web.git
synced 2025-11-29 19:08:33 +08:00
37 lines
1.1 KiB
TypeScript
37 lines
1.1 KiB
TypeScript
/**
|
|
* Page management utility functions for Cypress E2E tests
|
|
* Contains functions for interacting with pages in the sidebar
|
|
*/
|
|
|
|
/**
|
|
* Gets a page element by its name
|
|
* Used in more-page-action.cy.ts for finding specific pages
|
|
* @param pageName - The name of the page to find
|
|
* @returns Cypress chainable element
|
|
*/
|
|
export function getPageByName(pageName: string) {
|
|
cy.task('log', `Getting page by name: ${pageName}`);
|
|
return cy.get('[data-testid="page-name"]')
|
|
.contains(pageName)
|
|
.closest('[data-testid="page-item"]');
|
|
}
|
|
|
|
/**
|
|
* Gets the page title input element for the currently open page
|
|
* Used in more-page-action.cy.ts for renaming pages
|
|
* @returns Cypress chainable element
|
|
*/
|
|
export function getPageTitleInput() {
|
|
cy.task('log', 'Getting page title input element');
|
|
return cy.get('[data-testid="page-title-input"]').first();
|
|
}
|
|
|
|
/**
|
|
* Saves the current page title by pressing Enter
|
|
* Used in more-page-action.cy.ts after editing page titles
|
|
*/
|
|
export function savePageTitle() {
|
|
cy.task('log', 'Saving page title');
|
|
cy.focused().type('{enter}');
|
|
cy.wait(1000); // Wait for save to complete
|
|
} |