summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLouis Chemineau <louis@chmn.me>2023-03-16 15:41:51 +0100
committerLouis Chemineau <louis@chmn.me>2023-06-28 14:01:43 +0200
commitbea293487e0a08b046236af78183dabd1799b1eb (patch)
tree0e9bd7db53526ba2250528041d70d13f32b1a471
parent078f67c4422b5f94c903496d44187fa619795505 (diff)
Modernize e2e tests
Signed-off-by: Louis Chemineau <louis@chmn.me>
-rw-r--r--appinfo/info.xml9
-rw-r--r--cypress.config.js28
-rw-r--r--cypress.config.ts89
-rw-r--r--cypress/.eslintrc.js11
-rw-r--r--cypress/docker-compose.yml1
-rw-r--r--cypress/dockerNode.ts225
-rw-r--r--cypress/e2e/0.setup.cy.js26
-rw-r--r--cypress/e2e/post.cy.js62
-rwxr-xr-xcypress/initserver.sh12
-rwxr-xr-xcypress/start.sh19
-rwxr-xr-xcypress/stop.sh12
-rw-r--r--cypress/support/commands.ts (renamed from cypress/support/commands.js)58
-rw-r--r--cypress/support/e2e.ts (renamed from cypress/support/e2e.js)2
-rw-r--r--cypress/tsconfig.json4
-rw-r--r--lib/Service/CurlService.php6
-rw-r--r--package-lock.json69280
-rw-r--r--package.json13
17 files changed, 35393 insertions, 34464 deletions
diff --git a/appinfo/info.xml b/appinfo/info.xml
index 6f9bd205..ba05010d 100644
--- a/appinfo/info.xml
+++ b/appinfo/info.xml
@@ -1,6 +1,6 @@
<?xml version="1.0"?>
<info xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
- xsi:noNamespaceSchemaLocation="https://apps.nextcloud.com/schema/apps/info.xsd">
+ xsi:noNamespaceSchemaLocation="https://apps.nextcloud.com/schema/apps/info.xsd">
<id>social</id>
<name>Social</name>
<summary>πŸŽ‰ Nextcloud becomes part of the federated social networks!</summary>
@@ -22,7 +22,8 @@
<author mail="maxence@artificial-owl.com" homepage="https://artificial-owl.com/">Maxence Lange</author>
<author mail="jus@bitgrid.net">Julius HΓ€rtl</author>
<author mail="jonas@violoncello.ch" homepage="https://violoncello.ch">Jonas Sulzer</author>
- <author mail="hey@jancborchardt.net" homepage="https://jancborchardt.net">Jan-Christoph Borchardt</author>
+ <author mail="hey@jancborchardt.net" homepage="https://jancborchardt.net">Jan-Christoph
+ Borchardt</author>
<author mail="cyrpub@bollu.be">Cyrille Bollu</author>
<namespace>Social</namespace>
<category>social</category>
@@ -34,7 +35,7 @@
<database>pgsql</database>
<database>sqlite</database>
<database>mysql</database>
- <nextcloud min-version="26" max-version="28"/>
+ <nextcloud min-version="26" max-version="28" />
</dependencies>
<background-jobs>
@@ -76,4 +77,4 @@
<contactsmenu>
<provider>OCA\Social\Providers\ContactsMenuProvider</provider>
</contactsmenu>
-</info>
+</info> \ No newline at end of file
diff --git a/cypress.config.js b/cypress.config.js
deleted file mode 100644
index 32564744..00000000
--- a/cypress.config.js
+++ /dev/null
@@ -1,28 +0,0 @@
-const { defineConfig } = require('cypress')
-const browserify = require('@cypress/browserify-preprocessor')
-
-module.exports = defineConfig({
- projectId: '7mqhfh',
-
- viewportWidth: 1280,
- viewportHeight: 720,
- defaultCommandTimeout: 6000,
- retries: 1,
-
- env: {
- failSilently: false,
- type: 'actual',
- },
-
- screenshotsFolder: 'cypress/snapshots/actual',
- trashAssetsBeforeRuns: true,
-
- e2e: {
- baseUrl: 'http://localhost:8082/index.php',
-
- setupNodeEvents(on, config) {
- // Fix browserslist extend https://github.com/cypress-io/cypress/issues/2983#issuecomment-570616682
- on('file:preprocessor', browserify())
- },
- },
-})
diff --git a/cypress.config.ts b/cypress.config.ts
new file mode 100644
index 00000000..cd41fb26
--- /dev/null
+++ b/cypress.config.ts
@@ -0,0 +1,89 @@
+
+import {
+ configureNextcloud,
+ startNextcloud,
+ stopNextcloud,
+ waitOnNextcloud,
+} from './cypress/dockerNode'
+import { defineConfig } from 'cypress'
+
+import browserify from '@cypress/browserify-preprocessor'
+import getCompareSnapshotsPlugin from 'cypress-visual-regression/dist/plugin'
+
+export default defineConfig({
+ projectId: '7mqhfh',
+
+ // 16/9 screen ratio
+ viewportWidth: 1280,
+ viewportHeight: 720,
+
+ // Tries again 2 more times on failure
+ retries: {
+ runMode: 2,
+ // do not retry in `cypress open`
+ openMode: 0,
+ },
+
+ // Needed to trigger `after:run` events with cypress open
+ experimentalInteractiveRunEvents: true,
+
+ // faster video processing
+ videoCompression: false,
+
+ // Visual regression testing
+ env: {
+ failSilently: false,
+ type: 'actual',
+ },
+ screenshotsFolder: 'cypress/snapshots/actual',
+ trashAssetsBeforeRuns: true,
+
+ e2e: {
+ testIsolation: false,
+
+ // We've imported your old cypress plugins here.
+ // You may want to clean this up later by importing these.
+ async setupNodeEvents(on, config) {
+ // Fix browserslist extend https://github.com/cypress-io/cypress/issues/2983#issuecomment-570616682
+ on('file:preprocessor', browserify({ typescript: require.resolve('typescript') }))
+ getCompareSnapshotsPlugin(on, config)
+
+ // Disable spell checking to prevent rendering differences
+ on('before:browser:launch', (browser, launchOptions) => {
+ if (browser.family === 'chromium' && browser.name !== 'electron') {
+ launchOptions.preferences.default['browser.enable_spellchecking'] = false
+ return launchOptions
+ }
+
+ if (browser.family === 'firefox') {
+ launchOptions.preferences['layout.spellcheckDefault'] = 0
+ return launchOptions
+ }
+
+ if (browser.name === 'electron') {
+ launchOptions.preferences.spellcheck = false
+ return launchOptions
+ }
+ })
+
+ // Remove container after run
+ on('after:run', () => {
+ stopNextcloud()
+ })
+
+ // Before the browser launches
+ // starting Nextcloud testing container
+ return startNextcloud(process.env.BRANCH)
+ .then((ip) => {
+ // Setting container's IP as base Url
+ config.baseUrl = `http://${ip}/index.php`
+ return ip
+ })
+ .then(waitOnNextcloud)
+ .then(() => configureNextcloud(process.env.BRANCH))
+ .then(() => {
+ return config
+ })
+ },
+ },
+})
diff --git a/cypress/.eslintrc.js b/cypress/.eslintrc.js
new file mode 100644
index 00000000..d940c5ba
--- /dev/null
+++ b/cypress/.eslintrc.js
@@ -0,0 +1,11 @@
+module.exports = {
+ env: {
+ 'cypress/globals': true,
+ },
+ plugins: [
+ 'cypress',
+ ],
+ extends: [
+ 'plugin:cypress/recommended',
+ ],
+};
diff --git a/cypress/docker-compose.yml b/cypress/docker-compose.yml
index d5a466ba..2de0e346 100644
--- a/cypress/docker-compose.yml
+++ b/cypress/docker-compose.yml
@@ -15,4 +15,3 @@ services:
# Using fallback to make sure this script doesn't mess
# with the mounting if APP_NAME is not provided.
- ../:/var/www/html/apps/${APP_NAME:-social}
- - ./initserver.sh:/initserver.sh
diff --git a/cypress/dockerNode.ts b/cypress/dockerNode.ts
new file mode 100644
index 00000000..2509a000
--- /dev/null
+++ b/cypress/dockerNode.ts
@@ -0,0 +1,225 @@
+/**
+ * @copyright Copyright (c) 2022 John Molakvoæ <skjnldsv@protonmail.com>
+ *
+ * @author John Molakvoæ <skjnldsv@protonmail.com>
+ *
+ * @license AGPL-3.0-or-later
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Affero General Public License as
+ * published by the Free Software Foundation, either version 3 of the
+ * License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+/* eslint-disable no-console */
+/* eslint-disable n/no-unpublished-import */
+/* eslint-disable n/no-extraneous-import */
+
+import Docker from 'dockerode'
+import path from 'path'
+import waitOn from 'wait-on'
+
+import pkg from '../package.json'
+
+export const docker = new Docker()
+
+const APP_PATH = path.resolve(__dirname, '../')
+const APP_NAME = pkg.name
+
+const CONTAINER_NAME = 'nextcloud-cypress-tests-' + APP_NAME
+const SERVER_IMAGE = 'ghcr.io/nextcloud/continuous-integration-shallow-server'
+
+/**
+ * Start the testing container
+ */
+export const startNextcloud = async function(branch: string = 'master'): Promise<any> {
+
+ try {
+ // Pulling images
+ console.log('\nPulling images... ⏳')
+ await new Promise((resolve, reject): any => docker.pull(SERVER_IMAGE, (err, stream) => {
+ if (err) {
+ reject(err)
+ }
+ // https://github.com/apocas/dockerode/issues/357
+ docker.modem.followProgress(stream, onFinished)
+
+ /**
+ *
+ * @param err
+ */
+ function onFinished(err) {
+ if (!err) {
+ resolve(true)
+ return
+ }
+ reject(err)
+ }
+ }))
+ console.log('└─ Done')
+
+ // Remove old container if exists
+ console.log('\nChecking running containers... πŸ”')
+ try {
+ const oldContainer = docker.getContainer(CONTAINER_NAME)
+ const oldContainerData = await oldContainer.inspect()
+ if (oldContainerData) {
+ console.log('β”œβ”€ Existing running container found')
+ console.log('β”œβ”€ Removing... ⏳')
+ // Forcing any remnants to be removed just in case
+ await oldContainer.remove({ force: true })
+ console.log('└─ Done')
+ }
+ } catch (error) {
+ console.log('└─ None found!')
+ }
+
+ // Starting container
+ console.log('\nStarting Nextcloud container... πŸš€')
+ console.log(`β”œβ”€ Using branch '${branch}'`)
+ console.log(`β”œβ”€ And binding app '${APP_NAME}' from '${APP_PATH}'`)
+ const container = await docker.createContainer({
+ Image: SERVER_IMAGE,
+ name: CONTAINER_NAME,
+ HostConfig: {
+ Binds: [
+ // TODO: improve local app directory detection
+ `${APP_PATH}/:/var/www/html/apps/${APP_NAME}`,
+ ],
+ },
+ Env: [
+ `BRANCH=${branch}`,
+ ],
+ })
+ await container.start()
+
+ // Get container's IP
+ const ip = await getContainerIP(container)
+
+ console.log(`β”œβ”€ Nextcloud container's IP is ${ip} 🌏`)
+ return ip
+ } catch (err) {
+ console.log('└─ Unable to start the container πŸ›‘')
+ console.log(err)
+ stopNextcloud()
+ throw new Error('Unable to start the container')
+ }
+}
+
+/**
+ * Configure Nextcloud
+ */
+export const configureNextcloud = async function(branch: string = 'master') {
+ console.log('\nConfiguring nextcloud...')
+ const container = docker.getContainer(CONTAINER_NAME)
+ await runExec(container, ['php', 'occ', '--version'], true)
+
+ // Clone the viewer app
+ await runExec(container, ['git', 'clone', '--depth', '1', '--branch', branch, 'https://github.com/nextcloud/viewer.git', '/var/www/html/apps/viewer'], true)
+ await runExec(container, ['php', 'occ', 'app:enable', 'social'], true)
+
+ // Be consistent for screenshots
+ await runExec(container, ['php', 'occ', 'config:system:set', 'default_language', '--value', 'en'], true)
+ await runExec(container, ['php', 'occ', 'config:system:set', 'force_language', '--value', 'en'], true)
+ await runExec(container, ['php', 'occ', 'config:system:set', 'default_locale', '--value', 'en_US'], true)
+ await runExec(container, ['php', 'occ', 'config:system:set', 'force_locale', '--value', 'en_US'], true)
+ await runExec(container, ['php', 'occ', 'config:system:set', 'enforce_theme', '--value', 'light'], true)
+
+ console.log('└─ Nextcloud is now ready to use πŸŽ‰')
+}
+
+/**
+ * Force stop the testing container
+ */
+export const stopNextcloud = async function() {
+ try {
+ const container = docker.getContainer(CONTAINER_NAME)
+ console.log('Stopping Nextcloud container...')
+ container.remove({ force: true })
+ console.log('└─ Nextcloud container removed πŸ₯€')
+ } catch (err) {
+ console.log(err)
+ }
+}
+
+/**
+ * Get the testing container's IP
+ */
+export const getContainerIP = async function(
+ container: Docker.Container = docker.getContainer(CONTAINER_NAME)
+): Promise<string> {
+ let ip = ''
+ let tries = 0
+ while (ip === '' && tries < 10) {
+ tries++
+
+ await container.inspect(function(err, data) {
+ if (err) {
+ throw err
+ }
+ ip = data?.NetworkSettings?.IPAddress || ''
+ })
+
+ if (ip !== '') {
+ break
+ }
+
+ await sleep(1000 * tries)
+ }
+
+ return ip
+}
+
+// Would be simpler to start the container from cypress.config.ts,
+// but when checking out different branches, it can take a few seconds
+// Until we can properly configure the baseUrl retry intervals,
+// We need to make sure the server is already running before cypress
+// https://github.com/cypress-io/cypress/issues/22676
+export const waitOnNextcloud = async function(ip: string) {
+ console.log('β”œβ”€ Waiting for Nextcloud to be ready... ⏳')
+ await waitOn({ resources: [`http://${ip}/index.php`] })
+ console.log('└─ Done')
+}
+
+const runExec = async function(
+ container: Docker.Container,
+ command: string[],
+ verbose = false,
+ user = 'www-data'
+) {
+ const exec = await container.exec({
+ Cmd: command,
+ AttachStdout: true,
+ AttachStderr: true,
+ User: user,
+ })
+
+ return new Promise((resolve, reject) => {
+ exec.start({}, (err, stream) => {
+ if (err) {
+ reject(err)
+ }
+ if (stream) {
+ stream.setEncoding('utf-8')
+ stream.on('data', str => {
+ if (verbose && str.trim() !== '') {
+ console.log(`β”œβ”€ ${str.trim().replace(/\n/gi, '\nβ”œβ”€ ')}`)
+ }
+ })
+ stream.on('end', resolve)
+ }
+ })
+ })
+}
+
+const sleep = function(milliseconds: number) {
+ return new Promise((resolve) => setTimeout(resolve, milliseconds))
+}
diff --git a/cypress/e2e/0.setup.cy.js b/cypress/e2e/0.setup.cy.js
index 2ad54887..e66c8e2b 100644
--- a/cypress/e2e/0.setup.cy.js
+++ b/cypress/e2e/0.setup.cy.js
@@ -1,28 +1,30 @@
const userId = 'janedoe' + Date.now()
-describe('Social app setup', function() {
- before(function() {
- cy.nextcloudCreateUser(userId, 'p4ssw0rd')
- cy.login(userId, 'p4ssw0rd')
+describe('Social app setup', function () {
+ before(function () {
+ cy.createRandomUser()
+ .then((user) => {
+ cy.login(user)
+ cy.visit('/apps/social')
+ })
})
- it('See the welcome message', function() {
- cy.visit('/apps/social/')
+ it('See the welcome message', function () {
cy.get('.social__welcome').should('contain', 'Nextcloud becomes part of the federated social networks!')
cy.get('.social__welcome').find('.icon-close').click()
cy.get('.social__welcome').should('not.exist')
})
- it('See the home section in the sidebar', function() {
+ it('See the home section in the sidebar', function () {
cy.get('.app-navigation').contains('Home').click()
- cy.get('.emptycontent').should('be.visible')
+ cy.get('.app-social .empty-content').should('be.visible')
})
- it('See the empty content illustration', function() {
+ it('See the empty content illustration', function () {
+ cy.reload()
cy.get('.app-navigation').contains('Direct messages').click()
- cy.get('.emptycontent').should('be.visible').contains('No direct messages found')
+ cy.get('.app-social .empty-content').should('be.visible').contains('No direct messages found')
cy.get('.app-navigation').contains('Profile').click()
- cy.get('.emptycontent').should('be.visible').contains('You have not tooted yet')
+ cy.get('.app-social .empty-content').should('be.visible').contains('You have not tooted yet')
})
-
})
diff --git a/cypress/e2e/post.cy.js b/cypress/e2e/post.cy.js
index 27292b50..2ff6af92 100644
--- a/cypress/e2e/post.cy.js
+++ b/cypress/e2e/post.cy.js
@@ -1,4 +1,4 @@
-/*
+/**
* @copyright Copyright (c) 2018 Julius HΓ€rtl <jus@bitgrid.net>
*
* @author Julius HΓ€rtl <jus@bitgrid.net>
@@ -22,31 +22,29 @@
const userId = 'janedoe' + Date.now()
-describe('Create posts', function() {
+describe('Create posts', function () {
- before(function() {
+ before(function () {
// ensure that the admin account is initialized for social
- cy.login('admin', 'admin', '/apps/social/')
-
- cy.nextcloudCreateUser(userId, 'p4ssw0rd')
- cy.logout()
-
- cy.login(userId, 'p4ssw0rd', '/apps/social/')
- cy.get('.app-content').should('be.visible')
- })
-
- afterEach(function() {
- cy.screenshot()
+ // cy.login('admin', 'admin', '/apps/social/')
+
+ cy.createRandomUser()
+ .then((user) => {
+ cy.login(user)
+ cy.visit('/apps/social')
+ cy.get('.app-content').should('be.visible')
+ })
})
- it('See the empty content illustration', function() {
- cy.get('.emptycontent').should('be.visible').contains('No posts found')
+ it('See the empty content illustration', function () {
+ cy.get('.social__welcome').find('.icon-close').click()
+ cy.get('.app-social .empty-content').should('be.visible').contains('No posts found')
+ cy.reload()
})
- it('Write a post to followers', function() {
+ 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.intercept('POST', '/index.php/apps/social/api/v1/statuses').as('postMessage')
cy.get('.new-post button[type=submit]')
.should('be.disabled')
cy.get('.new-post').find('[contenteditable]').type('Hello world')
@@ -58,24 +56,20 @@ describe('Create posts', function() {
cy.get('.social__timeline div.timeline-entry:first-child').should('contain', 'Hello world')
})
- it('No longer see the empty content illustration', function() {
- cy.get('.emptycontent').should('not.exist')
+ it('No longer see the empty content illustration', function () {
+ cy.get('.app-social .empty-content').should('not.exist')
})
- 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')
+ it('Write a post to followers with shift enter', function () {
+ cy.intercept('POST', '/index.php/apps/social/api/v1/statuses').as('postMessage')
cy.get('.new-post').find('[contenteditable]').type('Hello world 2{shift}{enter}')
cy.wait('@postMessage')
cy.get('.social__timeline div.timeline-entry:first-child').should('contain', 'Hello world 2')
})
- 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')
+ it('Write a post to @admin', function () {
+ cy.intercept('POST', '/index.php/apps/social/api/v1/statuses').as('postMessage')
+ cy.intercept('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')
@@ -86,11 +80,9 @@ describe('Create posts', function() {
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')
+ it('Opens the menu and shows that followers is selected by default', function () {
+ cy.intercept('POST', '/index.php/apps/social/api/v1/statuses').as('postMessage')
+ cy.intercept('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 button[type=submit]').should('not.be.disabled')
diff --git a/cypress/initserver.sh b/cypress/initserver.sh
deleted file mode 100755
index 3921fd48..00000000
--- a/cypress/initserver.sh
+++ /dev/null
@@ -1,12 +0,0 @@
-#!/usr/bin/env bash
-
-echo "APP_NAME: $APP_NAME"
-echo "BRANCH: $BRANCH"
-
-chown -R www-data:www-data /var/www/html/data
-
-su www-data -c "
- php occ config:system:set force_language --value en
- php occ app:enable $APP_NAME
- php occ app:list
-"
diff --git a/cypress/start.sh b/cypress/start.sh
deleted file mode 100755
index dc97d6a5..00000000
--- a/cypress/start.sh
+++ /dev/null
@@ -1,19 +0,0 @@
-#!/usr/bin/env bash
-# RUN THIS SCRIPT FROM THE ROOT FOLDER OF YOUR APP
-APP_NAME=${PWD##*/}
-CYPRESS_baseUrl=http://127.0.0.1:8082/index.php
-
-if [[ $APP_NAME == "cypress" ]]
-then
- echo "Please run this app from your app root folder."
-else
- echo "Launching docker server for the $APP_NAME app"
- cd cypress
- docker-compose pull
- docker-compose up -d --force-recreate
- npm run wait-on $CYPRESS_baseUrl
- echo "Nextcloud successfully installed"
- docker-compose exec --env APP_NAME=$APP_NAME -T nextcloud bash /initserver.sh
- docker-compose exec -u www-data -T nextcloud php ./occ social:reset -n
- echo "Nextcloud successfully configured"
-fi
diff --git a/cypress/stop.sh b/cypress/stop.sh
deleted file mode 100755
index aea0338a..00000000
--- a/cypress/stop.sh
+++ /dev/null
@@ -1,12 +0,0 @@
-#!/usr/bin/env bash
-# RUN THIS SCRIPT FROM THE ROOT FOLDER OF YOUR APP
-appname=${PWD##*/}
-
-if [[ $appname == "cypress" ]]
-then
- echo "Please run this app from your app root folder."
-else
- echo "Killing server for the $appname app"
- cd cypress
- docker-compose down
-fi
diff --git a/cypress/support/commands.js b/cypress/support/commands.ts
index e9177ca4..9c42486f 100644
--- a/cypress/support/commands.js
+++ b/cypress/support/commands.ts
@@ -21,62 +21,16 @@
*/
import axios from '@nextcloud/axios'
+import { addCommands, User } from '@nextcloud/cypress'
+import { basename } from 'path'
+
+// Add custom commands
+import 'cypress-wait-until'
+addCommands()
const url = Cypress.config('baseUrl').replace(/\/index.php\/?$/g, '')
Cypress.env('baseUrl', url)
-Cypress.Commands.add('login', (user, password, route = '/apps/files') => {
- Cypress.Cookies.defaults({
- preserve: /^(oc|nc)/,
- })
- cy.visit(route)
- cy.get('input[name=user]').type(user)
- cy.get('input[name=password]').type(password)
- cy.get('form[name=login] [type=submit]').click()
- cy.url().should('include', route)
-})
-
-Cypress.Commands.add('logout', () => {
- cy.getCookies()
- .then(cookies => {
- if (cookies.length === 0) {
- cy.log('Not logged, skipping logout...')
- return
- }
-
- return cy.get('body')
- .then($body => {
- const $settingsButton = $body.find('#settings #expand')
- if ($settingsButton.length === 0) {
- cy.log('Not logged in.')
- return
- }
-
- $settingsButton.click()
- cy.contains('Log out').click()
- })
- })
-})
-
-Cypress.Commands.add('nextcloudCreateUser', (user, password) => {
- cy.request({
- method: 'POST',
- url: `${Cypress.env('baseUrl')}/ocs/v1.php/cloud/users?format=json`,
- form: true,
- body: {
- userid: user,
- password,
- },
- auth: { user: 'admin', pass: 'admin' },
- headers: {
- 'Content-Type': 'application/x-www-form-urlencoded',
- 'OCS-ApiRequest': 'true',
- Authorization: `Basic ${Buffer.from('admin:admin').toString('base64')}`,
- },
- })
- cy.clearCookies()
-})
-
Cypress.Commands.add('uploadFile', (fileName, mimeType, path = '') => {
// get fixture
return cy.fixture(fileName, 'base64').then(file => {
diff --git a/cypress/support/e2e.js b/cypress/support/e2e.ts
index 8d34bd6e..9d0a3bc3 100644
--- a/cypress/support/e2e.js
+++ b/cypress/support/e2e.ts
@@ -14,4 +14,4 @@
// ***********************************************************
// Import commands.js using ES2015 syntax:
-import './commands.js'
+import './commands.ts'
diff --git a/cypress/tsconfig.json b/cypress/tsconfig.json
new file mode 100644
index 00000000..535eb577
--- /dev/null
+++ b/cypress/tsconfig.json
@@ -0,0 +1,4 @@
+{
+ "extends": "../tsconfig.json",
+ "include": ["./**/*.ts"],
+} \ No newline at end of file
diff --git a/lib/Service/CurlService.php b/lib/Service/CurlService.php
index f1ef53f3..c864bc14 100644
--- a/lib/Service/CurlService.php
+++ b/lib/Service/CurlService.php
@@ -105,9 +105,9 @@ class CurlService {
$account = $this->withoutBeginAt($account);
// we consider an account is like an email
- if (!filter_var($account, FILTER_VALIDATE_EMAIL)) {
- throw new InvalidResourceException('account format is not valid');
- }
+ // if (!filter_var($account, FILTER_VALIDATE_EMAIL)) {
+ // throw new InvalidResourceException('account format is not valid');
+ // }
$exploded = explode('@', $account);
diff --git a/package-lock.json b/package-lock.json
index e61b57de..58a1eb66 100644
--- a/package-lock.json
+++ b/package-lock.json
@@ -1,34283 +1,35001 @@
{
- "name": "social",
- "version": "0.0.1",
- "lockfileVersion": 2,
- "requires": true,
- "packages": {
- "": {
- "name": "social",
- "version": "0.0.1",
- "license": "agpl",
- "dependencies": {
- "@nextcloud/auth": "^2.0.0",
- "@nextcloud/axios": "^2.3.0",
- "@nextcloud/dialogs": "^4.0.1",
- "@nextcloud/initial-state": "^2.0.0",
- "@nextcloud/l10n": "^2.1.0",
- "@nextcloud/logger": "^2.5.0",
- "@nextcloud/moment": "^1.2.1",
- "@nextcloud/router": "^2.0.1",
- "@nextcloud/vue": "^7.12.0",
- "@nextcloud/vue-richtext": "^2.0.4",
- "blurhash": "^2.0.5",
- "debounce": "^1.2.1",
- "he": "^1.2.0",
- "linkify-plugin-mention": "^4.1.0",
- "linkify-string": "^4.1.0",
- "linkifyjs": "^4.1.0",
- "sass": "^1.59.2",
- "tributejs": "^5.1.3",
- "twemoji": "12.0.1",
- "uuid": "^8.3.2",
- "vue": "^2.7.10",
- "vue-click-outside": "^1.0.7",
- "vue-infinite-loading": "^2.4.4",
- "vue-masonry-css": "^1.0.3",
- "vue-material-