Cypress Tests and Discussion Resolves
This commit is contained in:
parent
6eebeb6692
commit
fcff2d928a
|
@ -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')
|
||||
})
|
||||
})
|
||||
})
|
|
@ -103,3 +103,25 @@ Cypress.Commands.add("addButtonComponent", () => {
|
|||
|
||||
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')
|
||||
})
|
||||
})
|
|
@ -353,12 +353,11 @@ const selectComponent = store => component => {
|
|||
|
||||
const setComponentProp = store => (name, value) => {
|
||||
store.update(state => {
|
||||
const current_component = state.currentComponentInfo
|
||||
state.currentComponentInfo[name] = value
|
||||
|
||||
_saveCurrentPreviewItem(state)
|
||||
let current_component = state.currentComponentInfo
|
||||
current_component[name] = value
|
||||
|
||||
state.currentComponentInfo = current_component
|
||||
_saveCurrentPreviewItem(state)
|
||||
return state
|
||||
})
|
||||
}
|
||||
|
|
|
@ -54,7 +54,10 @@
|
|||
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) {
|
||||
action(component)
|
||||
|
|
|
@ -38,11 +38,6 @@ export const rename = (pages, screens, oldname, newname) => {
|
|||
for (let screen of screens) {
|
||||
let hasEdited = false
|
||||
|
||||
// if (screen.name === oldname) {
|
||||
// screen.name = newname
|
||||
// hasEdited = true
|
||||
// }
|
||||
|
||||
if (screen.props.instanceName === oldname) {
|
||||
screen.props.instanceName = newname
|
||||
hasEdited = true
|
||||
|
|
|
@ -29,14 +29,7 @@ export const searchAllComponents = (components, phrase) => {
|
|||
}
|
||||
|
||||
export const getExactComponent = (components, name, isScreen = false) => {
|
||||
const stringEquals = (s1, s2) => normalString(s1) === normalString(s2)
|
||||
return pipe(components, [
|
||||
find(c =>
|
||||
isScreen
|
||||
? stringEquals(c.props._instanceName, name)
|
||||
: stringEquals(c._instanceName, name)
|
||||
),
|
||||
])
|
||||
return components.find(c => isScreen ? c.props._instanceName === name : c._instanceName === name)
|
||||
}
|
||||
|
||||
export const getAncestorProps = (components, name, found = []) => {
|
||||
|
|
Loading…
Reference in New Issue