Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 22 additions & 0 deletions cypress/e2e/26_createOrgWithImage.cy.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
describe('Create Workspace With Image', () => {
it('creates a workspace with an uploaded image', () => {
const workspace: Cypress.Workspace = {
loggedInAs: 'carol',
name: 'New Workspace With Image',
description: 'We are testing workspace image upload during creation',
website: 'https://community.sphinx.chat',
github: 'https://github.com/stakwork/sphinx-tribes-frontend',
imageFileName: 'workspace-logo.png'
};

cy.login(workspace.loggedInAs);
cy.wait(1000);

cy.create_workspace(workspace);

cy.contains('Sucessfully created workspace').should('exist');
cy.contains(workspace.name).should('exist');

cy.logout(workspace.loggedInAs);
});
});
1 change: 1 addition & 0 deletions cypress/global.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,7 @@ declare namespace Cypress {
website?: string;
github?: string;
feature_call?: string;
imageFileName?: string;
};

type InvoiceDetail = {
Expand Down
17 changes: 17 additions & 0 deletions cypress/support/commands.ts
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,17 @@ import { bech32 } from 'bech32';
const EC = require('elliptic').ec;

const v2AdminToken = 'xyzxyzxyz';
const workspaceLogoPngBase64 =
'iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAQAAAC1HAwCAAAAC0lEQVR42mP8/x8AAwMCAO+/p9sAAAAASUVORK5CYII=';

function getWorkspaceLogoFile(fileName = 'workspace-logo.png') {
return {
contents: Cypress.Buffer.from(workspaceLogoPngBase64, 'base64'),
fileName,
mimeType: 'image/png',
lastModified: Date.now()
};
}

Cypress.Commands.add('login', (userAlias: string) => {
let user;
Expand Down Expand Up @@ -433,6 +444,12 @@ Cypress.Commands.add('create_workspace', (workspace) => {
cy.get('[placeholder="Github link..."]').type(workspace.github);
}

if (workspace.imageFileName) {
cy.get('#file-input').selectFile(getWorkspaceLogoFile(workspace.imageFileName), {
force: true
});
}

cy.contains('* Required fields').next().click();
});

Expand Down