diff --git a/e2e_tests/integration/0.index.spec.js b/e2e_tests/integration/0.index.spec.js
index 9bc943d384c..01eea818439 100644
--- a/e2e_tests/integration/0.index.spec.js
+++ b/e2e_tests/integration/0.index.spec.js
@@ -25,7 +25,7 @@ import { isAura, isEnterpriseEdition } from '../support/utils'
const Editor = '.ReactCodeMirror textarea'
const Carousel = '[data-testid="carousel"]'
const SubmitQueryButton = '[data-testid="editorPlay"]'
-const ClearEditorButton = '[data-testid="editorClear"]'
+const ClearEditorButton = '[data-testid="editor-discard"]'
describe('Neo4j Browser', () => {
before(function() {
diff --git a/e2e_tests/integration/editor.spec.js b/e2e_tests/integration/editor.spec.js
index 712c086027d..061194b35e7 100644
--- a/e2e_tests/integration/editor.spec.js
+++ b/e2e_tests/integration/editor.spec.js
@@ -19,6 +19,9 @@
*/
/* global Cypress, cy, before */
+const fullscreenButton = '[data-testid="editor-fullscreen"]'
+const cardSizeButton = '[data-testid="editor-cardSize"]'
+const discardButton = '[data-testid="editor-discard"]'
describe('editor', () => {
before(function() {
@@ -50,4 +53,29 @@ describe('editor', () => {
cy.get('.CodeMirror-scroll').type(':history{control}{enter}')
cy.get('.CodeMirror-linenumber').should('contain', '$')
})
+
+ it('supports changing ui size from controls', () => {
+ cy.get('.CodeMirror-linenumber').should('contain', '$')
+
+ // Toggle card view and back
+ cy.get(cardSizeButton).click()
+ cy.get('.CodeMirror-linenumber').should('contain', '1')
+ cy.get(cardSizeButton).click()
+ cy.get('.CodeMirror-linenumber').should('contain', '$')
+
+ // toggle full screen and nback
+ cy.get(fullscreenButton).click()
+ cy.get('.CodeMirror-linenumber').should('contain', '1')
+ cy.get(fullscreenButton).click()
+ cy.get('.CodeMirror-linenumber').should('contain', '$')
+
+ // discard resets size and clears editor
+ cy.get(cardSizeButton).click()
+ cy.get('.CodeMirror-linenumber').should('contain', '1')
+ cy.get('body').type('/test')
+ cy.get('.CodeMirror-line').contains('test')
+ cy.get(discardButton).click()
+ cy.get('.CodeMirror-linenumber').should('contain', '$')
+ cy.get('.CodeMirror-line').should('not.contain.text', 'test')
+ })
})
diff --git a/e2e_tests/support/commands.js b/e2e_tests/support/commands.js
index 65e175c84de..9645bd9a293 100644
--- a/e2e_tests/support/commands.js
+++ b/e2e_tests/support/commands.js
@@ -1,7 +1,7 @@
import { executeCommand } from '../../src/shared/modules/commands/commandsDuck'
const SubmitQueryButton = '[data-testid="editorPlay"]'
-const ClearEditorButton = '[data-testid="editorClear"]'
+const ClearEditorButton = '[data-testid="editor-discard"]'
const Editor = '.ReactCodeMirror textarea'
const VisibleEditor = '[data-testid="editor-wrapper"]'
diff --git a/src/browser/modules/Editor/EditorFrame.tsx b/src/browser/modules/Editor/EditorFrame.tsx
index 299d08f8fef..37841780b38 100644
--- a/src/browser/modules/Editor/EditorFrame.tsx
+++ b/src/browser/modules/Editor/EditorFrame.tsx
@@ -91,21 +91,21 @@ export function EditorFrame({ bus }: EditorFrameProps) {
const buttons = [
{
onClick: toggleFullscreen,
- disabled: false,
title: isFullscreen ? 'Close fullscreen' : 'Fullscreen',
- icon: isFullscreen ? :
+ icon: isFullscreen ? : ,
+ testId: 'fullscreen'
},
{
onClick: toggleCardView,
- disabled: false,
- title: isCardSize ? 'Collapse' : 'Cardview',
- icon: isCardSize ? :
+ title: isCardSize ? 'Collapse' : 'Expand',
+ icon: isCardSize ? : ,
+ testId: 'cardSize'
},
{
onClick: discardEditor,
- disabled: false,
title: 'Discard',
- icon:
+ icon: ,
+ testId: 'discard'
}
]
@@ -114,8 +114,13 @@ export function EditorFrame({ bus }: EditorFrameProps) {
- {buttons.map(({ onClick, icon, title }) => (
-
+ {buttons.map(({ onClick, icon, title, testId }) => (
+
{icon}
))}