Skip to content

Commit

Permalink
Merge branch 'release/2021-05'
Browse files Browse the repository at this point in the history
  • Loading branch information
Zoltán Takács committed May 17, 2021
2 parents 1e3441e + 2bbbf4a commit f86c713
Show file tree
Hide file tree
Showing 118 changed files with 3,576 additions and 3,481 deletions.
2 changes: 1 addition & 1 deletion apps/sensenet/cypress.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
"identityServer": "https://is.demo.sensenet.com",
"users": {
"admin": {
"clientId": "businesscat",
"clientId": "KxkgOTAxLLCicUx7",
"clientSecret": "",
"id": "/Root/IMS/Public('businesscat')"
},
Expand Down
117 changes: 89 additions & 28 deletions apps/sensenet/cypress/integration/content-types/content-types.spec.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,28 @@
import { pathWithQueryParams } from '../../../src/services/query-string-builder'

const ctdExample = `<ContentType name="MyType" parentType="GenericContent" handler="SenseNet.ContentRepository.GenericContent" xmlns="http://schemas.sensenet.com/SenseNet/ContentRepository/ContentTypeDefinition">
<DisplayName>MyType</DisplayName>
<Description></Description>
<Icon>Content</Icon>
<AllowIncrementalNaming>true</AllowIncrementalNaming>
<Fields>
<Field name="ShortTextField" type="ShortText">
<DisplayName>ShortTextFieldTest</DisplayName>
<Description></Description>
<Configuration>
<MaxLength>100</MaxLength>
<MinLength>0</MinLength>
<ReadOnly>false</ReadOnly>
<Compulsory>false</Compulsory>
<DefaultValue>test</DefaultValue>
<VisibleBrowse>Show</VisibleBrowse>
<VisibleEdit>Show</VisibleEdit>
<VisibleNew>Show</VisibleNew>
</Configuration>
</Field>
</Fields>
</ContentType>`

describe('Content types', () => {
before(() => {
cy.login()
Expand All @@ -8,41 +31,79 @@ describe('Content types', () => {
.click()
})

beforeEach((done) => {
cy.get('.ReactVirtualized__Table__Grid').then((grid) => {
let scroll = 0
context('create & delete', () => {
it('should create a new content type', (done) => {
cy.get('[data-test="add-button"]').should('not.be.disabled').click()
cy.get('[data-test="listitem-content-type"]')
.click()
.then(() => {
cy.get('.monaco-editor textarea')
.click({ force: true })
.focused()
.type('{ctrl}a')
.clear()
.invoke('val', ctdExample)
.trigger('input')

function timeout() {
setTimeout(() => {
scroll = scroll + 200
grid.scrollTop(scroll)
cy.contains('Submit').click()

const article = grid.find('[data-test="table-cell-article"]')
if (!article.length) {
timeout()
} else {
article[0].scrollIntoView()
done()
}
}, 100)
}
cy.get('.ReactVirtualized__Table__Grid').then((grid) => {
cy.scrollToItem({
container: grid,
selector: '[data-test="table-cell-mytype"]',
done: (element) => {
expect(!!(element.offsetWidth || element.offsetHeight || element.getClientRects().length)).to.equal(
true,
)
done()
},
})
})
})
})

it('should delete a content type', () => {
cy.get('.ReactVirtualized__Table__Grid').then((grid) => {
cy.scrollToItem({
container: grid,
selector: '[data-test="table-cell-mytype"]',
}).then(() => {
cy.get(`[data-test="table-cell-mytype"]`).rightclick({ force: true })

timeout()
cy.get('[data-test="content-context-menu-delete"]').click()
cy.get('[data-test="delete-permanently"] input[type="checkbox"]').check()
cy.get('[data-test="button-delete-confirm"]').click()

cy.get('[data-test="table-cell-mytype"]').should('not.exist')
})
})
})
})

afterEach(() => {
cy.get('.ReactVirtualized__Table__Grid').then((grid) => grid.scrollTop(0))
})
context('read', () => {
before((done) => {
cy.get('.ReactVirtualized__Table__Grid').then((grid) => {
cy.scrollToItem({
container: grid,
selector: '[data-test="table-cell-article"]',
done: () => {
done()
},
})
})
})

it('clicking on the content types menu item should show article', () => {
cy.get('[data-test="table-cell-article"]').should('be.visible')
})
it('clicking on the content types menu item should show article', () => {
cy.get('[data-test="table-cell-article"]').should('be.visible')
})

it('double clicking on article should open binary editor', () => {
cy.get('[data-test="table-cell-article"]').dblclick({ force: true })
cy.get('div').contains('Article').should('be.visible')
cy.get('.monaco-editor').should('be.visible')
cy.get('[data-test="monaco-editor-cancel"]').click()
it('double clicking on article should open binary editor', () => {
cy.get('[data-test="table-cell-article"]').dblclick({ force: true })

cy.get('[data-test="editor-title"]').should('have.text', 'Article')
cy.get('.monaco-editor').should('exist')

cy.get('[data-test="monaco-editor-cancel"]').click()
})
})
})
15 changes: 2 additions & 13 deletions apps/sensenet/cypress/integration/drawer/custom-menuitem.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -28,18 +28,7 @@ describe('Custom menu item', () => {
},
}

const items = [
'Code review',
'Infrastructure meeting',
'Kickoff meeting',
'Refinement',
'Release',
'Retrospective meeting',
'Sales and product',
'Scrum meeting',
'Tech Call with Thorwell Group',
'Upgrade',
]
const items = ['Awesome demo', 'Cruel deadline', 'Long event', 'Overrated meeting', 'Remarkable event']

cy.visit(
pathWithQueryParams({
Expand Down Expand Up @@ -90,7 +79,7 @@ describe('Custom menu item', () => {

cy.intercept({
method: 'GET',
url: '/Root/Content/IT/Calendar',
url: 'odata.svc/Root/Content/IT/Calendar?*',
}).as('getCalendar')

cy.visit(
Expand Down
2 changes: 1 addition & 1 deletion apps/sensenet/cypress/integration/groups/groups.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ describe('Groups', () => {
it('ensures that deletion of a group is working properly', () => {
cy.intercept({
method: 'GET',
url: '/Root/Trash',
url: 'odata.svc/Root/Trash?*',
}).as('getTrashChildren')

cy.get('[data-test="drawer-menu-item-users-and-groups"]').click()
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,24 @@
import { pathWithQueryParams } from '../../../src/services/query-string-builder'

const exampleLocalization = `<?xml version="1.0" encoding="utf-8"?>
<?xml-stylesheet type="text/xsl" href="view.xslt"?>
<Resources>
<ResourceClass name="Test">
<Languages>
<Language cultureName="en">
<data name="Test" xml:space="preserve">
<value>Test</value>
</data>
</Language>
<Language cultureName="hu">
<data name="Test" xml:space="preserve">
<value>Teszt</value>
</data>
</Language>
</Languages>
</ResourceClass>
</Resources>`

describe('Localization', () => {
beforeEach(() => {
cy.login()
Expand Down Expand Up @@ -38,4 +57,51 @@ describe('Localization', () => {

cy.get('[data-test="editor-title"]').should('not.exist')
})

it('should create a new localization file', (done) => {
cy.get('[data-test="add-button"]').should('not.be.disabled').click()
cy.get('[data-test="listitem-resource"]')
.click()
.then(() => {
cy.get('[data-test="editor-title"] input').type('testResource')

cy.get('.monaco-editor textarea')
.click({ force: true })
.focused()
.type('{ctrl}a')
.clear()
.invoke('val', exampleLocalization)
.trigger('input')

cy.contains('Submit').click()

cy.get('.ReactVirtualized__Table__Grid').then((grid) => {
cy.scrollToItem({
container: grid,
selector: '[data-test="table-cell-testresource.xml"]',
done: (element) => {
expect(!!(element.offsetWidth || element.offsetHeight || element.getClientRects().length)).to.equal(true)
done()
},
})
})
})
})

it('should delete a localization file', () => {
cy.get('.ReactVirtualized__Table__Grid').then((grid) => {
cy.scrollToItem({
container: grid,
selector: '[data-test="table-cell-testresource.xml"]',
}).then(() => {
cy.get(`[data-test="table-cell-testresource.xml"]`).rightclick({ force: true })

cy.get('[data-test="content-context-menu-delete"]').click()
cy.get('[data-test="delete-permanently"] input[type="checkbox"]').check()
cy.get('[data-test="button-delete-confirm"]').click()

cy.get('[data-test="table-cell-testresource.xml"]').should('not.exist')
})
})
})
})
4 changes: 2 additions & 2 deletions apps/sensenet/cypress/integration/organizational-unit.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ describe('Organizational units', () => {
cy.get('[data-test="delete-permanently"] input[type="checkbox"]').check()
cy.get('[data-test="button-delete-confirm"]').click()

cy.get('[data-test="menu-item-test1').should('not.exist')
cy.get('[data-test="menu-item-test2').should('not.exist')
cy.get('[data-test="menu-item-test1]').should('not.exist')
cy.get('[data-test="menu-item-test2]').should('not.exist')
})
})
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
import { pathWithQueryParams } from '../../../src/services/query-string-builder'

describe('Add new permission entry', () => {
before(() => {
cy.login()
cy.visit(pathWithQueryParams({ path: '/', newParams: { repoUrl: Cypress.env('repoUrl') } }))
})

it('opens a new dialog', () => {
cy.viewport(1840, 890)
cy.get('[data-test="drawer-menu-item-content"]').click()
cy.get('[data-test="menu-item-it-workspace"]').rightclick()
cy.get('[data-test="content-context-menu-setpermissions"]').click()
cy.get('[data-test="assing-new-permission"]').click()
cy.get('[data-test="member-select-dialog"]').should('contain.text', 'New permission entry')

cy.get('[data-test="reference-input"]').type('Developer D')
cy.get('[data-test="suggestion-developer-dog"]').click()
cy.get('[data-test="member-select-add"]').click()
cy.get('[data-test="set-on-this-developer-dog"]').should('exist')
cy.get('[data-test="permission-dialog-title"]').should('contain.text', 'Developer Dog')
cy.get('[data-test="permission-editor-cancel"]').click()
cy.get('[data-test="set-on-this-developer-dog"]').should('not.exist')
cy.get('[data-test="permission-dialog-title"]').should('not.exist')
})
})
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
import { pathWithQueryParams } from '../../../src/services/query-string-builder'

const expectedMembers = ['Developer Dog']
const expectedMembersAfterAdditon = ['Developer Dog', 'Business Cat']

describe('Editing group member in permission editor', () => {
beforeEach(() => {
cy.login()
cy.visit(pathWithQueryParams({ path: '/', newParams: { repoUrl: Cypress.env('repoUrl') } }))
})

it('adding a new member to a group works from permission editor', () => {
cy.get('[data-test="drawer-menu-item-content"]').click()
cy.get('[data-test="menu-item-it-workspace"]').rightclick()
cy.get('[data-test="content-context-menu-setpermissions"]').click()
cy.get('[data-test="permission-inherited-list"]').click()
cy.get('[data-test="inherited-developers"]').click()
cy.get('[data-test="members-tab"]').click()
cy.get('[data-test="reference-list"] li')
.should('have.length', expectedMembers.length)
.each(($el) => {
expect(expectedMembers).to.include($el.children().eq(0).children().eq(1).text())
})
cy.get('[data-test="reference-input"]').type('Business C')
cy.get('[data-test="suggestion-business-cat"]').click()
cy.get('[data-test="add-new-member"]').click()
cy.get('[data-test="reference-list"] li')
.should('have.length', expectedMembersAfterAdditon.length)
.each(($el) => {
expect(expectedMembersAfterAdditon).to.include($el.children().eq(0).children().eq(1).text())
})
cy.get('[data-test="permission-editor-submit"]').click()
cy.get('[data-test="drawer-menu-item-users-and-groups"]').click()
cy.get('[data-test="groups"]').click()
cy.get(`[data-test="developers-members"]`).click()
cy.get('[data-test="reference-list"] li')
.should('have.length', expectedMembersAfterAdditon.length)
.each(($el) => {
expect(expectedMembersAfterAdditon).to.include($el.children().eq(0).children().eq(1).text())
})
cy.get(`[data-test="business-cat-delete"]`).click()
})

it('contains the appropriate values', () => {
cy.get('[data-test="drawer-menu-item-content"]').click()
cy.get('[data-test="menu-item-it-workspace"]').rightclick()
cy.get('[data-test="content-context-menu-setpermissions"]').click()
cy.get('[data-test="permission-inherited-list"]').click()
cy.get('[data-test="inherited-developers"]').click()
cy.get('[data-test="members-tab"]').click()
cy.get('[data-test="reference-list"] li')
.should('have.length', expectedMembers.length)
.each(($el) => {
expect(expectedMembers).to.include($el.children().eq(0).children().eq(1).text())
})
})
})
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,9 @@ describe('Permission.settings effect on permission dialog', () => {
cy.get('[data-test="permission.settings-edit-button"]').click()
cy.get('.react-monaco-editor-container textarea')
.click({ force: true })
.clear()
.focused()
.type('{ctrl}a')
.clear()
.type(newSettings, { parseSpecialCharSequences: false })
cy.get('[data-test="monaco-editor-submit"]').click()
cy.get('[data-test="drawer-menu-item-content"]').click()
Expand Down Expand Up @@ -71,8 +72,9 @@ describe('Permission.settings effect on permission dialog', () => {
cy.get('[data-test="permission.settings-edit-button"]').click()
cy.get('.react-monaco-editor-container textarea')
.click({ force: true })
.clear()
.focused()
.type('{ctrl}a')
.clear()
.type(defaultSettings, { parseSpecialCharSequences: false })
cy.get('[data-test="monaco-editor-submit"]').click()
cy.get('[data-test="drawer-menu-item-content"]').click()
Expand Down
Loading

0 comments on commit f86c713

Please sign in to comment.