Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/main' into 3760-add-editor-dashb…
Browse files Browse the repository at this point in the history
…oard-button

# Conflicts:
#	frontend/src/pages/instance/Editor/index.vue
  • Loading branch information
cstns committed Apr 24, 2024
2 parents 81e63cc + 40ed80b commit f5cecda
Show file tree
Hide file tree
Showing 6 changed files with 95 additions and 31 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
referrerpolicy="strict-origin-when-cross-origin"
allowfullscreen
:style="{'pointer-events': disableEvents ? 'none' : 'auto'}"
data-el="editor-iframe"
/>
</section>
</template>
Expand Down
4 changes: 3 additions & 1 deletion frontend/src/pages/instance/Editor/index.vue
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
class="tabs-wrapper drawer"
:class="{'open': drawer.open, resizing: drawer.resizing}"
:style="{ height: drawer.height + 'px' }"
data-el="tabs-wrapper"
data-el="tabs-drawer"
>
<resize-bar
:is-handle-visible="drawer.open"
Expand Down Expand Up @@ -72,6 +72,7 @@ import InstanceStatusPolling from '../../../components/InstanceStatusPolling.vue
import FfPage from '../../../layouts/Page.vue'
import instanceMixin from '../../../mixins/Instance.js'
import FfTabs from '../../../ui-components/components/tabs/Tabs.vue'
import ConfirmInstanceDeleteDialog from '../Settings/dialogs/ConfirmInstanceDeleteDialog.vue'
import DashboardLink from '../components/DashboardLink.vue'
Expand All @@ -86,6 +87,7 @@ export default {
DashboardLink,
MiddleCloseButton,
DrawerTrigger,
FfTabs,
EditorWrapper,
ConfirmInstanceDeleteDialog,
InstanceStatusPolling,
Expand Down
2 changes: 1 addition & 1 deletion frontend/src/pages/instance/components/EditorLink.vue
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ export default {
return this.$router.resolve({ name: 'instance-editor', params: { id: this.instance.id } }).fullPath
}
return this.instance.url
return this.instance.url || this.instance.editor?.url
}
},
methods: {
Expand Down
8 changes: 7 additions & 1 deletion frontend/src/pages/team/Applications.vue
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,12 @@

<ul v-if="application.instances.size > 0" class="ff-applications-list-instances" data-el="application-instances">
<label>Instances</label>
<li v-for="instance in Array.from(application.instances.values())" :key="instance.id" @click.stop="openInstance(instance)">
<li
v-for="instance in Array.from(application.instances.values())"
:key="instance.id"
data-el="application-instance-item"
@click.stop="openInstance(instance)"
>
<span class="flex justify-center mr-3">
<IconNodeRedSolid class="ff-icon ff-icon-lg text-red-800" />
</span>
Expand Down Expand Up @@ -118,6 +123,7 @@
<div class="flex justify-end text-sm">
<EditorLink
:instance="device"
:url="device.editor?.url"
:editorDisabled="false"
:disabled="!device.editor?.enabled || !device.editor?.connected || !device.editor?.local"
Expand Down
81 changes: 68 additions & 13 deletions test/e2e/frontend/cypress/tests/applications/overview.spec.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
describe('FlowForge - Application - Overview', () => {
describe('FlowForge - Applications', () => {
function navigateToApplication (teamName, projectName) {
cy.request('GET', '/api/v1/user/teams')
.then((response) => {
Expand All @@ -18,22 +18,77 @@ describe('FlowForge - Application - Overview', () => {

beforeEach(() => {
cy.intercept('GET', '/api/*/applications/*').as('getApplication')

cy.login('bob', 'bbPassword')
cy.home()
})

it('shows a list of cloud hosted instances', () => {
navigateToApplication('BTeam', 'application-2')
describe('Listing', () => {
it('shows a list of cloud hosted instances', () => {
cy.home()

cy.get('[data-el="cloud-instances"]').find('tbody tr').should('have.length', 2)
navigateToApplication('BTeam', 'application-2')

cy.get('[data-el="cloud-instances"]').contains('instance-2-1')
cy.get('[data-el="cloud-instances"]').contains('instance-2-with-devices')
})
cy.get('[data-el="cloud-instances"]').find('tbody tr').should('have.length', 2)

cy.get('[data-el="cloud-instances"]').contains('instance-2-1')
cy.get('[data-el="cloud-instances"]').contains('instance-2-with-devices')
})

it('shows the appropriate Open Editor button dependent on the instance\'s nr-launcher version', () => {
cy.intercept(
'GET',
'/api/*/teams/*/applications*',
(req) => req.reply(res => {
res.body = {
applications: [
{
instancesSummary: {
instances: [
{
name: 'immersive-compatible-instance',
meta: {
versions: {
launcher: '2.3.1'
}
}
},
{
name: 'immersive-incompatible-instance',
meta: {
versions: {
launcher: '2.3.0'
}
}
}
]
}
}
]
}
return res
})
).as('getApplication1')

it('Start an instance')
it('Restart an instance')
it('Suspend an instance')
it('Delete an instance')
cy.visit('/')

cy.wait('@getApplication1')

cy.get('[data-el="application-instance-item"')
.contains('immersive-compatible-instance')
.parent()
.parent()
.within(() => {
cy.get('[data-action="open-editor"]')
.should('not.have.descendants')
})

cy.get('[data-el="application-instance-item"')
.contains('immersive-incompatible-instance')
.parent()
.parent()
.within(() => {
cy.get('[data-action="open-editor"]')
.should('have.descendants', 'span.ff-btn--icon')
})
})
})
})
30 changes: 15 additions & 15 deletions test/e2e/frontend/cypress/tests/instances/editor.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ describe('FlowForge - Instance editor', () => {

cy.wait('@getProjects')

cy.get('button[data-action="open-editor"]')
cy.get('[data-action="open-editor"]')
.children()
.should('exist')
})
Expand All @@ -52,14 +52,14 @@ describe('FlowForge - Instance editor', () => {

cy.wait('@getProjects')

cy.get('button[data-action="open-editor"]')
cy.get('[data-action="open-editor"]')
.children()
.should('not.exist')

cy.get('button[data-action="open-editor"]').click()
cy.get('[data-action="open-editor"]').click()

cy.get('iframe').should('exist')
cy.get('.tabs-wrapper').should('exist')
cy.get('[data-el="editor-iframe"]').should('exist')
cy.get('[data-el="tabs-drawer"]').should('exist')
})

it('has working drawer navigation tabs', () => {
Expand Down Expand Up @@ -88,52 +88,52 @@ describe('FlowForge - Instance editor', () => {
cy.visit(`/instance/${instance.id}/editor`)
})

cy.get('iframe')
cy.get('[data-el="editor-iframe"]')
.should('exist')

cy.get('.tabs-wrapper').as('tabs-wrapper').should('exist')
cy.get('[data-el="tabs-drawer"]').as('tabs-wrapper').should('exist')
cy.get('@tabs-wrapper').contains('Info')
cy.get('@tabs-wrapper').contains('Recent Activity')
cy.get('@tabs-wrapper').contains('Specs')

cy.get('a[data-nav="instance-remote"]').as('remote-tab').should('exist')
cy.get('[data-nav="instance-remote"]').as('remote-tab').should('exist')
cy.get('@remote-tab').click()
cy.get('@tabs-wrapper').contains('Devices')
cy.get('@tabs-wrapper').contains('A list of all edge devices registered to this instance.')

cy.get('a[data-nav="instance-snapshots"]').as('snapshots-tab').should('exist')
cy.get('[data-nav="instance-snapshots"]').as('snapshots-tab').should('exist')
cy.get('@snapshots-tab').click()
cy.get('@tabs-wrapper').contains('Snapshots')
cy.get('@tabs-wrapper').contains('Create your First Snapshot')

cy.get('a[data-nav="instance-activity"]').as('activity-tab').should('exist')
cy.get('[data-nav="instance-activity"]').as('activity-tab').should('exist')
cy.get('@activity-tab').click()
cy.get('@tabs-wrapper').contains('Audit Log')
cy.get('@tabs-wrapper').contains('Filters')
cy.get('@tabs-wrapper').contains('Event Type')
cy.get('@tabs-wrapper').contains('User')

cy.get('a[data-nav="instance-logs"]').as('logs-tab').should('exist')
cy.get('[data-nav="instance-logs"]').as('logs-tab').should('exist')
cy.get('@logs-tab').click()
cy.get('@tabs-wrapper').contains('Node-RED Logs')
cy.get('@tabs-wrapper').contains('Fake Log Entry')

cy.get('a[data-nav="instance-settings"]').as('settings-tab').should('exist')
cy.get('a[data-nav="instance-settings"]').click()
cy.get('[data-nav="instance-settings"]').as('settings-tab').should('exist')
cy.get('[data-nav="instance-settings"]').click()
cy.get('@tabs-wrapper').contains('Settings')
cy.get('@tabs-wrapper').contains('General')
cy.get('@tabs-wrapper').contains('Environment')
cy.get('@tabs-wrapper').contains('Editor')
cy.get('@tabs-wrapper').contains('Security')
cy.get('@tabs-wrapper').contains('Palette')

cy.get('a[data-nav="instance-overview"]').click()
cy.get('[data-nav="instance-overview"]').click()
cy.get('@tabs-wrapper').contains('Info')
cy.get('@tabs-wrapper').contains('Recent Activity')
cy.get('@tabs-wrapper').contains('Specs')

cy.get('@tabs-wrapper').get('.logo').click()
cy.get('body').contains('Application')
cy.get('[data-el="page-name"]').contains('instance-1-1')
})

describe('The Immersive editor', () => {
Expand Down

0 comments on commit f5cecda

Please sign in to comment.