Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
93 changes: 68 additions & 25 deletions .github/workflows/cypress.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,39 +2,82 @@ name: Cypress

on: [push]

env:
APP_NAME: text
CYPRESS_baseUrl: http://localhost:8081/index.php

jobs:
build:

runs-on: ubuntu-latest

strategy:
fail-fast: false
matrix:
node-version: [12.x]
containers: [1, 2, 3]
php-versions: [ '7.4' ]
databases: [ 'sqlite' ]
server-versions: [ 'stable19' ]

steps:
- name: Checkout text app
uses: actions/checkout@v2
- name: Build the stack
run: |
cd cypress/
docker-compose up -d
- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v1
with:
node-version: ${{ matrix.node-version }}
- name: Wait for server
env:
CYPRESS_baseUrl: http://localhost:8081/index.php
run: |
npm install -g wait-on
wait-on -i 500 -t 240000 $CYPRESS_baseUrl || (cd cypress && docker-compose logs && exit 1)
cd cypress/ && docker-compose exec -T nextcloud bash /var/www/html/apps/text/cypress/server.sh
- name: Cypress run
uses: cypress-io/github-action@v1
with:
record: true
parallel: true
env:
CYPRESS_baseUrl: http://localhost:8081/index.php
CYPRESS_RECORD_KEY: ${{ secrets.CYPRESS_RECORD_KEY }}
- name: Checkout server
uses: actions/checkout@v2
with:
repository: nextcloud/server
ref: ${{ matrix.server-versions }}

- name: Checkout submodules
shell: bash
run: |
auth_header="$(git config --local --get http.https://github.com/.extraheader)"
git submodule sync --recursive
git -c "http.extraheader=$auth_header" -c protocol.version=2 submodule update --init --force --recursive --depth=1

- name: Checkout viewer
uses: actions/checkout@v2
with:
repository: nextcloud/viewer
ref: ${{ matrix.server-versions }}
path: apps/viewer

- name: Checkout ${{ env.APP_NAME }}
uses: actions/checkout@v2
with:
path: apps/${{ env.APP_NAME }}


- name: Set up php ${{ matrix.php-versions }}
uses: shivammathur/setup-php@v2
with:
php-version: ${{ matrix.php-versions }}
extensions: mbstring, iconv, fileinfo, intl, sqlite, pdo_sqlite
coverage: none

- name: Set up Nextcloud
env:
DB_PORT: 4444
PHP_CLI_SERVER_WORKERS: 10
run: |
mkdir data
php occ maintenance:install --verbose --database=${{ matrix.databases }} --database-name=nextcloud --database-host=127.0.0.1 --database-port=$DB_PORT --database-user=root --database-pass=rootpassword --admin-user admin --admin-pass admin
php occ config:system:set memcache.local --value="\\OC\\Memcache\\APCu"
php -f index.php
php -S 0.0.0.0:8081 &
export OC_PASS=1234561
php occ user:add --password-from-env user1
php occ user:add --password-from-env user2
php occ config:system:set force_language --value en
php occ app:enable viewer
php occ app:enable text
php occ app:list

- name: Cypress run
uses: cypress-io/github-action@v2
with:
record: true
parallel: true
wait-on: '${{ env.CYPRESS_baseUrl }}'
working-directory: 'apps/${{ env.APP_NAME }}'
env:
CYPRESS_RECORD_KEY: ${{ secrets.CYPRESS_RECORD_KEY }}
1 change: 1 addition & 0 deletions babel.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ module.exports = {
'@babel/plugin-syntax-dynamic-import',
'@babel/plugin-transform-classes',
['@babel/plugin-proposal-class-properties', { loose: true }],
'@babel/plugin-transform-modules-commonjs',
],
presets: [
[
Expand Down
22 changes: 13 additions & 9 deletions cypress/integration/share.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -31,21 +31,25 @@ describe('Open test.md in viewer', function() {
cy.nextcloudCreateUser(randUser, 'password')
cy.login(randUser, 'password')

// Upload test files
cy.uploadFile('test.md', 'text/markdown')
cy.uploadFile('test.md', 'text/markdown', 'test2.md')
cy.createFolder('folder')
cy.uploadFile('test.md', 'text/markdown', 'folder/test.md')
cy.visit('/apps/files')
cy.get('#fileList tr[data-file="test.md"]', {timeout: 10000})
.should('contain', 'test.md')

// FIXME: files app is thowing the following error for some reason
// Uncaught TypeError: Cannot read property 'protocol' of undefined
// Same for appswebroots setting in tests
cy.on('uncaught:exception', (err, runnable) => {
return false
})

cy.get('#fileList tr[data-file="welcome.txt"]', {timeout: 10000})
.should('contain', 'welcome.txt')

// Upload test files
cy.createFolder('folder')
cy.uploadFile('test.md', 'text/markdown', 'folder/test.md')
cy.uploadFile('test.md', 'text/markdown', 'test2.md')
cy.uploadFile('test.md', 'text/markdown')
cy.wait(1000)
cy.visit('/apps/files')
cy.get('#fileList tr[data-file="test.md"]', {timeout: 10000})
.should('contain', 'test.md')
})
after(function () {
cy.visit('/apps/files')
Expand Down
6 changes: 3 additions & 3 deletions cypress/support/commands.js
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ Cypress.env('baseUrl', url)
Cypress.Commands.add('login', (user, password, route = '/apps/files') => {
cy.clearCookies()
Cypress.Cookies.defaults({
whitelist: /^(oc|nc)/
preserve: /^(oc|nc)/
})
cy.visit(route)
cy.get('input[name=user]').type(user)
Expand All @@ -42,14 +42,14 @@ Cypress.Commands.add('login', (user, password, route = '/apps/files') => {

Cypress.Commands.add('logout', () => {
Cypress.Cookies.defaults({
whitelist: []
preserve: []
})

cy.clearLocalStorage()
cy.clearCookies()

Cypress.Cookies.defaults({
whitelist: /^(oc|nc)/
preserve: /^(oc|nc)/
})
})

Expand Down
6 changes: 3 additions & 3 deletions js/editor-collab.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion js/editor-collab.js.map

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions js/editor-guest.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion js/editor-guest.js.map

Large diffs are not rendered by default.

8 changes: 4 additions & 4 deletions js/editor-rich.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion js/editor-rich.js.map

Large diffs are not rendered by default.

Loading