import { test } from 'substance-test'
import setupTestApp from './shared/setupTestApp'

test('ArticlePanel: open every view', t => {
  let { app } = setupTestApp(t)
  let articlePanel = app.find('.sc-article-panel')
  articlePanel.send('updateViewName', 'manuscript')
  articlePanel.send('updateViewName', 'metadata')
  t.pass('ArticlePanel should be able to open all views without errors.')
  t.end()
})

@@ -84,310 +84,906 @@
 pp'%0A
-%0Atest('ArticlePanel: open every view', t =%3E %7B%0A  let %7B app %7D = setupTestApp(t)%0A  let articlePanel = app.find('.sc-article-panel')%0A  articlePanel.send('updateViewName', 'manuscript')%0A  articlePanel.send('updateViewName', 'metadata')%0A  t.pass('ArticlePanel should be able to open all views without errors.
+import %7B openManuscriptEditor, openMetadataEditor %7D from './shared/integrationTestHelpers'%0A%0Aconst SWITCH_MODE_TOOL_DROPDOWN_SELECTOR = '.sc-tool-dropdown.sm-mode'%0A%0Atest('ArticlePanel: open every view', t =%3E %7B%0A  let %7B app %7D = setupTestApp(t)%0A  openManuscriptEditor(app)%0A  openMetadataEditor(app)%0A  t.pass('ArticlePanel should be able to open all views without errors.')%0A  t.end()%0A%7D)%0A%0Atest('ArticlePanel: using switch view', t =%3E %7B%0A  let %7B app %7D = setupTestApp(t)%0A  openManuscriptEditor(app)%0A  let dropdown = app.find(SWITCH_MODE_TOOL_DROPDOWN_SELECTOR)%0A  dropdown.find('button.se-toggle').click()%0A  openMetadataEditor(app)%0A  dropdown.find('button.sm-open-metadata').click()%0A  let metadataEditor = app.find('.sc-metadata-editor')%0A  t.notNil(metadataEditor, 'metadata editor should be displayed now')%0A  t.equal(metadataEditor.context.appState.viewName, 'metadata', 'appState.viewName should be correct
 ')%0A 

Test switch view toggle.