2022-11-24 14:22:09 -08:00
|
|
|
import { randFirstName, randLastName } from '@ngneat/falso';
|
|
|
|
import { DEFAULT_USER_EMAIL, DEFAULT_USER_PASSWORD } from '../constants';
|
2022-12-15 07:39:59 -08:00
|
|
|
import {
|
|
|
|
SettingsUsersPage,
|
|
|
|
SignupPage,
|
|
|
|
WorkflowsPage,
|
|
|
|
WorkflowPage,
|
|
|
|
CredentialsPage,
|
|
|
|
CredentialsModal,
|
|
|
|
MessageBox,
|
|
|
|
} from '../pages';
|
2022-12-20 01:52:01 -08:00
|
|
|
import { SettingsUsagePage } from '../pages/settings-usage';
|
2022-12-15 07:39:59 -08:00
|
|
|
|
|
|
|
import { MainSidebar, SettingsSidebar } from '../pages/sidebar';
|
2022-11-24 14:22:09 -08:00
|
|
|
|
|
|
|
const mainSidebar = new MainSidebar();
|
|
|
|
const settingsSidebar = new SettingsSidebar();
|
|
|
|
|
|
|
|
const workflowsPage = new WorkflowsPage();
|
|
|
|
const signupPage = new SignupPage();
|
|
|
|
const workflowPage = new WorkflowPage();
|
|
|
|
|
|
|
|
const credentialsPage = new CredentialsPage();
|
|
|
|
const credentialsModal = new CredentialsModal();
|
|
|
|
|
|
|
|
const settingsUsersPage = new SettingsUsersPage();
|
2022-12-20 01:52:01 -08:00
|
|
|
const settingsUsagePage = new SettingsUsagePage();
|
2022-11-24 14:22:09 -08:00
|
|
|
|
|
|
|
const messageBox = new MessageBox();
|
|
|
|
|
2022-11-28 09:11:33 -08:00
|
|
|
const email = DEFAULT_USER_EMAIL;
|
2022-11-24 14:22:09 -08:00
|
|
|
const password = DEFAULT_USER_PASSWORD;
|
|
|
|
const firstName = randFirstName();
|
|
|
|
const lastName = randLastName();
|
|
|
|
|
|
|
|
describe('Default owner', () => {
|
2022-12-07 09:16:38 -08:00
|
|
|
before(() => {
|
2022-11-28 09:11:33 -08:00
|
|
|
cy.resetAll();
|
2022-11-24 03:52:09 -08:00
|
|
|
});
|
2022-12-07 09:16:38 -08:00
|
|
|
beforeEach(() => {
|
|
|
|
cy.visit('/');
|
2022-12-15 07:39:59 -08:00
|
|
|
});
|
2022-11-24 03:52:09 -08:00
|
|
|
|
2022-12-07 09:16:38 -08:00
|
|
|
it('should skip owner setup', () => {
|
|
|
|
cy.skipSetup();
|
|
|
|
});
|
2022-11-24 14:22:09 -08:00
|
|
|
|
2022-12-07 09:16:38 -08:00
|
|
|
it('should be able to create workflows', () => {
|
|
|
|
workflowsPage.getters.newWorkflowButtonCard().should('be.visible');
|
|
|
|
workflowsPage.getters.newWorkflowButtonCard().click();
|
2022-11-24 14:22:09 -08:00
|
|
|
|
2022-12-07 09:16:38 -08:00
|
|
|
cy.createFixtureWorkflow('Test_workflow_1.json', `Test workflow`);
|
2022-11-24 14:22:09 -08:00
|
|
|
|
2022-12-07 09:16:38 -08:00
|
|
|
// reload page, ensure owner still has access
|
|
|
|
cy.reload();
|
2022-11-24 14:22:09 -08:00
|
|
|
|
2022-12-07 09:16:38 -08:00
|
|
|
workflowPage.getters.workflowNameInput().should('contain.value', 'Test workflow');
|
|
|
|
});
|
2022-11-24 14:22:09 -08:00
|
|
|
|
2022-12-07 09:16:38 -08:00
|
|
|
it('should be able to add new credentials', () => {
|
|
|
|
cy.visit(credentialsPage.url);
|
2022-11-24 14:22:09 -08:00
|
|
|
|
2022-12-07 09:16:38 -08:00
|
|
|
credentialsPage.getters.emptyListCreateCredentialButton().click();
|
2022-11-24 14:22:09 -08:00
|
|
|
|
2022-12-07 09:16:38 -08:00
|
|
|
credentialsModal.getters.newCredentialModal().should('be.visible');
|
|
|
|
credentialsModal.getters.newCredentialTypeSelect().should('be.visible');
|
|
|
|
credentialsModal.getters.newCredentialTypeOption('Notion API').click();
|
2022-11-24 14:22:09 -08:00
|
|
|
|
2022-12-07 09:16:38 -08:00
|
|
|
credentialsModal.getters.newCredentialTypeButton().click();
|
2022-11-24 14:22:09 -08:00
|
|
|
|
2022-12-07 09:16:38 -08:00
|
|
|
credentialsModal.getters.connectionParameter('API Key').type('1234567890');
|
2022-11-24 14:22:09 -08:00
|
|
|
|
2022-12-07 09:16:38 -08:00
|
|
|
credentialsModal.actions.setName('My awesome Notion account');
|
|
|
|
credentialsModal.actions.save();
|
2022-11-24 14:22:09 -08:00
|
|
|
|
2022-12-07 09:16:38 -08:00
|
|
|
credentialsModal.actions.close();
|
2022-11-24 14:22:09 -08:00
|
|
|
|
2022-12-07 09:16:38 -08:00
|
|
|
credentialsModal.getters.newCredentialModal().should('not.exist');
|
|
|
|
credentialsModal.getters.editCredentialModal().should('not.exist');
|
2022-11-24 14:22:09 -08:00
|
|
|
|
2022-12-07 09:16:38 -08:00
|
|
|
credentialsPage.getters.credentialCards().should('have.length', 1);
|
|
|
|
});
|
2022-11-24 14:22:09 -08:00
|
|
|
|
2022-12-07 09:16:38 -08:00
|
|
|
it('should be able to setup UM from settings', () => {
|
|
|
|
mainSidebar.getters.settings().should('be.visible');
|
|
|
|
mainSidebar.actions.goToSettings();
|
2022-12-20 01:52:01 -08:00
|
|
|
cy.url().should('include', settingsUsagePage.url);
|
|
|
|
|
|
|
|
settingsSidebar.actions.goToUsers();
|
2022-12-07 09:16:38 -08:00
|
|
|
cy.url().should('include', settingsUsersPage.url);
|
2022-11-24 14:22:09 -08:00
|
|
|
|
2022-12-07 09:16:38 -08:00
|
|
|
settingsUsersPage.actions.goToOwnerSetup();
|
2022-11-24 14:22:09 -08:00
|
|
|
|
2022-12-07 09:16:38 -08:00
|
|
|
cy.url().should('include', signupPage.url);
|
|
|
|
});
|
2022-11-24 14:22:09 -08:00
|
|
|
|
2022-12-07 09:16:38 -08:00
|
|
|
it('should be able to setup instance and migrate workflows and credentials', () => {
|
|
|
|
cy.setup({ email, firstName, lastName, password });
|
2022-11-24 14:22:09 -08:00
|
|
|
|
2022-12-15 07:39:59 -08:00
|
|
|
messageBox.getters.content().should('contain.text', '1 existing workflow and 1 credential');
|
2022-11-24 14:22:09 -08:00
|
|
|
|
2022-12-07 09:16:38 -08:00
|
|
|
messageBox.actions.confirm();
|
|
|
|
cy.url().should('include', settingsUsersPage.url);
|
|
|
|
settingsSidebar.actions.back();
|
2022-11-24 14:22:09 -08:00
|
|
|
|
2022-12-07 09:16:38 -08:00
|
|
|
cy.url().should('include', workflowsPage.url);
|
2022-11-24 14:22:09 -08:00
|
|
|
|
2022-12-07 09:16:38 -08:00
|
|
|
workflowsPage.getters.workflowCards().should('have.length', 1);
|
|
|
|
});
|
2022-11-24 14:22:09 -08:00
|
|
|
|
2022-12-07 09:16:38 -08:00
|
|
|
it('can click back to main menu and have migrated credential after setup', () => {
|
|
|
|
cy.signin({ email, password });
|
|
|
|
cy.visit(workflowsPage.url);
|
2022-11-24 14:22:09 -08:00
|
|
|
|
2022-12-07 09:16:38 -08:00
|
|
|
mainSidebar.actions.goToCredentials();
|
2022-11-24 14:22:09 -08:00
|
|
|
|
2022-12-07 09:16:38 -08:00
|
|
|
cy.url().should('include', credentialsPage.url);
|
2022-11-24 14:22:09 -08:00
|
|
|
|
2022-12-07 09:16:38 -08:00
|
|
|
credentialsPage.getters.credentialCards().should('have.length', 1);
|
2022-11-24 14:22:09 -08:00
|
|
|
});
|
2022-11-24 03:52:09 -08:00
|
|
|
});
|