Skip to content

Commit ccad788

Browse files
committed
Merge branch 'release/2020-10'
2 parents 5d28fe8 + 4a4866d commit ccad788

177 files changed

Lines changed: 2934 additions & 2129 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.eslintrc.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -87,7 +87,8 @@ module.exports = {
8787
'no-var': 'error',
8888
'prefer-const': 'error',
8989
'prefer-spread': 'error',
90-
'no-shadow': 'error',
90+
'no-shadow': 'off',
91+
'@typescript-eslint/no-shadow': ['error'],
9192
'@typescript-eslint/no-useless-constructor': 'error',
9293
'prefer-template': 'error',
9394
'prefer-destructuring': ['error', { array: false, object: true }],

apps/sensenet/cypress/CONTRIBUTING.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,7 @@
1+
> If you are here because of Hacktoberfest, please check [hacktoberfest.sensenet.com](https://hacktoberfest.sensenet.com/) first.
2+
3+
<br />
4+
15
# Contribution guide for End-to-End testing
26

37
This guide is about how to write and run End-to-End (E2E) tests for a feature or a component in sensenet's admin ui. We are using Cypress for E2E testing, if you are not familiar with it, check the following docs to get started:
@@ -84,6 +88,8 @@ As it is mentioned above the Cypress related configurations are stored in the cy
8488
8589
These are the roles what you can use for testing pusposes. In every test case we indicated in what role the particular test should running. You can find the secret keys for the roles on your [profile page](https://profile.sensenet.com/) after login.
8690
91+
![configurations](./config.png)
92+
8793
## What requires an E2E Test?
8894
8995
- Test case issues in [sn-client Github repository](https://github.com/SenseNet/sn-client) marked with the **labels** test and **hacktoberfest**. There's also a dedicated board for Hacktoberfest issues [here](https://github.com/orgs/SenseNet/projects/7).

apps/sensenet/cypress/config.png

255 KB
Loading
Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
import { pathWithQueryParams } from '../../../src/services/query-string-builder'
2+
3+
describe('Content types', () => {
4+
beforeEach(() => {
5+
cy.login()
6+
cy.visit(pathWithQueryParams({ path: '/', newParams: { repoUrl: Cypress.env('repoUrl') } }))
7+
.get('[data-test="Content Types"]')
8+
.click()
9+
cy.get('.ReactVirtualized__Table__Grid').scrollTo('bottom')
10+
cy.xpath('//div[text()="Article"]').scrollIntoView({ duration: 500 }).as('articleRow')
11+
})
12+
13+
it('clicking on the content types menu item should show article', () => {
14+
cy.get('@articleRow').should('be.visible')
15+
})
16+
17+
it('double clicking on article should open binary editor', () => {
18+
cy.get('@articleRow').dblclick()
19+
cy.get('div').contains('Article').should('be.visible')
20+
cy.get('.monaco-editor').should('be.visible')
21+
cy.get('[data-test="cancel"]').click()
22+
})
23+
})
Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
import { pathWithQueryParams } from '../../../src/services/query-string-builder'
2+
3+
const repoUrl = Cypress.env('repoUrl')
4+
5+
describe('Dashboard', () => {
6+
before(() => {
7+
cy.login()
8+
cy.visit(pathWithQueryParams({ path: '/', newParams: { repoUrl } }))
9+
})
10+
it('Header should contains the url of the current repository.', () => {
11+
cy.get('[data-test="sensenet-header"]').contains(repoUrl)
12+
})
13+
14+
it(`should have title`, () => {
15+
cy.get('[data-test="app-header"]').contains(/Welcome to your [a-z0-9]+ project/)
16+
})
17+
18+
it('Subscription section should have the Developer plan text and features list', () => {
19+
cy.get('[data-test="feature-users"]').contains(/[0-3] users/)
20+
cy.get('[data-test="feature-content"]').contains(/([0-9]|[1-8][0-9]|9[0-9]|[1-4][0-9]{2}|500) content/)
21+
cy.get('[data-test="feature-storage-space"]').contains(/[0-1] GB storage space/)
22+
})
23+
24+
it('Current usage section should have correct usage info.', () => {
25+
cy.get('[data-test="usage-users"]').contains(/[0-3] of 3 used/)
26+
cy.get('[data-test="usage-contents"]').contains(/[0-9]|[1-8][0-9]|9[0-9]|[1-4][0-9]{2}|500 of 500 used/)
27+
cy.get('[data-test="usage-storage-space"]').contains(/[0-1] of 1 GB used/)
28+
})
29+
})
Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
import { globals } from '../../../src/globalStyles'
2+
import { pathWithQueryParams } from '../../../src/services/query-string-builder'
3+
4+
describe('Drawer', () => {
5+
beforeEach(() => {
6+
cy.login()
7+
cy.visit(pathWithQueryParams({ path: '/', newParams: { repoUrl: Cypress.env('repoUrl') } }))
8+
})
9+
10+
it('clicking on the hamburger menu icon should open the drawer', () => {
11+
cy.get('[data-test="drawer-expandcollapse-button"]').click()
12+
13+
cy.get('[data-test="drawer"]').should('have.css', 'width', `${globals.common.drawerWidthExpanded}px`)
14+
})
15+
16+
it('clicking on the X icon should close the extended view of the drawer', () => {
17+
cy.get('[data-test="drawer-expandcollapse-button"]').click()
18+
19+
cy.get('[data-test="drawer-expandcollapse-button"]').click()
20+
21+
cy.get('[data-test="drawer"]').should('have.css', 'width', `${globals.common.drawerWidthCollapsed}px`)
22+
})
23+
})
Lines changed: 57 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,57 @@
1+
import { pathWithQueryParams } from '../../../src/services/query-string-builder'
2+
3+
describe('Drawer menu icons', () => {
4+
beforeEach(() => {
5+
cy.login()
6+
cy.visit(pathWithQueryParams({ path: '/', newParams: { repoUrl: Cypress.env('repoUrl') } }))
7+
})
8+
9+
it('clicking on the Search icon on the drawer should open the Search page', () => {
10+
cy.get('[data-test="Search"]').as('searchIcon')
11+
cy.get('@searchIcon').should('not.have.class', 'Mui-selected')
12+
cy.get('@searchIcon').click()
13+
cy.get('@searchIcon').should('have.class', 'Mui-selected')
14+
})
15+
16+
it('clicking on the content icon on the drawer should open the Content page', () => {
17+
cy.get('[data-test="Content"]').as('contentIcon')
18+
cy.get('@contentIcon').should('not.have.class', 'Mui-selected')
19+
cy.get('@contentIcon').click()
20+
cy.get('@contentIcon').should('have.class', 'Mui-selected')
21+
})
22+
23+
it('clicking on the Users and groups icon on the drawer should open the Users and groups page', () => {
24+
cy.get('[data-test="Users and groups"]').as('UsersAndGroupsIcon')
25+
cy.get('@UsersAndGroupsIcon').should('not.have.class', 'Mui-selected')
26+
cy.get('@UsersAndGroupsIcon').click()
27+
cy.get('@UsersAndGroupsIcon').should('have.class', 'Mui-selected')
28+
})
29+
30+
it('clicking on the Trash icon on the drawer should open the Trash page', () => {
31+
cy.get('[data-test="Trash"]').as('trashIcon')
32+
cy.get('@trashIcon').should('not.have.class', 'Mui-selected')
33+
cy.get('@trashIcon').click()
34+
cy.get('@trashIcon').should('have.class', 'Mui-selected')
35+
})
36+
37+
it('clicking on the Content Types icon on the drawer should open the Content Types page', () => {
38+
cy.get('[data-test="Content Types"]').as('contentTypesIcon')
39+
cy.get('@contentTypesIcon').should('not.have.class', 'Mui-selected')
40+
cy.get('@contentTypesIcon').click()
41+
cy.get('@contentTypesIcon').should('have.class', 'Mui-selected')
42+
})
43+
44+
it('clicking on the Localization icon on the drawer should open the Localization page', () => {
45+
cy.get('[data-test="Localization"]').as('localizationIcon')
46+
cy.get('@localizationIcon').should('not.have.class', 'Mui-selected')
47+
cy.get('@localizationIcon').click()
48+
cy.get('@localizationIcon').should('have.class', 'Mui-selected')
49+
})
50+
51+
it('clicking on the Setup icon on the drawer should open the Setup page', () => {
52+
cy.get('[data-test="Setup"]').as('setupIcon')
53+
cy.get('@setupIcon').should('not.have.class', 'Mui-selected')
54+
cy.get('@setupIcon').click()
55+
cy.get('@setupIcon').should('have.class', 'Mui-selected')
56+
})
57+
})
Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
import { pathWithQueryParams } from '../../../src/services/query-string-builder'
2+
3+
describe('Localization', () => {
4+
beforeEach(() => {
5+
cy.login()
6+
cy.visit(pathWithQueryParams({ path: '/', newParams: { repoUrl: Cypress.env('repoUrl') } }))
7+
.get('[data-test="Localization"]')
8+
.click()
9+
})
10+
11+
it('should contain a row with ActionResources.xml', () => {
12+
cy.get('.MuiTableCell-root div')
13+
.contains('ActionResources.xml')
14+
.should('have.text', 'ActionResources.xml')
15+
.click({ force: true })
16+
.parents('[role="row"]')
17+
.get('.MuiCheckbox-root')
18+
.should('have.class', 'Mui-checked')
19+
})
20+
21+
it('should have the correct items in the right click menu', () => {
22+
cy.get('.MuiTableCell-root div').contains('ActionResources.xml').rightclick({ force: true })
23+
24+
const expectedMenuItems = ['Download', 'Browse']
25+
26+
cy.get('[role="presentation"] li')
27+
.should('have.length', expectedMenuItems.length)
28+
.each(($el) => {
29+
expect(expectedMenuItems).to.include($el.text())
30+
})
31+
32+
cy.get('[role="presentation"] [aria-hidden="true" ]:first').click({ force: true })
33+
34+
cy.get('[role="presentation"] li').should('not.exist')
35+
})
36+
37+
it('should open a binary editor with the content of the item on double click', () => {
38+
cy.get('.MuiTableCell-root div').contains('ActionResources.xml').dblclick({ force: true })
39+
40+
cy.get('[data-test="editor-title"]').should('have.text', 'ActionResources.xml')
41+
42+
cy.get('button[aria-label="Cancel"]').click()
43+
44+
cy.get('[data-test="editor-title"]').should('not.exist')
45+
})
46+
})
Lines changed: 53 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,53 @@
1+
import { pathWithQueryParams } from '../../../src/services/query-string-builder'
2+
3+
context('AddNew Menu', () => {
4+
before(() => cy.clearCookies({ domain: null } as any))
5+
6+
beforeEach(() => {
7+
cy.login()
8+
})
9+
10+
it('should open a dropdown with the list of allowed child types', () => {
11+
const dropdownItems = [
12+
'Folder',
13+
'Document Library',
14+
'Image Library',
15+
'Event List',
16+
'Memo List',
17+
'Link List',
18+
'Task list',
19+
'Custom List',
20+
'Workspace',
21+
'System Folder',
22+
'Demo Workspace',
23+
'Image',
24+
]
25+
cy.visit(pathWithQueryParams({ path: '/', newParams: { repoUrl: Cypress.env('repoUrl') } }))
26+
.get('a[href="/content/explorer/"]')
27+
.click()
28+
.get('button[data-test="add-button"]')
29+
.click()
30+
.get('[data-test="listitem"]')
31+
.each(($span) => {
32+
const text = $span.text()
33+
if (text) {
34+
expect(dropdownItems).to.include(text)
35+
}
36+
})
37+
})
38+
39+
it('should display an editor of new content and AddNew button should be disabled after selection', () => {
40+
cy.visit(pathWithQueryParams({ path: '/', newParams: { repoUrl: Cypress.env('repoUrl') } }))
41+
.get('a[href="/content/explorer/"]')
42+
.click()
43+
.get('button[data-test="add-button"]')
44+
.click()
45+
.get('[data-test="listitem"]')
46+
.first()
47+
.click()
48+
.get('span[data-test="viewtitle"]')
49+
.should('have.text', 'New Folder')
50+
51+
cy.get('button[data-test="add-button"][disabled]').should('exist')
52+
})
53+
})
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
import { pathWithQueryParams } from '../../../src/services/query-string-builder'
2+
3+
describe('Logo Navigation Test', () => {
4+
beforeEach(() => {
5+
cy.login()
6+
cy.visit(pathWithQueryParams({ path: '/', newParams: { repoUrl: Cypress.env('repoUrl') } }))
7+
})
8+
9+
it('should go to Root on click of Logo', () => {
10+
cy.get('a[href="/content/explorer/"]').click()
11+
cy.get('[data-test="sensenet-logo"]')
12+
.click()
13+
.location()
14+
.should((loc) => {
15+
expect(loc.pathname).to.eq('/')
16+
})
17+
})
18+
})

0 commit comments

Comments
 (0)