Skip to content

Commit

Permalink
Rename Markdown Editor on all tests
Browse files Browse the repository at this point in the history
  • Loading branch information
diocas committed Apr 7, 2022
1 parent 7a46ce6 commit 46a5bdc
Show file tree
Hide file tree
Showing 14 changed files with 63 additions and 63 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@
"test:integration": "jest --config ./tests/integration/config/jest.config.js",
"test:e2e:cucumber": "NODE_TLS_REJECT_UNAUTHORIZED=0 cucumber-js --profile=e2e -f json:tests/e2e/cucumber/report/cucumber_report.json",
"test:unit": "NODE_OPTIONS=--unhandled-rejections=throw jest --coverage --config ./tests/unit/config/jest.config.js",
"licenses:check": "license-checker-rseidelsohn --summary --relativeLicensePath --onlyAllow 'Python-2.0;Apache*;Apache License, Version 2.0;Apache-2.0;Apache 2.0;Artistic-2.0;BSD;BSD-3-Clause;CC-BY-3.0;CC-BY-4.0;CC0-1.0;ISC;MIT;MPL-2.0;Public Domain;Unicode-TOU;Unlicense;WTFPL' --excludePackages 'draw-io;external;files;markdown-editor;preview;owncloud-design-system;pdf-viewer;search;user-management;web-client;web-pkg;web-runtime'",
"licenses:check": "license-checker-rseidelsohn --summary --relativeLicensePath --onlyAllow 'Python-2.0;Apache*;Apache License, Version 2.0;Apache-2.0;Apache 2.0;Artistic-2.0;BSD;BSD-3-Clause;CC-BY-3.0;CC-BY-4.0;CC0-1.0;ISC;MIT;MPL-2.0;Public Domain;Unicode-TOU;Unlicense;WTFPL' --excludePackages 'draw-io;external;files;simple-editor;preview;owncloud-design-system;pdf-viewer;search;user-management;web-client;web-pkg;web-runtime'",
"licenses:csv": "license-checker-rseidelsohn --relativeLicensePath --csv --out ./third-party-licenses/third-party-licenses.csv",
"licenses:save": "license-checker-rseidelsohn --relativeLicensePath --out /dev/null --files ./third-party-licenses/third-party-licenses"
},
Expand Down
20 changes: 10 additions & 10 deletions packages/web-app-files/tests/__fixtures__/fileActions.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,9 @@ const meta = {
id: 'draw-io',
icon: 'grid'
},
'markdown-editor': {
name: 'MarkdownEditor',
id: 'markdown-editor',
'simple-editor': {
name: 'SimpleEditor',
id: 'simple-editor',
icon: 'file-text'
}
}
Expand Down Expand Up @@ -49,12 +49,12 @@ const editors = [
routes
},
{
app: 'markdown-editor',
app: 'simple-editor',
extension: 'md',
handler: null,
icon: null,
newTab: false,
routeName: 'markdown-editor',
routeName: 'simple-editor',
routes
}
]
Expand Down Expand Up @@ -131,11 +131,11 @@ const fileActions = {
selector: '.oc-files-actions-delete-trigger'
},

'markdown-editor': {
'simple-editor': {
handler: jest.fn(),
label: () => 'Open in Markdown Editor',
class: 'oc-files-actions-markdown-editor-trigger',
selector: '.oc-files-actions-markdown-editor-trigger',
label: () => 'Open in Simple Editor',
class: 'oc-files-actions-simple-editor-trigger',
selector: '.oc-files-actions-simple-editor-trigger',
opensInNewWindow: true
},
'draw-io': {
Expand Down Expand Up @@ -165,7 +165,7 @@ const fileActions = {
exports.fileActions = fileActions

exports.getActions = function (actions = []) {
const defaultActions = ['download', 'markdown-editor', 'draw-io', 'preview', 'navigate']
const defaultActions = ['download', 'simple-editor', 'draw-io', 'preview', 'navigate']

const res = []
for (const key of actions) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ const newFileHandlers = [
{
ext: 'txt',
action: {
app: 'markdown-editor',
app: 'simple-editor',
newTab: false,
extension: 'txt'
},
Expand All @@ -45,7 +45,7 @@ const newFileHandlers = [
{
ext: 'md',
action: {
app: 'markdown-editor',
app: 'simple-editor',
newTab: false,
extension: 'md'
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,8 @@ const mockMenuSections = [
handler: jest.fn(),
label: () => 'Open in editor',
componentType: 'oc-button',
selector: '.oc-files-actions-markdown-editor-trigger',
class: 'oc-files-actions-markdown-editor-trigger'
selector: '.oc-files-actions-simple-editor-trigger',
class: 'oc-files-actions-simple-editor-trigger'
},
...exampleApps.map((app) => {
return {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
exports[`ContextActions menu items renders a list of actions for a file 1`] = `
<div id="oc-files-context-menu">
<oc-list-stub id="oc-files-context-actions-context" class="oc-files-context-actions oc-pb-s oc-files-context-actions-border">
<li class="oc-files-context-action oc-px-s oc-rounded"><button type="button" class="oc-button oc-rounded oc-button-s oc-button-justify-content-center oc-button-gap-m oc-button-passive oc-button-passive-raw oc-files-actions-markdown-editor-trigger action-menu-item" data-testid="action-handler">
<li class="oc-files-context-action oc-px-s oc-rounded"><button type="button" class="oc-button oc-rounded oc-button-s oc-button-justify-content-center oc-button-gap-m oc-button-passive oc-button-passive-raw oc-files-actions-simple-editor-trigger action-menu-item" data-testid="action-handler">
<oc-icon-stub name="file-text" filltype="line" accessiblelabel="" type="span" size="medium" variation="passive" color="" data-testid="action-icon"></oc-icon-stub> <span data-testid="action-label" class="oc-files-context-action-label">Open in editor</span>
<!---->
</button></li>
Expand Down Expand Up @@ -66,7 +66,7 @@ exports[`ContextActions menu items renders a list of actions for a file 1`] = `
exports[`ContextActions menu items renders a list of actions for a folder 1`] = `
<div id="oc-files-context-menu">
<oc-list-stub id="oc-files-context-actions-context" class="oc-files-context-actions oc-pb-s oc-files-context-actions-border">
<li class="oc-files-context-action oc-px-s oc-rounded"><button type="button" class="oc-button oc-rounded oc-button-s oc-button-justify-content-center oc-button-gap-m oc-button-passive oc-button-passive-raw oc-files-actions-markdown-editor-trigger action-menu-item" data-testid="action-handler">
<li class="oc-files-context-action oc-px-s oc-rounded"><button type="button" class="oc-button oc-rounded oc-button-s oc-button-justify-content-center oc-button-gap-m oc-button-passive oc-button-passive-raw oc-files-actions-simple-editor-trigger action-menu-item" data-testid="action-handler">
<oc-icon-stub name="file-text" filltype="line" accessiblelabel="" type="span" size="medium" variation="passive" color="" data-testid="action-icon"></oc-icon-stub> <span data-testid="action-label" class="oc-files-context-action-label">Open in editor</span>
<!---->
</button></li>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,8 @@ const filesPersonalRoute = { name: 'files-personal' }
const systemDefaultActions = [
[['copy']],
[['copy', 'move']],
[['copy', 'markdown-editor']],
[['copy', 'move', 'download', 'markdown-editor']]
[['copy', 'simple-editor']],
[['copy', 'move', 'download', 'simple-editor']]
]

describe('FileActions', () => {
Expand All @@ -32,7 +32,7 @@ describe('FileActions', () => {
jest.clearAllMocks()
})
it('renders action handlers as clickable elements', async () => {
const actions = ['copy', 'move', 'download', 'markdown-editor']
const actions = ['copy', 'move', 'download', 'simple-editor']
const wrapper = getWrapper(filesPersonalRoute, actions)

for (const button of actions) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ Feature: User can see the file or folder actions menu options
Then the app-sidebar for file "lorem.txt" should be visible on the webUI
And only the following items with default items should be visible in the actions menu on the webUI
| items |
| open in markdowneditor |
| open in simpleditor |
| download |
When the user opens the actions sidebar panel of file "lorem.pdf" on the webUI
Then the app-sidebar for file "lorem.pdf" should be visible on the webUI
Expand Down
12 changes: 6 additions & 6 deletions tests/acceptance/pageObjects/FilesPageElement/fileActionsMenu.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ module.exports = {
move: 'move',
copy: 'copy',
preview: 'preview',
markdownEditor: 'markdownEditor'
simpleEditor: 'simpleEditor'
}),

/**
Expand Down Expand Up @@ -167,10 +167,10 @@ module.exports = {
return this.performFileAction(this.FileAction.preview)
},
/**
* Open a resource in the markdown editor via its file action
* Open a resource in the simple editor via its file action
*/
markdownEditor: function () {
return this.performFileAction(this.FileAction.markdownEditor)
simpleEditor: function () {
return this.performFileAction(this.FileAction.simpleEditor)
}
},
elements: {
Expand Down Expand Up @@ -236,8 +236,8 @@ module.exports = {
selector: '//button[normalize-space()="Preview"]',
locateStrategy: 'xpath'
},
markdownEditorButtonInAccordion: {
selector: '//button[normalize-space()="Open in MarkdownEditor"]',
simpleEditorButtonInAccordion: {
selector: '//button[normalize-space()="Open in SimpleEditor"]',
locateStrategy: 'xpath'
}
}
Expand Down
2 changes: 1 addition & 1 deletion tests/acceptance/pageObjects/personalPage.js
Original file line number Diff line number Diff line change
Expand Up @@ -439,7 +439,7 @@ module.exports = {
selector: '.oc-files-actions-copy-trigger'
},
editorCloseBtn: {
selector: '#markdown-editor-app-bar .oc-text-right .oc-button'
selector: '#simple-editor-app-bar .oc-text-right .oc-button'
},
clearSelectionBtn: {
selector: '#files-clear-selection'
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ module.exports = {
saveFileEdit: function () {
return this.waitForElementVisible('@saveButton').click('@saveButton')
},
closeMarkdownEditor: function () {
closeSimpleEditor: function () {
return this.waitForElementVisible('@closeButton').click('@closeButton')
},
/**
Expand Down Expand Up @@ -72,25 +72,25 @@ module.exports = {
*/
openMdEditorUsingActionMenu: async function (fileName) {
await filesList.openFileActionsMenu(fileName)
await filesActionsMenu.markdownEditor()
await filesActionsMenu.simpleEditor()
return this
}
},
elements: {
editorTextarea: {
selector: '#markdown-editor-input'
selector: '#simple-editor-input'
},
saveButton: {
selector: '#markdown-editor-controls-save'
selector: '#simple-editor-controls-save'
},
closeButton: {
selector: '#markdown-editor-controls-close'
selector: '#simple-editor-controls-close'
},
fileName: {
selector: '#markdown-editor-file-path'
selector: '#simple-editor-file-path'
},
previewPanel: {
selector: '#markdown-editor-preview'
selector: '#simple-editor-preview'
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -3,60 +3,60 @@ const assert = require('assert')
const _ = require('lodash')
const { Given, When, Then } = require('@cucumber/cucumber')

const markdownEditor = client.page.markdownEditorPage()
const simpleEditor = client.page.simpleEditorPage()
const filesList = client.page.FilesPageElement.filesList()

Given('the user has opened file {string} in the markdown editor webUI', async (fileName) => {
Given('the user has opened file {string} in the simple editor webUI', async (fileName) => {
await filesList.clickOnFileName(fileName)
await markdownEditor.waitForPageLoaded()
const actualFileName = await markdownEditor.getFileName()
await simpleEditor.waitForPageLoaded()
const actualFileName = await simpleEditor.getFileName()
return assertEqualText(fileName, actualFileName)
})

When('the user opens file {string} in the markdown editor webUI', (fileName) => {
When('the user opens file {string} in the simple editor webUI', (fileName) => {
return filesList.clickOnFileName(fileName)
})

When('the user inputs the content {string} in the markdown editor webUI', async (content) => {
return await markdownEditor.updateFileContent(content)
When('the user inputs the content {string} in the simple editor webUI', async (content) => {
return await simpleEditor.updateFileContent(content)
})

When('the user appends the content {string} in the markdown editor webUI', async (content) => {
return await markdownEditor.appendContentToFile(content)
When('the user appends the content {string} in the simple editor webUI', async (content) => {
return await simpleEditor.appendContentToFile(content)
})

When('the user saves the file in the markdown editor webUI', async () => {
return await markdownEditor.saveFileEdit()
When('the user saves the file in the simple editor webUI', async () => {
return await simpleEditor.saveFileEdit()
})

When('the user closes the markdown editor using the webUI', async () => {
return await markdownEditor.closeMarkdownEditor()
When('the user closes the simple editor using the webUI', async () => {
return await simpleEditor.closeSimpleEditor()
})

Then('the file {string} should be displayed in the markdown editor webUI', async (fileName) => {
const actualFileName = await markdownEditor.getFileName()
Then('the file {string} should be displayed in the simple editor webUI', async (fileName) => {
const actualFileName = await simpleEditor.getFileName()
return assertEqualText(fileName, actualFileName)
})

Then('the file should have content {string} in the markdown editor webUI', async (content) => {
const contentInEditor = await markdownEditor.getContentFromEditor()
Then('the file should have content {string} in the simple editor webUI', async (content) => {
const contentInEditor = await simpleEditor.getContentFromEditor()
return assertEqualText(content, contentInEditor, 'content')
})

Then('the file should not have content {string} in the markdown editor webUI', async (content) => {
const contentInEditor = await markdownEditor.getContentFromEditor()
Then('the file should not have content {string} in the simple editor webUI', async (content) => {
const contentInEditor = await simpleEditor.getContentFromEditor()
return assertNotEqualText(content, contentInEditor, 'content')
})

Then('the preview panel should have the content {string} on the webUI', async (content) => {
const contentInPreview = await markdownEditor.getContentFromPanel()
const contentInPreview = await simpleEditor.getContentFromPanel()
return assertEqualText(content, contentInPreview, 'content')
})

When(
'the user opens file {string} in the markdown editor using the action menu option on the webUI',
'the user opens file {string} in the simple editor using the action menu option on the webUI',
async (fileName) => {
return await markdownEditor.openMdEditorUsingActionMenu(fileName)
return await simpleEditor.openMdEditorUsingActionMenu(fileName)
}
)

Expand All @@ -73,7 +73,7 @@ const assertEqualText = (expected, actual, type = 'file') => {
error =
'File "' +
expected +
'" expected to be opened in the markdown editor but found "' +
'" expected to be opened in the simple editor but found "' +
actual +
'"'
} else if (type === 'content') {
Expand All @@ -85,15 +85,15 @@ const assertEqualText = (expected, actual, type = 'file') => {
const assertNotEqualText = (expected, actual, type = 'file') => {
let error = ''
if (type === 'file') {
error = 'File "' + expected + '" expected not to be opened in the markdown editor but found'
error = 'File "' + expected + '" expected not to be opened in the simple editor but found'
} else if (type === 'content') {
error = 'File expected not to have content "' + expected + '" but found.'
}
return assert.notStrictEqual(actual, expected, error)
}

const assertHasElementWithText = async (tagName, innerText) => {
const previewPanel = markdownEditor.getPreviewPanelElement()
const previewPanel = simpleEditor.getPreviewPanelElement()
const searchElement = previewPanel + ' > ' + tagName
let hasElement = false

Expand Down
2 changes: 1 addition & 1 deletion tests/drone/config-oc10-oauth.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
"apps": [
"files",
"draw-io",
"markdown-editor",
"simple-editor",
"preview",
"pdf-viewer",
"search"
Expand Down
2 changes: 1 addition & 1 deletion tests/drone/config-oc10-openid.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
"apps": [
"files",
"draw-io",
"markdown-editor",
"simple-editor",
"preview",
"pdf-viewer",
"search"
Expand Down
2 changes: 1 addition & 1 deletion tests/drone/config-ocis.json
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
"apps": [
"files",
"draw-io",
"markdown-editor",
"simple-editor",
"preview",
"pdf-viewer",
"search"
Expand Down

0 comments on commit 46a5bdc

Please sign in to comment.