Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(editor): Update image sizes in template description not to be full width always #8037

Merged
merged 4 commits into from
Dec 18, 2023
Merged
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
9 changes: 9 additions & 0 deletions cypress/e2e/29-templates.cy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,12 @@ import { TemplatesPage } from '../pages/templates';
import { WorkflowPage } from '../pages/workflow';

import OnboardingWorkflow from '../fixtures/Onboarding_workflow.json';
import WorkflowTemplate from '../fixtures/Workflow_template_write_http_query.json';
import { TemplateWorkflowPage } from '../pages/template-workflow';

const templatesPage = new TemplatesPage();
const workflowPage = new WorkflowPage();
const templateWorkflowPage = new TemplateWorkflowPage();

describe('Templates', () => {
it('can open onboarding flow', () => {
Expand All @@ -31,4 +34,10 @@ describe('Templates', () => {
workflowPage.getters.stickies().should('have.length', 1);
workflowPage.actions.shouldHaveWorkflowName(OnboardingWorkflow.name);
});

it('can open template with images and hides workflow screenshots', () => {
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

not the perfect test for this bug, but thought I would add a test here since this area is not covered at all

templateWorkflowPage.actions.openTemplate(WorkflowTemplate);

templateWorkflowPage.getters.description().find('img').should('have.length', 1);
});
});
188 changes: 188 additions & 0 deletions cypress/fixtures/Workflow_template_write_http_query.json

Large diffs are not rendered by default.

11 changes: 11 additions & 0 deletions cypress/pages/template-workflow.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ export class TemplateWorkflowPage extends BasePage {

getters = {
useTemplateButton: () => cy.get('[data-test-id="use-template-button"]'),
description: () => cy.get('[data-test-id="template-description"]')
};

actions = {
Expand All @@ -15,5 +16,15 @@ export class TemplateWorkflowPage extends BasePage {
clickUseThisWorkflowButton: () => {
this.getters.useTemplateButton().click();
},

openTemplate: (template: {workflow: {id: number, name: string, description: string, user: {username: string}, image: {id: number, url: string}[] }}) => {
cy.intercept('GET', `https://api.n8n.io/api/templates/workflows/${template.workflow.id}`, {
statusCode: 200,
body: template,
}).as('getTemplate');

this.actions.visit(template.workflow.id);
cy.wait('@getTemplate');
},
};
}
Original file line number Diff line number Diff line change
Expand Up @@ -247,10 +247,7 @@ export default defineComponent({
}

img {
width: 100%;
max-height: 90vh;
object-fit: cover;
border: var(--border-width-base) var(--color-foreground-base) var(--border-style-base);
max-width: 100%;
border-radius: var(--border-radius-large);
}

Expand Down
2 changes: 1 addition & 1 deletion packages/editor-ui/src/views/TemplatesWorkflowView.vue
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@
/>
</div>
<div :class="$style.content">
<div :class="$style.markdown">
<div :class="$style.markdown" data-test-id="template-description">
<n8n-markdown
:content="template && template.description"
:images="template && template.image"
Expand Down
Loading