kopia lustrzana https://github.com/nextcloud/social
commit
2748b0e46a
|
@ -1,7 +1,13 @@
|
|||
describe('Social app setup', function() {
|
||||
let userId = 'janedoe' + Date.now();
|
||||
|
||||
describe('Social app setup', function() {
|
||||
before(function() {
|
||||
cy.login('admin', 'admin')
|
||||
cy.nextcloudCreateUser(userId, 'p4ssw0rd')
|
||||
cy.login(userId, 'p4ssw0rd')
|
||||
})
|
||||
|
||||
beforeEach(() => {
|
||||
Cypress.Cookies.preserveOnce('nc_username', 'nc_token', 'nc_session_id', 'oc_sessionPassphrase');
|
||||
})
|
||||
|
||||
it('See the welcome message', function() {
|
||||
|
|
|
@ -20,15 +20,16 @@
|
|||
*
|
||||
*/
|
||||
|
||||
let userId = 'janedoe' + Date.now();
|
||||
|
||||
describe('Create posts', function() {
|
||||
|
||||
before(function() {
|
||||
cy.visit('/apps/social/')
|
||||
cy.logout()
|
||||
cy.login('admin', 'admin')
|
||||
cy.nextcloudCreateUser('janedoe', 'p4ssw0rd')
|
||||
cy.logout()
|
||||
cy.login('janedoe', 'p4ssw0rd', '/apps/social/')
|
||||
// ensure that the admin account is initialized for social
|
||||
cy.login('admin', 'admin', '/apps/social/')
|
||||
|
||||
cy.nextcloudCreateUser(userId, 'p4ssw0rd')
|
||||
cy.login(userId, 'p4ssw0rd', '/apps/social/')
|
||||
cy.get('.app-content').should('be.visible')
|
||||
})
|
||||
|
||||
|
@ -36,7 +37,12 @@ describe('Create posts', function() {
|
|||
cy.screenshot()
|
||||
})
|
||||
|
||||
beforeEach(() => {
|
||||
Cypress.Cookies.preserveOnce('nc_username', 'nc_token', 'nc_session_id', 'oc_sessionPassphrase');
|
||||
})
|
||||
|
||||
it('Write a post to followers', function() {
|
||||
cy.visit('/apps/social/')
|
||||
cy.server()
|
||||
cy.route('POST', '/index.php/apps/social/api/v1/post').as('postMessage')
|
||||
cy.get('.new-post input[type=submit]')
|
||||
|
@ -51,6 +57,7 @@ describe('Create posts', function() {
|
|||
})
|
||||
|
||||
it('Write a post to followers with shift enter', function() {
|
||||
cy.visit('/apps/social/')
|
||||
cy.server()
|
||||
cy.route('POST', '/index.php/apps/social/api/v1/post').as('postMessage')
|
||||
cy.get('.new-post').find('[contenteditable]').type('Hello world 2{shift}{enter}')
|
||||
|
@ -59,8 +66,10 @@ describe('Create posts', function() {
|
|||
})
|
||||
|
||||
it('Write a post to @admin', function() {
|
||||
cy.visit('/apps/social/')
|
||||
cy.server()
|
||||
cy.route('POST', '/index.php/apps/social/api/v1/post').as('postMessage')
|
||||
cy.route('GET', '/index.php/apps/social/api/v1/global/accounts/search')
|
||||
cy.get('.new-post').find('[contenteditable]').type('@adm', {delay: 500})
|
||||
cy.get('.tribute-container').should('be.visible')
|
||||
cy.get('.tribute-container ul li:first').contains('admin')
|
||||
|
@ -68,10 +77,14 @@ describe('Create posts', function() {
|
|||
cy.get('.new-post input[type=submit]')
|
||||
.click()
|
||||
cy.wait('@postMessage')
|
||||
cy.get('.social__timeline div.timeline-entry:first-child').should('contain', 'admin@localhost')
|
||||
cy.get('.social__timeline div.timeline-entry:first-child').should('contain', '@admin')
|
||||
})
|
||||
|
||||
it('Opens the menu and shows that followers is selected by default', function() {
|
||||
cy.visit('/apps/social/')
|
||||
cy.server()
|
||||
cy.route('POST', '/index.php/apps/social/api/v1/post').as('postMessage')
|
||||
cy.route('GET', '/index.php/apps/social/api/v1/global/accounts/search')
|
||||
cy.get('.new-post').find('[contenteditable]').click({force: true}).type('@adm{enter} Hello world', {delay: 500, force: true})
|
||||
cy.wait(500)
|
||||
cy.get('.new-post input[type=submit]').should('not.be.disabled')
|
||||
|
@ -86,7 +99,8 @@ describe('Create posts', function() {
|
|||
|
||||
cy.get('.new-post input[type=submit]')
|
||||
.click()
|
||||
cy.get('.social__timeline div.timeline-entry:first-child').should('contain', 'Hello there').should('contain', 'admin@localhost')
|
||||
cy.wait('@postMessage')
|
||||
cy.get('.social__timeline div.timeline-entry:first-child').should('contain', 'Hello world').should('contain', '@admin')
|
||||
|
||||
})
|
||||
|
||||
|
|
|
@ -29,10 +29,7 @@ const url = Cypress.config('baseUrl').replace(/\/index.php\/?$/g, '')
|
|||
Cypress.env('baseUrl', url)
|
||||
|
||||
Cypress.Commands.add('login', (user, password, route = '/apps/files') => {
|
||||
cy.clearCookies()
|
||||
Cypress.Cookies.defaults({
|
||||
preserve: /^(oc|nc)/,
|
||||
})
|
||||
cy.clearCookies();
|
||||
cy.visit(route)
|
||||
cy.get('input[name=user]').type(user)
|
||||
cy.get('input[name=password]').type(password)
|
||||
|
@ -53,7 +50,7 @@ Cypress.Commands.add('logout', () => {
|
|||
})
|
||||
|
||||
Cypress.Commands.add('nextcloudCreateUser', (user, password) => {
|
||||
cy.clearCookies()
|
||||
cy.clearCookies();
|
||||
cy.request({
|
||||
method: 'POST',
|
||||
url: `${Cypress.env('baseUrl')}/ocs/v1.php/cloud/users?format=json`,
|
||||
|
|
Ładowanie…
Reference in New Issue