Browse Source

Merge branch 'develop' into feature/638_refactor_applications+support_for_color.json

Bastien Sevajol 5 years ago
parent
commit
2d022681c1
No account linked to committer's email
30 changed files with 263 additions and 14 deletions
  1. 8 1
      .gitignore
  2. 82 0
      README.md
  3. 3 3
      backend/development.ini.sample
  4. 76 8
      backend/doc/setting.md
  5. 5 0
      bash_library.sh
  6. 6 0
      functionnal_tests/cypress.json.sample
  7. 0 0
      functionnal_tests/cypress_test/account/account_main_page.js
  8. 0 0
      functionnal_tests/cypress_test/account/content_account.js
  9. 0 0
      functionnal_tests/cypress_test/admin/content_admin_user.js
  10. 0 0
      functionnal_tests/cypress_test/admin/content_admin_workspace.js
  11. 0 0
      functionnal_tests/cypress_test/admin/navigation_admin_user.js
  12. 0 0
      functionnal_tests/cypress_test/admin/navigation_admin_workspace.js
  13. 0 0
      functionnal_tests/cypress_test/app_file/navigation_create_file.js
  14. 0 0
      functionnal_tests/cypress_test/app_folder/navigation_create_folder.js
  15. 0 0
      functionnal_tests/cypress_test/app_html-document/navigation_create_html-document.js
  16. 2 2
      functionnal_tests/cypress_test/app_html-document/operation_create_html-document.js
  17. 0 0
      functionnal_tests/cypress_test/app_thread/navigation_create_thread.js
  18. 0 0
      functionnal_tests/cypress_test/app_thread/operation_create_thread.js
  19. 0 0
      functionnal_tests/cypress_test/home_page/content_home_page.js
  20. 0 0
      functionnal_tests/cypress_test/interface/function_change_color.js
  21. 0 0
      functionnal_tests/cypress_test/login/content_login_page.js
  22. 0 0
      functionnal_tests/cypress_test/login/navigation_from_home_page_to_login_page.js
  23. 0 0
      functionnal_tests/cypress_test/login/navigation_from_login_page_to_home_page.js
  24. 0 0
      functionnal_tests/cypress_test/login/navigation_redirect_login_page.js
  25. 0 0
      functionnal_tests/cypress_test/workspace/content_workspace_dashboard.js
  26. 0 0
      functionnal_tests/cypress_test/workspace/navigation_create_workspace.js
  27. 0 0
      functionnal_tests/cypress_test/workspace/navigation_dashbord_link-for-calendar.js
  28. 0 0
      functionnal_tests/cypress_test/workspace/navigation_dashbord_link-for-webdav.js
  29. 64 0
      install_cypress.sh
  30. 17 0
      install_frontend_dependencies.sh

+ 8 - 1
.gitignore View File

@@ -6,4 +6,11 @@ frontend_app_html-document/dist/html-document.app.js
6 6
 frontend_lib/dist/tracim_frontend_lib.js
7 7
 npm-debug.log
8 8
 package-lock.json
9
-color.json
9
+color.json
10
+
11
+#ignore file or folder about cypress tests
12
+functionnal_tests/package.json
13
+functionnal_tests/cypress.json
14
+functionnal_tests/node_modules/
15
+functionnal_tests/cypress/
16
+

+ 82 - 0
README.md View File

@@ -2,3 +2,85 @@ develop branch status:
2 2
 [![Build Status](https://travis-ci.org/tracim/tracim_v2.svg?branch=develop)](https://travis-ci.org/tracim/tracim_v2)
3 3
 [![Coverage Status](https://coveralls.io/repos/github/tracim/tracim_v2/badge.svg?branch=develop)](https://coveralls.io/github/tracim/tracim_v2?branch=develop)
4 4
 [![Scrutinizer Code Quality](https://scrutinizer-ci.com/g/tracim/tracim_v2/badges/quality-score.png?b=develop)](https://scrutinizer-ci.com/g/tracim/tracim_v2/?branch=develop)
5
+
6
+
7
+## Install Tracim on your server ##
8
+
9
+Following the installation documentation below, you'll be able to run your own instance on your server.
10
+
11
+----
12
+
13
+# Installation #
14
+
15
+## Get the source ##
16
+
17
+Get the sources from GitHub (you need git):
18
+
19
+    git clone https://github.com/tracim/tracim_v2.git
20
+    cd tracim_v2/
21
+
22
+## Install backend
23
+### Option 1: Install backend manually ###
24
+
25
+see [Backend README](backend/README.md)
26
+
27
+### Option2: Install backend: Automated script for easy setup ###
28
+
29
+This script run backend with simple default conf: development.ini conf file, use
30
+default config file, sqlite database, etc...
31
+
32
+    ./setup_default_backend.sh
33
+
34
+For each conf file missing, this script will generated them from default conf.
35
+If sqlite default database is missing, script will generate it.
36
+This script is also able to serve for update. If you want to update a script
37
+generated tracim install, you can just update source code with git pull and
38
+rerun the same script to update database model, system deps and python deps.
39
+
40
+for more information about configuring tracim_backend, see [Backend README](backend/README.md)
41
+for more information about configuration file, see development.ini.sample documentation
42
+and [Backend setting file doc](backend/doc/setting.md).
43
+
44
+
45
+## Install frontend: Automated Script for easy setup ##
46
+
47
+    ./install_frontend_dependencies.sh
48
+    ./build_full_frontend.sh
49
+
50
+## Running Tracim using pserve ##
51
+
52
+    cd backend/
53
+    source env/bin/activate
54
+    pserve development.ini
55
+
56
+You can now enter the application at
57
+[http://127.0.0.1:6543](http://127.0.0.1:6543) and login with admin user:
58
+
59
+ * user: `admin@admin.admin`
60
+ * password: `admin@admin.admin`
61
+
62
+----
63
+
64
+## Running tests with cypress ##
65
+
66
+----
67
+
68
+## Installation of cypress: Automated script for easy setup ##
69
+
70
+This script check if nodejs is installed (npm is necessary to install Cypress), if file package.json and cypress.json exist in 'functionnal_tests' folder. if not the script install necessary file and install Cypress.
71
+
72
+    ./install_cypress.sh
73
+
74
+## Run tests with command line ##
75
+
76
+    cd functionnal_tests/
77
+    ./node_modules/.bin/cypress run
78
+
79
+## Run tests with cypressgui ##
80
+
81
+Open Cypress with graphical interface
82
+
83
+    cd functionnal_tests/
84
+    ./node_modules/.bin/cypress open
85
+
86
+

+ 3 - 3
backend/development.ini.sample View File

@@ -12,8 +12,8 @@ pyramid.debug_authorization = false
12 12
 pyramid.debug_notfound = false
13 13
 pyramid.debug_routematch = false
14 14
 pyramid.default_locale_name = en
15
-pyramid.includes =
16
-    pyramid_debugtoolbar
15
+#pyramid.includes =
16
+#    pyramid_debugtoolbar
17 17
 
18 18
 [pipeline:webdav]
19 19
 pipeline = tracim_webdav
@@ -291,4 +291,4 @@ formatter = generic
291 291
 
292 292
 [formatter_generic]
293 293
 format = %(asctime)s %(levelname)-5.5s [%(name)s:%(lineno)s][%(threadName)s] %(message)s
294
-datefmt = %H:%M:%S
294
+datefmt = %H:%M:%S

+ 76 - 8
backend/doc/setting.md View File

@@ -1,8 +1,13 @@
1
-# Setting #
1
+# Settings #
2 2
 
3
-Here is a short description of settings available in the file `development.ini`.
3
+Here is a short description of settings available in backend config files.
4 4
 
5
-## Listening port ##
5
+# Tracim config ini file #
6
+
7
+This file is called'development.ini' file by default, it's located is backend
8
+subdir, default config is [development.ini.sample](../development.ini.sample) with some doc.
9
+
10
+## Listening port (for pserve only) ##
6 11
 
7 12
 Default configuration is to listen on port 6534.
8 13
 If you want to adapt this to your environment, edit the `.ini` file and setup the port you want:
@@ -17,30 +22,93 @@ To allow other computer to access to this website, listen to "*" instead of loca
17 22
     ...
18 23
     listen = *:6534
19 24
 
20
-## Prod/Debug configuration ##
25
+## Database path ##
26
+
27
+To configure a database, you need to provide a valid sqlalchemy url:
28
+
29
+for sqlite, a valid value is something like this:
30
+
31
+    sqlalchemy.url = sqlite:///%(here)s/tracim.sqlite
32
+
33
+to know more about this, see [sqlalchemy documentation](http://docs.sqlalchemy.org/en/latest/core/engines.html).
34
+
35
+Be carefull, if sqlalchemy support many kind of Database, Tracim support is **not** guarantee.
36
+Tracim is officially supporting sqlite, postgresql and mysql.
37
+
38
+## Debugging and Logs ##
39
+### Debug params ###
40
+
41
+
42
+For debugging you can uncomment this 2 lines in '/backend/development.ini' to
43
+enable pyramid debugtoolbar.
44
+If you use debugtoolbar, you can seen one red button on right of the Tracim web interface.
45
+
46
+    ~~~
47
+    #pyramid.includes =
48
+    #    pyramid_debugtoolbar
49
+    ~~~
50
+
51
+you can add this line to active pyramid debug mode for almost anything:
52
+
53
+    ~~~
54
+    pyramid.debug_all = true
55
+    ~~~
56
+
57
+
58
+Hapic debug mode: this line is needed for more explicit json error,
59
+raised error traceback will be send through json. you can uncomment it
60
+
61
+   ~~~
62
+   # debug = True
63
+   ~~~
64
+
65
+pyramid.reload_templates = true
66
+
67
+### Prod/Debug configuration example ###
21 68
 
22 69
 
23 70
 To enable simple debug conf:
24 71
 
25
-    [app:main]
72
+    [app:tracim_web]
26 73
     ...
27 74
     pyramid.reload_templates = true
28 75
     pyramid.debug_all = true
29 76
     pyramid.includes =
30 77
         pyramid_debugtoolbar
31 78
 
79
+    [DEFAULT]
80
+    ...
81
+    debug = True
82
+
83
+
32 84
 production conf (no reload, no debugtoolbar):
33 85
 
34
-    [app:main]
86
+    [app:tracim_web]
35 87
     ...
36 88
     pyramid.reload_templates = false
37 89
     pyramid.debug_authorization = false
38 90
     pyramid.debug_notfound = false
39 91
     pyramid.debug_routematch = false
40 92
 
41
-You can, of course, also set level of one of the different logger to have more/less log
42
-about something.
93
+    [DEFAULT]
94
+    ...
95
+    debug = False
96
+
97
+You can, of course, also set level of one of the different logger
98
+to have more/less log about something.
43 99
 
44 100
     [logger_sqlalchemy]
45 101
     ...
46 102
     level = INFO
103
+
104
+# Color File #
105
+
106
+You can change default color of apps by setting color.json file, by default,
107
+placed at root of tracim_v2 dir, see [color.json.sample](../../color.json.sample)
108
+for default config file.
109
+
110
+# Wsgidav File
111
+
112
+This file is by default placed in backend subdir,
113
+it by default called wsigdav.conf, for more information, see default
114
+conf file [wsigdav.conf.sample](../wsgidav.conf.sample).

+ 5 - 0
bash_library.sh View File

@@ -2,8 +2,13 @@
2 2
 
3 3
 YELLOW='\033[1;33m'
4 4
 BROWN='\033[0;33m'
5
+GREEN='\033[1;32m'
5 6
 NC='\033[0m' # No Color
6 7
 
7 8
 function log {
8 9
     echo -e "\n${YELLOW}[$(date +'%H:%M:%S')]${BROWN} $ $1${NC}"
9 10
 }
11
+
12
+function loggood {
13
+    echo -e "\n${YELLOW}[$(date +'%H:%M:%S')]${GREEN} $ $1${NC}"
14
+} 

+ 6 - 0
functionnal_tests/cypress.json.sample View File

@@ -0,0 +1,6 @@
1
+{
2
+  "baseUrl": "http://localhost:6543",
3
+  "viewportWidth": 1280,
4
+  "viewportHeight": 1024,
5
+  "integrationFolder": "{path_test_file}"
6
+}

functionnal_tests/account/account_main_page.js → functionnal_tests/cypress_test/account/account_main_page.js View File


functionnal_tests/account/content_account.js → functionnal_tests/cypress_test/account/content_account.js View File


functionnal_tests/admin/content_admin_user.js → functionnal_tests/cypress_test/admin/content_admin_user.js View File


functionnal_tests/admin/content_admin_workspace.js → functionnal_tests/cypress_test/admin/content_admin_workspace.js View File


functionnal_tests/admin/navigation_admin_user.js → functionnal_tests/cypress_test/admin/navigation_admin_user.js View File


functionnal_tests/admin/navigation_admin_workspace.js → functionnal_tests/cypress_test/admin/navigation_admin_workspace.js View File


functionnal_tests/app_file/navigation_create_file.js → functionnal_tests/cypress_test/app_file/navigation_create_file.js View File


functionnal_tests/app_folder/navigation_create_folder.js → functionnal_tests/cypress_test/app_folder/navigation_create_folder.js View File


functionnal_tests/app_html-document/navigation_create_html-document.js → functionnal_tests/cypress_test/app_html-document/navigation_create_html-document.js View File


functionnal_tests/app_html-document/operation_create_html-document.js → functionnal_tests/cypress_test/app_html-document/operation_create_html-document.js View File

@@ -33,8 +33,8 @@ describe('operation :: workspace > create_new > html-document', function () {
33 33
     it ('all content > header button ', function () {
34 34
         var titre2='all content button'
35 35
         cy.url().should('include', '/workspaces/1/contents')
36
-        cy.get('.workspace__header__btnaddcontent').should('be.visible')
37
-        cy.get('.workspace__header__btnaddcontent').click()
36
+        cy.get('.workspace__header__btnaddcontent__label').should('be.visible')
37
+        cy.get('.workspace__header__btnaddcontent__label').click()
38 38
         cy.get('.workspace__header__btnaddcontent__setting div:nth-child(4).subdropdown__link').click()
39 39
         cy.get('.createcontent .createcontent__contentname').should('be.visible')
40 40
         cy.get('.createcontent .createcontent__form__input').should('have.attr', 'placeholder')

functionnal_tests/app_thread/navigation_create_thread.js → functionnal_tests/cypress_test/app_thread/navigation_create_thread.js View File


functionnal_tests/app_thread/operation_create_thread.js → functionnal_tests/cypress_test/app_thread/operation_create_thread.js View File


functionnal_tests/home_page/content_home_page.js → functionnal_tests/cypress_test/home_page/content_home_page.js View File


functionnal_tests/interface/function_change_color.js → functionnal_tests/cypress_test/interface/function_change_color.js View File


functionnal_tests/login/content_login_page.js → functionnal_tests/cypress_test/login/content_login_page.js View File


functionnal_tests/login/navigation_from_home_page_to_login_page.js → functionnal_tests/cypress_test/login/navigation_from_home_page_to_login_page.js View File


functionnal_tests/login/navigation_from_login_page_to_home_page.js → functionnal_tests/cypress_test/login/navigation_from_login_page_to_home_page.js View File


functionnal_tests/login/navigation_redirect_login_page.js → functionnal_tests/cypress_test/login/navigation_redirect_login_page.js View File


functionnal_tests/workspace/content_workspace_dashboard.js → functionnal_tests/cypress_test/workspace/content_workspace_dashboard.js View File


functionnal_tests/workspace/navigation_create_workspace.js → functionnal_tests/cypress_test/workspace/navigation_create_workspace.js View File


functionnal_tests/workspace/navigation_dashbord_link-for-calendar.js → functionnal_tests/cypress_test/workspace/navigation_dashbord_link-for-calendar.js View File


functionnal_tests/workspace/navigation_dashbord_link-for-webdav.js → functionnal_tests/cypress_test/workspace/navigation_dashbord_link-for-webdav.js View File


+ 64 - 0
install_cypress.sh View File

@@ -0,0 +1,64 @@
1
+#!/bin/bash
2
+ash
3
+. bash_library.sh # source bash_library.sh
4
+
5
+# install nodjs if not installed
6
+
7
+(
8
+  log "Verify if nodjs is installed."
9
+  dpkg -l | grep '^ii' | grep 'nodejs\s'
10
+
11
+  if [ $? -eq 0 ]; then
12
+    loggood "nodejs is installed."
13
+  else
14
+    log "Install nodejs"
15
+    sudo apt install curl
16
+    curl -sL https://deb.nodesource.com/setup_8.x | sudo -E bash -
17
+    sudo apt install -y nodejs
18
+    loggood "nodejs is now installed."
19
+  fi
20
+)
21
+
22
+# install Cypress
23
+log "Go to functionnal_tests subdir.."
24
+cd  functionnal_tests || exit 1;
25
+(
26
+  ACTUALDIR=$(pwd)
27
+  loggood "Your are now here: \"$ACTUALDIR\""
28
+  log "Check if package.json exist."
29
+  if [ ! -f package.json ]; then
30
+    log "package.json not exist => run npm init"
31
+    npm init -y
32
+    loggood "npm init finished => package.json is now created."
33
+  else
34
+    loggood "package.json exist."
35
+  fi
36
+  log "Install cypress."
37
+  npm install cypress --save-dev
38
+  loggood "Cypress is now installed."
39
+)
40
+
41
+# modify cypress.json
42
+
43
+(
44
+  log "Check if cypress.json exist."
45
+  if [ ! -f cypress.json ]; then
46
+    log "cypress.json not exist => copy from cypress.json.sample"
47
+    cp cypress.json.sample cypress.json
48
+    loggood "cypress.json is now available."
49
+    log "Write path in cypress.json"
50
+    SUBDIR=$(pwd)
51
+    sed -i "s|{path_test_file}|$SUBDIR/cypress_test|g" cypress.json
52
+    loggood "Path is now configured."
53
+  else
54
+  log "cypress.json exist => check if integrationFolder have path."
55
+    if grep -q "\"integrationFolder\"\:\s\"{path_test_file}\"" cypress.json ; then
56
+      log "No path => write path in cypress.json"
57
+      SUBDIR=$(pwd)
58
+      sed -i "s|{path_test_file}|$SUBDIR|g" cypress.json
59
+      loggood "Path is now configured."
60
+    else
61
+      loggood "Path exist. Modify manualy if necessary."
62
+    fi
63
+  fi
64
+)

+ 17 - 0
install_frontend_dependencies.sh View File

@@ -3,6 +3,23 @@
3 3
 # shellcheck disable=SC1091
4 4
 . bash_library.sh # source bash_library.sh
5 5
 
6
+# install nodjs if not installed
7
+
8
+(
9
+  log "verify if nodjs is installed"
10
+  dpkg -l | grep '^ii' | grep 'nodejs\s'
11
+
12
+  if [ $? -eq 0 ]; then
13
+    log "nodjs is installed"
14
+  else
15
+    log "install nodejs"
16
+    sudo apt install curl
17
+    curl -sL https://deb.nodesource.com/setup_8.x | sudo -E bash -
18
+    sudo apt install -y nodejs
19
+  fi
20
+)
21
+
22
+
6 23
 # install Tracim Lib
7 24
 
8 25
 (