Skip to content

parley-messaging/web-library

Repository files navigation

Documentation

Moved to https://developers.parley.nu/docs/introduction-2
(the pages are unlisted at the moment until the official release of version 2)

Develop

Initial configuration

To help develop this library you will need to set-up you environment. Follow the steps below to get started.

Due to some limitations we require you to install your project on your WSL host (if you are on windows). You can find more info on how to enable WSL on windows 10 here: https://docs.microsoft.com/en-us/windows/wsl/install-win10

  1. Make sure your (wsl) hosts file contains the following
    127.0.0.1   chat-dev.parley.nu
    
  2. Copy chat-dev.parley.nu cert into ssl/ssl.cert
  3. Copy chat-dev.parley.nu key into ssl/ssl.key
  4. Set/Install the node version we use (install nvm first if you do not have it)
    nvm use
    nvm install-latest-npm
  5. When using PHPStorm as your IDE:
    1. Open settings page
      • File -> Settings (or CTRL+ALT+S)
    2. Navigate to Languages & Frameworks -> Node.js and NPM
    3. Make sure your Node interpreter and Package manager are pointing to the nvm version (ex /home/user/.nvm/versions/node/v14.16.1/bin/node)
      1. Click on the ... button
      2. Click on the + button
      3. Click on Add WSL if you are using WSL, Add local otherwise
      4. From the Node.js interpreter dropdown, choose the one that is inside the .nvm fodler
      5. Click OK -> OK -> Apply
    4. Validate that the Package manager has also been updated to the .nvm path
  6. Install dependencies
    npm install

Start library example page

  1. Run the npm start-up command
    npm start
    

Testing

Cypress

Installation

  1. Install the following: https://docs.cypress.io/guides/getting-started/installing-cypress#UbuntuDebian
  2. Next install Cypress with NPM: https://docs.cypress.io/guides/getting-started/installing-cypress#npm-install
  3. WSL can't (yet) open GUI applications on its own, that's why we need additional setup: https://nickymeuleman.netlify.app/blog/gui-on-wsl2-cypress This is not necessary anymore due to npm run cy:open runs bin/start_cypress.sh. This also fixes the problem with DISPLAY env variable not being set when this npm action is run through PhpStorm.
  4. (optional) For every browser you want to test you'll need to install it in your WSL environment
    Here is how to install chrome
    wget https://dl.google.com/linux/direct/google-chrome-stable_current_amd64.deb
    sudo apt -y install ./google-chrome-stable_current_amd64.deb
    rm google-chrome-stable_current_amd64.deb
  5. Give execute access to /bin/start_cypress.sh
    chmod +x ./bin/start_cypress.sh
  6. Copy/Paste/Rename cypress.env.json.example to cypress.env.json and fill in the variables

Start

npm run cy:open