Giter VIP home page Giter VIP logo

passbolt_selenium's Introduction

      ____                  __          ____
     / __ \____  _____ ____/ /_  ____  / / /_
    / /_/ / __ `/ ___/ ___/ __ \/ __ \/ / __/
   / ____/ /_/ (__  |__  ) /_/ / /_/ / / /_
  /_/    \__,_/____/____/_.___/\____/_/\__/

The open source password manager for teams
(c) 2022 Passbolt SA

License

Passbolt is distributed under Affero General Public License v3

Images and logos in /src/img/third_party belongs to their respective owner.

About

This is the official E2E testing styleguide for Passbolt the open source password manager for teams. This styleguide is dedicated to developers who want to improve Passbolt and aim at enriching their contribution with E2E tests.

Credits

https://www.passbolt.com/credits

Prerequisite

You need to have a passbolt environment build locally with selenium activate in config file and have done a sql export of the dummy data.

Install

Running locally

Before running the E2E tests, be sure you have Chrome, Microsfot Edge and Firefox Nightly as installed.

You have to build a local version of Passbolt browser extension for all browsers. To do this, first you need to checkout the Passbolt browser extension repository and go to the passbolt-browser-extension folder.

For Chrome and Microsoft Edge, run the command:

grunt build-chrome-debug

For firefox, run the command

grunt build-firefox-debug

That is going to generate a folder file and a crx file respectively in dist/firefox/passbolt-latest and dist/chrome/[email protected].

The Webdriver configuration file uses variable environment PASSBOLT_BROWSER_EXTENSION_CHROME and PASSBOLT_BROWSER_EXTENSION_FIREFOX and PASSBOLT_BROWSER_BINARY_FIREFOX to specify the location of these files. So, they should properly defined into your environment such as in an Unix-based platform:

export PASSBOLT_BROWSER_EXTENSION_CHROME=<YOUR-CHROME-CRX-FILE-PATH>
export PASSBOLT_BROWSER_EXTENSION_FIREFOX=<YOUR-FIREFOX-EXTENSION-FOLDER-PATH>
export PASSBOLT_BROWSER_BINARY_FIREFOX=<YOUR-FIREFOX-NIGHTLY-BINARY-FILE-PATH>
export BASE_URL_PRO=<YOUR-BASE-URL-PRO-EDITION>
export BASE_URL_CE=<YOUR-BASE-URL-CE-EDITION>

Be aware that Chrome based browsers are expecting a path for a .crx file whereas Firefox expects a folder path (such as the build/all folder generated with the previous commands).

After having browser extensions built, you can initialize the selenium tests. You'll need to run the following:

npm i
npm install --no-save msedgedriver --edgechromiumdriver_version=<LATEST-MICROSOFT-EDGE-VERSION>

We need to run this specific command for Microsoft Edge each time an npm install is done as it will remove the driver otherwise. The reason is that there is no packages that is being updated on time with the latest version of Microsoft Edge and we need to run this command which allows us to specify the latests version.

To find the latest version of the driver available, you can go on this page Microsoft Edge web drivers and pick the version displayed (the entire version with all the numbers).

Finally, run the test as follows for 'pro' or 'ce' edition :

npx wdio wdio.local.pro.conf.js
npx wdio wdio.local.ce.conf.js

Running saucelabs

You have to build a local version of Passbolt browser extension for both browsers. To do this, first you need to checkout the Passbolt browser extension repository and go to the passbolt-browser-extension folder.

For Chrome, run the command:

grunt build-chrome-debug

For firefox, run the command

grunt build-firefox-debug

That is going to generate a folder file and a crx file respectively in dist/firefox/passbolt-latest and dist/chrome/[email protected].

The Webdriver configuration file uses variable environment PASSBOLT_BROWSER_EXTENSION_CHROME and PASSBOLT_BROWSER_EXTENSION_FIREFOX to specify the location of these files.

You need also to have SAUCELABS_USERNAME and SAUCELABS_ACCESS_KEY. Pay attention to have a 36 characters long for the access key, if it's not the case generate a new one on sauce labs.

So, they should properly defined into your environment such as in an Unix-based platform:

export PASSBOLT_BROWSER_EXTENSION_CHROME=<YOUR-CHROME-CRX-FILE-PATH>
export PASSBOLT_BROWSER_EXTENSION_FIREFOX=<YOUR-FIREFOX-EXTENSION-FOLDER-PATH>
export BASE_URL_PRO=<YOUR-BASE-URL-PRO-EDITION>
export BASE_URL_CE=<YOUR-BASE-URL-CE-EDITION>
export SAUCELABS_USERNAME=<YOUR-SAUCELABS-USERNAME>
export SAUCELABS_ACCESS_KEY=<YOUR-SAUCELABS-ACCESS-KEY>

Be aware that Chrome is expecting a path for a .crx file whereas Firefox expects a folder path (such as the build/all folder generated with the previous commands).

Finally, run the test as follows for 'pro' or 'ce' edition :

npx wdio wdio.saucelabs.pro.conf.js
npx wdio wdio.saucelabs.ce.conf.js

Running with shell

Before execute it, check if the prerequisite is done. You could execute the run_selenium_test.sh and choose which version launch. If some environment variable are not set, the script will ask you and set it.

./bin/run_selenium_tests.sh

Setup base data

In order to run properly, these tests are assuming that a server is running with a database having a set of data already available. Passbolt provides the required data. To set them up, you need to access your server via a command line. Then go to the root folder of passbolt application (i.e. it could be something like /var/www/passbolt).

In that folder you can run the following commands:

./bin/cake passbolt insert default
./bin/cake passbolt cleanup
./bin/cake passbolt mysql_export --file selenium_tests.sql

The last command might ease your process later in case of a test that fails. It actually dumps your database into the specified .sql file.

Normally, when the tests are run, the data should get back to their initiale state. However, if an error occurs chances are that the data will be corrupted. To recover them, you can simply use the previously generated SQL file for an import.

./bin/cake passbolt mysql_import --file selenium_tests.sql

passbolt_selenium's People

Contributors

cedricalfonsi avatar kevinmuller avatar stripthis avatar whhone avatar cbergau avatar benj1er avatar v-slenter avatar ashleydw avatar ondram avatar gamabunta57 avatar okrad avatar dsereni avatar davidsickmiller avatar scadra avatar davertmik avatar mordred avatar jonstjohn avatar jsifalda avatar akshayminocha5 avatar abhinavkumar940 avatar arianf avatar danielbeardsley avatar motin avatar gabrielpreston avatar jubishop avatar kraigh avatar martyix avatar blackakula avatar tobiaslang avatar alekciy avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.