Giter Club home page Giter Club logo

tawk-wordpress's Introduction

Tests

Test setup and configuration

Building package to test

Run composer run build to build both dev and prod dependencies.

Run composer run package to build the tawk.to plugin zip file that will be tested.

Setting up docker environment

Docker-compose is used for test dependency setup and is required to run these tests

Configuring docker environment

Environment variables used in the docker-compose.yml file can be found in .env file.

Environment Variable Description Default Value
WORDPRESS_DB_HOST MySQL Service DB Host db:3306
WORDPRESS_DB_NAME MySQL Service DB Name wordpress
WORDPRESS_DB_USER MySQL Service DB User wordpress
WORDPRESS_DB_PASSWORD MySQL Service DB Password wordpress
WORDPRESS_DB_ROOT_PASSWORD MySQL Service DB Root Password somewordpress
WEB_HOST WordPress Web Host wordpress
WORDPRESS_DEBUG WordPress Debug Mode 1
WORDPRESS_ADMIN_USER WordPress Admin User admin
WORDPRESS_ADMIN_PASSWORD WordPress Admin Password admin
WORDPRESS_ADMIN_EMAIL WordPress Admin Email [email protected]
SELENIUM_BROWSER Selenium Server Browser Type chrome
SELENIUM_PORT Selenium Server Port 4444

Wordpress and WooCommerce setup

Docker environment is setup up to automatically populate test data This is done by wordpress-cli service in compose file

For more details on setup, see setup script

Running the test environment

To run docker environment for testing this repository, start docker compose file found in /tests/docker/docker-compose.yml

Example (assuming from root of repository)

docker-compose -f ./tests/docker/docker-compose.yml up -d

Environment is ready when wordpress-cli successfully exists. To monitor its status, you can tail it's logs using docker logs -f wordpress-cli

Configuring local test environment

These are the environment variables needed to run the selenium tests locally using composer script

Environment Variable Description Required
TAWK_PROPERTY_ID Property Id Yes
TAWK_WIDGET_ID Widget Id Yes
TAWK_USERNAME tawk.to account username Yes
TAWK_PASSWORD tawk.to account password Yes
WEB_HOST Wordpress web hostname Yes
WEB_PORT Wordpress web port No
SELENIUM_BROWSER Browser type (chrome, firefox, edge) Yes
SELENIUM_HOST Selenium host Yes
SELENIUM_PORT Selenium port No

Command Sample

TAWK_PROPERTY_ID=<TAWK_PROPERTY_ID> \
TAWK_WIDGET_ID=<TAWK_WIDGET_ID> \
TAWK_USERNAME=<TAWK_USERNAME> \
TAWK_PASSWORD=<TAWK_PASSWORD> \
WEB_HOST=wordpress \
SELENIUM_BROWSER=chrome \
SELENIUM_HOST=localhost \
SELENIUM_PORT=4444 \
composer run test

Storing local environments in a file for easy reference

To simplify testing, you can place your environment configuration in a .env.local file.

Example contents:

export TAWK_PROPERTY_ID='<TAWK_PROPERTY_ID>'
export TAWK_WIDGET_ID='<TAWK_WIDGET_ID>'
export TAWK_USERNAME='<TAWK_USERNAME>'
export TAWK_PASSWORD='<TAWK_PASSWORD>'
export WEB_HOST='wordpress'
export SELENIUM_BROWSER='chrome'
export SELENIUM_HOST='localhost'
export SELENIUM_PORT='4444'

And simply run

source .env.local && composer run test

Debugging the test environment/Developing

Ensure you have this line in your /etc/hosts

127.0.0.1 <WEB_HOST>

Then go to http://<WEB_HOST>/wp-admin and login with WORDPRESS_ADMIN_USER & WORDPRESS_ADMIN_PASSWORD

Running Tests on Github Actions

This repository is set up to use Github Actions to perform automated testing.

To use actions in this repository, the following secrets need to be configured:

Secret Description
TAWK_PROPERTY_ID Property Id
TAWK_WIDGET_ID Widget Id
TAWK_USERNAME tawk.to account username
TAWK_PASSWORD tawk.to account password

tawk-wordpress's People

Contributors

alvinjohnsonso avatar eug-l avatar geekofages 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.