2024-06-11 05:21:16 -07:00
|
|
|
import { CredentialsModal, WorkflowPage } from '../pages';
|
|
|
|
|
|
|
|
const workflowPage = new WorkflowPage();
|
|
|
|
const credentialsModal = new CredentialsModal();
|
|
|
|
|
2024-05-17 01:53:15 -07:00
|
|
|
export const getHomeButton = () => cy.getByTestId('project-home-menu-item');
|
|
|
|
export const getMenuItems = () => cy.getByTestId('project-menu-item');
|
2024-08-09 07:31:02 -07:00
|
|
|
export const getAddProjectButton = () =>
|
|
|
|
cy.getByTestId('add-project-menu-item').should('contain', 'Add project').should('be.visible');
|
2024-05-17 01:53:15 -07:00
|
|
|
export const getProjectTabs = () => cy.getByTestId('project-tabs').find('a');
|
|
|
|
export const getProjectTabWorkflows = () => getProjectTabs().filter('a[href$="/workflows"]');
|
|
|
|
export const getProjectTabCredentials = () => getProjectTabs().filter('a[href$="/credentials"]');
|
|
|
|
export const getProjectTabSettings = () => getProjectTabs().filter('a[href$="/settings"]');
|
2024-06-14 05:48:49 -07:00
|
|
|
export const getProjectSettingsNameInput = () => cy.getByTestId('project-settings-name-input');
|
2024-05-17 01:53:15 -07:00
|
|
|
export const getProjectSettingsSaveButton = () => cy.getByTestId('project-settings-save-button');
|
|
|
|
export const getProjectSettingsCancelButton = () =>
|
|
|
|
cy.getByTestId('project-settings-cancel-button');
|
|
|
|
export const getProjectSettingsDeleteButton = () =>
|
|
|
|
cy.getByTestId('project-settings-delete-button');
|
|
|
|
export const getProjectMembersSelect = () => cy.getByTestId('project-members-select');
|
|
|
|
export const addProjectMember = (email: string) => {
|
|
|
|
getProjectMembersSelect().click();
|
|
|
|
getProjectMembersSelect().get('.el-select-dropdown__item').contains(email.toLowerCase()).click();
|
|
|
|
};
|
2024-07-18 05:17:27 -07:00
|
|
|
export const getProjectNameInput = () => cy.get('#projectName').find('input');
|
2024-06-11 05:21:16 -07:00
|
|
|
export const getResourceMoveModal = () => cy.getByTestId('project-move-resource-modal');
|
|
|
|
export const getResourceMoveConfirmModal = () =>
|
|
|
|
cy.getByTestId('project-move-resource-confirm-modal');
|
|
|
|
export const getProjectMoveSelect = () => cy.getByTestId('project-move-resource-modal-select');
|
|
|
|
|
|
|
|
export function createProject(name: string) {
|
2024-08-09 07:31:02 -07:00
|
|
|
getAddProjectButton().click();
|
2024-06-11 05:21:16 -07:00
|
|
|
|
|
|
|
getProjectNameInput()
|
|
|
|
.should('be.visible')
|
|
|
|
.should('be.focused')
|
|
|
|
.should('have.value', 'My project')
|
|
|
|
.clear()
|
|
|
|
.type(name);
|
|
|
|
getProjectSettingsSaveButton().click();
|
|
|
|
}
|
|
|
|
|
|
|
|
export function createWorkflow(fixtureKey: string, name: string) {
|
|
|
|
workflowPage.getters.workflowImportInput().selectFile(`fixtures/${fixtureKey}`, { force: true });
|
|
|
|
workflowPage.actions.setWorkflowName(name);
|
|
|
|
workflowPage.getters.saveButton().should('contain', 'Saved');
|
|
|
|
workflowPage.actions.zoomToFit();
|
|
|
|
}
|
|
|
|
|
2024-08-09 07:31:02 -07:00
|
|
|
export function createCredential(name: string, closeModal = true) {
|
2024-06-11 05:21:16 -07:00
|
|
|
credentialsModal.getters.newCredentialModal().should('be.visible');
|
|
|
|
credentialsModal.getters.newCredentialTypeSelect().should('be.visible');
|
|
|
|
credentialsModal.getters.newCredentialTypeOption('Notion API').click();
|
|
|
|
credentialsModal.getters.newCredentialTypeButton().click();
|
|
|
|
credentialsModal.getters.connectionParameter('Internal Integration Secret').type('1234567890');
|
|
|
|
credentialsModal.actions.setName(name);
|
|
|
|
credentialsModal.actions.save();
|
2024-06-14 05:48:49 -07:00
|
|
|
|
2024-08-09 07:31:02 -07:00
|
|
|
if (closeModal) {
|
|
|
|
credentialsModal.actions.close();
|
|
|
|
}
|
|
|
|
}
|