Cypress Tests and Discussion Resolves

This commit is contained in:
Conor_Mack 2020-06-24 16:16:06 +01:00
parent 6eebeb6692
commit fcff2d928a
6 changed files with 52 additions and 18 deletions

View File

@ -0,0 +1,22 @@
context('Screen Tests', () => {
before(() => {
cy.visit('localhost:4001/_builder')
cy.createApp('Conor Cy App', 'Model App Description')
cy.navigateToFrontend()
})
it('Should successful create a screen', () => {
cy.createScreen("test Screen")
})
it('Should rename a screen', () => {
cy.get(".components-pane").within(() => {
cy.contains("Settings").click()
cy.get("input[name=_instanceName]").clear().type("About Us").blur()
})
cy.get('.nav-items-container').within(() => {
cy.contains("About Us").should('exist')
})
})
})

View File

@ -103,3 +103,25 @@ Cypress.Commands.add("addButtonComponent", () => {
cy.get("[data-cy=Button]").click() cy.get("[data-cy=Button]").click()
}) })
Cypress.Commands.add('navigateToFrontend', () => {
cy.wait(4000)
cy.get(".close").click()
cy.contains('frontend').click()
cy.wait(2000)
cy.get(".close").click()
})
Cypress.Commands.add("createScreen", (screenName, route) => {
cy.get(".newscreen").click()
cy.get(".uk-input:first").type(screenName)
if(route) {
cy.get(".uk-input:last").type(route)
}
cy.get('.uk-modal-footer').within(() => {
cy.contains('Create Screen').click()
})
cy.get('.nav-items-container').within(() => {
cy.contains(screenName).should('exist')
})
})

View File

@ -353,12 +353,11 @@ const selectComponent = store => component => {
const setComponentProp = store => (name, value) => { const setComponentProp = store => (name, value) => {
store.update(state => { store.update(state => {
const current_component = state.currentComponentInfo let current_component = state.currentComponentInfo
state.currentComponentInfo[name] = value current_component[name] = value
_saveCurrentPreviewItem(state)
state.currentComponentInfo = current_component state.currentComponentInfo = current_component
_saveCurrentPreviewItem(state)
return state return state
}) })
} }

View File

@ -54,7 +54,10 @@
store.setComponentProp(key, value) store.setComponentProp(key, value)
} }
$: displayName = ( $store.currentView === "component" || $store.currentFrontEndType === "screen") && componentInstance._instanceName && componentInstance._component !== "##builtin/screenslot" $: isComponentOrScreen = $store.currentView === "component" || $store.currentFrontEndType === "screen"
$: isNotScreenslot = componentInstance._component !== "##builtin/screenslot"
$: displayName = isComponentOrScreen && componentInstance._instanceName && isNotScreenslot
function walkProps(component, action) { function walkProps(component, action) {
action(component) action(component)

View File

@ -38,11 +38,6 @@ export const rename = (pages, screens, oldname, newname) => {
for (let screen of screens) { for (let screen of screens) {
let hasEdited = false let hasEdited = false
// if (screen.name === oldname) {
// screen.name = newname
// hasEdited = true
// }
if (screen.props.instanceName === oldname) { if (screen.props.instanceName === oldname) {
screen.props.instanceName = newname screen.props.instanceName = newname
hasEdited = true hasEdited = true

View File

@ -29,14 +29,7 @@ export const searchAllComponents = (components, phrase) => {
} }
export const getExactComponent = (components, name, isScreen = false) => { export const getExactComponent = (components, name, isScreen = false) => {
const stringEquals = (s1, s2) => normalString(s1) === normalString(s2) return components.find(c => isScreen ? c.props._instanceName === name : c._instanceName === name)
return pipe(components, [
find(c =>
isScreen
? stringEquals(c.props._instanceName, name)
: stringEquals(c._instanceName, name)
),
])
} }
export const getAncestorProps = (components, name, found = []) => { export const getAncestorProps = (components, name, found = []) => {