|
|
|
|
@@ -1,4 +1,4 @@
|
|
|
|
|
import { INSTANCE_MEMBERS, INSTANCE_OWNER, INSTANCE_ADMIN } from '../constants';
|
|
|
|
|
import { INSTANCE_MEMBERS, INSTANCE_OWNER, INSTANCE_ADMIN, NOTION_NODE_NAME } from '../constants';
|
|
|
|
|
import {
|
|
|
|
|
CredentialsModal,
|
|
|
|
|
CredentialsPage,
|
|
|
|
|
@@ -8,6 +8,7 @@ import {
|
|
|
|
|
WorkflowsPage,
|
|
|
|
|
} from '../pages';
|
|
|
|
|
import { getVisibleSelect } from '../utils';
|
|
|
|
|
import * as projects from '../composables/projects';
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* User U1 - Instance owner
|
|
|
|
|
@@ -188,3 +189,177 @@ describe('Sharing', { disableAutoLogin: true }, () => {
|
|
|
|
|
credentialsModal.actions.close();
|
|
|
|
|
});
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
describe('Credential Usage in Cross Shared Workflows', () => {
|
|
|
|
|
beforeEach(() => {
|
|
|
|
|
cy.resetDatabase();
|
|
|
|
|
cy.enableFeature('advancedPermissions');
|
|
|
|
|
cy.enableFeature('projectRole:admin');
|
|
|
|
|
cy.enableFeature('projectRole:editor');
|
|
|
|
|
cy.changeQuota('maxTeamProjects', -1);
|
|
|
|
|
cy.reload();
|
|
|
|
|
cy.signinAsOwner();
|
|
|
|
|
cy.visit(credentialsPage.url);
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
it('should only show credentials from the same team project', () => {
|
|
|
|
|
cy.enableFeature('advancedPermissions');
|
|
|
|
|
cy.enableFeature('projectRole:admin');
|
|
|
|
|
cy.enableFeature('projectRole:editor');
|
|
|
|
|
cy.changeQuota('maxTeamProjects', -1);
|
|
|
|
|
|
|
|
|
|
// Create a notion credential in the home project
|
|
|
|
|
credentialsPage.getters.emptyListCreateCredentialButton().click();
|
|
|
|
|
credentialsModal.actions.createNewCredential('Notion API');
|
|
|
|
|
|
|
|
|
|
// Create a notion credential in one project
|
|
|
|
|
projects.actions.createProject('Development');
|
|
|
|
|
projects.getProjectTabCredentials().click();
|
|
|
|
|
credentialsPage.getters.emptyListCreateCredentialButton().click();
|
|
|
|
|
credentialsModal.actions.createNewCredential('Notion API');
|
|
|
|
|
|
|
|
|
|
// Create a notion credential in another project
|
|
|
|
|
projects.actions.createProject('Test');
|
|
|
|
|
projects.getProjectTabCredentials().click();
|
|
|
|
|
credentialsPage.getters.emptyListCreateCredentialButton().click();
|
|
|
|
|
credentialsModal.actions.createNewCredential('Notion API');
|
|
|
|
|
// Create a workflow with a notion node in the same project
|
|
|
|
|
projects.getProjectTabWorkflows().click();
|
|
|
|
|
workflowsPage.actions.createWorkflowFromCard();
|
|
|
|
|
workflowPage.actions.addNodeToCanvas(NOTION_NODE_NAME, true, true);
|
|
|
|
|
|
|
|
|
|
// Only the credential in this project (+ the 'Create new' option) should
|
|
|
|
|
// be in the dropdown
|
|
|
|
|
workflowPage.getters.nodeCredentialsSelect().click();
|
|
|
|
|
getVisibleSelect().find('li').should('have.length', 2);
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
it('should only show credentials in their personal project for members', () => {
|
|
|
|
|
cy.enableFeature('sharing');
|
|
|
|
|
cy.reload();
|
|
|
|
|
|
|
|
|
|
// Create a notion credential as the owner
|
|
|
|
|
credentialsPage.getters.emptyListCreateCredentialButton().click();
|
|
|
|
|
credentialsModal.actions.createNewCredential('Notion API');
|
|
|
|
|
|
|
|
|
|
// Create another notion credential as the owner, but share it with member
|
|
|
|
|
// 0
|
|
|
|
|
credentialsPage.getters.createCredentialButton().click();
|
|
|
|
|
credentialsModal.actions.createNewCredential('Notion API', false);
|
|
|
|
|
credentialsModal.actions.changeTab('Sharing');
|
|
|
|
|
credentialsModal.actions.addUser(INSTANCE_MEMBERS[0].email);
|
|
|
|
|
credentialsModal.actions.saveSharing();
|
|
|
|
|
|
|
|
|
|
// As the member, create a new notion credential and a workflow
|
|
|
|
|
cy.signinAsMember();
|
|
|
|
|
cy.visit(credentialsPage.url);
|
|
|
|
|
credentialsPage.getters.createCredentialButton().click();
|
|
|
|
|
credentialsModal.actions.createNewCredential('Notion API');
|
|
|
|
|
cy.visit(workflowsPage.url);
|
|
|
|
|
workflowsPage.actions.createWorkflowFromCard();
|
|
|
|
|
workflowPage.actions.addNodeToCanvas(NOTION_NODE_NAME, true, true);
|
|
|
|
|
|
|
|
|
|
// Only the own credential the shared one (+ the 'Create new' option)
|
|
|
|
|
// should be in the dropdown
|
|
|
|
|
workflowPage.getters.nodeCredentialsSelect().click();
|
|
|
|
|
getVisibleSelect().find('li').should('have.length', 3);
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
it('should only show credentials in their personal project for members if the workflow was shared with them', () => {
|
|
|
|
|
const workflowName = 'Test workflow';
|
|
|
|
|
cy.enableFeature('sharing');
|
|
|
|
|
cy.reload();
|
|
|
|
|
|
|
|
|
|
// Create a notion credential as the owner and a workflow that is shared
|
|
|
|
|
// with member 0
|
|
|
|
|
credentialsPage.getters.emptyListCreateCredentialButton().click();
|
|
|
|
|
credentialsModal.actions.createNewCredential('Notion API');
|
|
|
|
|
//cy.visit(workflowsPage.url);
|
|
|
|
|
projects.getProjectTabWorkflows().click();
|
|
|
|
|
workflowsPage.actions.createWorkflowFromCard();
|
|
|
|
|
workflowPage.actions.setWorkflowName(workflowName);
|
|
|
|
|
workflowPage.actions.openShareModal();
|
|
|
|
|
workflowSharingModal.actions.addUser(INSTANCE_MEMBERS[0].email);
|
|
|
|
|
workflowSharingModal.actions.save();
|
|
|
|
|
|
|
|
|
|
// As the member, create a new notion credential
|
|
|
|
|
cy.signinAsMember();
|
|
|
|
|
cy.visit(credentialsPage.url);
|
|
|
|
|
credentialsPage.getters.emptyListCreateCredentialButton().click();
|
|
|
|
|
credentialsModal.actions.createNewCredential('Notion API');
|
|
|
|
|
cy.visit(workflowsPage.url);
|
|
|
|
|
workflowsPage.getters.workflowCard(workflowName).click();
|
|
|
|
|
workflowPage.actions.addNodeToCanvas(NOTION_NODE_NAME, true, true);
|
|
|
|
|
|
|
|
|
|
// Only the own credential the shared one (+ the 'Create new' option)
|
|
|
|
|
// should be in the dropdown
|
|
|
|
|
workflowPage.getters.nodeCredentialsSelect().click();
|
|
|
|
|
getVisibleSelect().find('li').should('have.length', 2);
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
it("should show all credentials from all personal projects the workflow's been shared into for the global owner", () => {
|
|
|
|
|
const workflowName = 'Test workflow';
|
|
|
|
|
cy.enableFeature('sharing');
|
|
|
|
|
|
|
|
|
|
// As member 1, create a new notion credential. This should not show up.
|
|
|
|
|
cy.signinAsMember(1);
|
|
|
|
|
cy.visit(credentialsPage.url);
|
|
|
|
|
credentialsPage.getters.emptyListCreateCredentialButton().click();
|
|
|
|
|
credentialsModal.actions.createNewCredential('Notion API');
|
|
|
|
|
|
|
|
|
|
// As admin, create a new notion credential. This should show up.
|
|
|
|
|
cy.signinAsAdmin();
|
|
|
|
|
cy.visit(credentialsPage.url);
|
|
|
|
|
credentialsPage.getters.createCredentialButton().click();
|
|
|
|
|
credentialsModal.actions.createNewCredential('Notion API');
|
|
|
|
|
|
|
|
|
|
// As member 0, create a new notion credential and a workflow and share it
|
|
|
|
|
// with the global owner and the admin.
|
|
|
|
|
cy.signinAsMember();
|
|
|
|
|
cy.visit(credentialsPage.url);
|
|
|
|
|
credentialsPage.getters.emptyListCreateCredentialButton().click();
|
|
|
|
|
credentialsModal.actions.createNewCredential('Notion API');
|
|
|
|
|
cy.visit(workflowsPage.url);
|
|
|
|
|
workflowsPage.actions.createWorkflowFromCard();
|
|
|
|
|
workflowPage.actions.setWorkflowName(workflowName);
|
|
|
|
|
workflowPage.actions.openShareModal();
|
|
|
|
|
workflowSharingModal.actions.addUser(INSTANCE_OWNER.email);
|
|
|
|
|
workflowSharingModal.actions.addUser(INSTANCE_ADMIN.email);
|
|
|
|
|
workflowSharingModal.actions.save();
|
|
|
|
|
|
|
|
|
|
// As the global owner, create a new notion credential and open the shared
|
|
|
|
|
// workflow
|
|
|
|
|
cy.signinAsOwner();
|
|
|
|
|
cy.visit(credentialsPage.url);
|
|
|
|
|
credentialsPage.getters.createCredentialButton().click();
|
|
|
|
|
credentialsModal.actions.createNewCredential('Notion API');
|
|
|
|
|
cy.visit(workflowsPage.url);
|
|
|
|
|
workflowsPage.getters.workflowCard(workflowName).click();
|
|
|
|
|
workflowPage.actions.addNodeToCanvas(NOTION_NODE_NAME, true, true);
|
|
|
|
|
|
|
|
|
|
// Only the personal credentials of the workflow owner and the global owner
|
|
|
|
|
// should show up.
|
|
|
|
|
workflowPage.getters.nodeCredentialsSelect().click();
|
|
|
|
|
getVisibleSelect().find('li').should('have.length', 4);
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
it('should show all personal credentials if the global owner owns the workflow', () => {
|
|
|
|
|
cy.enableFeature('sharing');
|
|
|
|
|
|
|
|
|
|
// As member 0, create a new notion credential.
|
|
|
|
|
cy.signinAsMember();
|
|
|
|
|
cy.visit(credentialsPage.url);
|
|
|
|
|
credentialsPage.getters.emptyListCreateCredentialButton().click();
|
|
|
|
|
credentialsModal.actions.createNewCredential('Notion API');
|
|
|
|
|
|
|
|
|
|
// As the global owner, create a workflow and add a notion node
|
|
|
|
|
cy.signinAsOwner();
|
|
|
|
|
cy.visit(workflowsPage.url);
|
|
|
|
|
workflowsPage.actions.createWorkflowFromCard();
|
|
|
|
|
workflowPage.actions.addNodeToCanvas(NOTION_NODE_NAME, true, true);
|
|
|
|
|
|
|
|
|
|
// Show all personal credentials
|
|
|
|
|
workflowPage.getters.nodeCredentialsSelect().click();
|
|
|
|
|
getVisibleSelect().find('li').should('have.have.length', 2);
|
|
|
|
|
});
|
|
|
|
|
});
|
|
|
|
|
|