Configuring Cypress tests
This commit is contained in:
parent
18defd7067
commit
f1dd277864
|
@ -18,4 +18,5 @@ last-composer-build.md5
|
||||||
last-package-build.md5
|
last-package-build.md5
|
||||||
src/admin/scss/.sass-cache
|
src/admin/scss/.sass-cache
|
||||||
src/assets/css/tainacan-admin.css
|
src/assets/css/tainacan-admin.css
|
||||||
src/assets/css/tainacan-admin.css.map
|
src/assets/css/tainacan-admin.css.map
|
||||||
|
cypress
|
|
@ -1,2 +1,4 @@
|
||||||
# the destination folder, inside the plugins folder of some WordPress installation
|
# the destination folder, inside the plugins folder of some WordPress installation
|
||||||
destination=~/devel/wordpress/wp-content/plugins/tainacan
|
destination=~/devel/wordpress/wp-content/plugins/tainacan
|
||||||
|
wp_base_dir=~/devel/wordpress
|
||||||
|
wp_url=http://localhost/wp
|
|
@ -0,0 +1 @@
|
||||||
|
{}
|
File diff suppressed because it is too large
Load Diff
|
@ -28,6 +28,7 @@
|
||||||
"babel-preset-stage-2": "^6.24.1",
|
"babel-preset-stage-2": "^6.24.1",
|
||||||
"cross-env": "^3.0.0",
|
"cross-env": "^3.0.0",
|
||||||
"css-loader": "^0.25.0",
|
"css-loader": "^0.25.0",
|
||||||
|
"cypress": "^2.1.0",
|
||||||
"element-theme-chalk": "^2.1.0",
|
"element-theme-chalk": "^2.1.0",
|
||||||
"file-loader": "^0.9.0",
|
"file-loader": "^0.9.0",
|
||||||
"postcss-loader": "^2.1.0",
|
"postcss-loader": "^2.1.0",
|
||||||
|
|
|
@ -0,0 +1,53 @@
|
||||||
|
#!/bin/bash
|
||||||
|
|
||||||
|
source build-config.cfg
|
||||||
|
|
||||||
|
#./build.sh
|
||||||
|
|
||||||
|
|
||||||
|
plugin_name=`basename $destination`
|
||||||
|
test_db_prefix='wp_tainacan_test_'
|
||||||
|
|
||||||
|
|
||||||
|
# set up cypress environment
|
||||||
|
# replace table prefix in wp_config
|
||||||
|
sed -i s/"require_once(ABSPATH . 'wp-settings.php');"/"\$table_prefix = '$test_db_prefix';\nrequire_once(ABSPATH . 'wp-settings.php');"/ $wp_base_dir/wp-config.php
|
||||||
|
|
||||||
|
# install WordPress
|
||||||
|
cd $wp_base_dir
|
||||||
|
wp core install --url=$wp_url --title=Test --admin_user=admin --admin_password=admin --admin_email=admin@admin.com
|
||||||
|
|
||||||
|
# Activate Tainacan
|
||||||
|
wp plugin activate $plugin_name
|
||||||
|
|
||||||
|
|
||||||
|
#npx cypress run --env host=$wp_url,baseUrl=$wp_url
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
# teardown cypress environment
|
||||||
|
|
||||||
|
# remove WordPress
|
||||||
|
|
||||||
|
# recover table prefix in wp_config
|
||||||
|
sed -i s/"\$table_prefix = '$test_db_prefix';"/""/ $wp_base_dir/wp-config.php
|
||||||
|
|
||||||
|
TEST_DB_NAME=`cat $wp_base_dir/wp-config.php | grep "define('DB_NAME'"| perl -pe 's|define\(.DB_NAME.,\s*.(.*?)\W\s*\).*|$1|'`
|
||||||
|
TEST_DB_USER=`cat $wp_base_dir/wp-config.php | grep "define('DB_USER'"| perl -pe 's|define\(.DB_USER.,\s*.(.*?)\W\s*\).*|$1|'`
|
||||||
|
TEST_DB_PASS=`cat $wp_base_dir/wp-config.php | grep "define('DB_PASSWORD'"| perl -pe 's|define\(.DB_PASSWORD.,\s*.(.*?)\W\s*\).*|$1|'`
|
||||||
|
TEST_DB_HOST=`cat $wp_base_dir/wp-config.php | grep "define('DB_HOST'"| perl -pe 's|define\(.DB_HOST.,\s*.(.*?)\W\s*\).*|$1|'`
|
||||||
|
|
||||||
|
|
||||||
|
echo DROP TABLE $test_db_prefix'comments' | mysql -u $TEST_DB_USER -p$TEST_DB_PASS -h $TEST_DB_HOST $TEST_DB_NAME
|
||||||
|
echo DROP TABLE $test_db_prefix'commentmeta' | mysql -u $TEST_DB_USER -p$TEST_DB_PASS -h $TEST_DB_HOST $TEST_DB_NAME
|
||||||
|
echo DROP TABLE $test_db_prefix'links' | mysql -u $TEST_DB_USER -p$TEST_DB_PASS -h $TEST_DB_HOST $TEST_DB_NAME
|
||||||
|
echo DROP TABLE $test_db_prefix'options' | mysql -u $TEST_DB_USER -p$TEST_DB_PASS -h $TEST_DB_HOST $TEST_DB_NAME
|
||||||
|
echo DROP TABLE $test_db_prefix'postmeta' | mysql -u $TEST_DB_USER -p$TEST_DB_PASS -h $TEST_DB_HOST $TEST_DB_NAME
|
||||||
|
echo DROP TABLE $test_db_prefix'posts' | mysql -u $TEST_DB_USER -p$TEST_DB_PASS -h $TEST_DB_HOST $TEST_DB_NAME
|
||||||
|
echo DROP TABLE $test_db_prefix'term_relationships' | mysql -u $TEST_DB_USER -p$TEST_DB_PASS -h $TEST_DB_HOST $TEST_DB_NAME
|
||||||
|
echo DROP TABLE $test_db_prefix'term_taxonomy' | mysql -u $TEST_DB_USER -p$TEST_DB_PASS -h $TEST_DB_HOST $TEST_DB_NAME
|
||||||
|
echo DROP TABLE $test_db_prefix'termmeta' | mysql -u $TEST_DB_USER -p$TEST_DB_PASS -h $TEST_DB_HOST $TEST_DB_NAME
|
||||||
|
echo DROP TABLE $test_db_prefix'terms' | mysql -u $TEST_DB_USER -p$TEST_DB_PASS -h $TEST_DB_HOST $TEST_DB_NAME
|
||||||
|
echo DROP TABLE $test_db_prefix'usermeta' | mysql -u $TEST_DB_USER -p$TEST_DB_PASS -h $TEST_DB_HOST $TEST_DB_NAME
|
||||||
|
echo DROP TABLE $test_db_prefix'users' | mysql -u $TEST_DB_USER -p$TEST_DB_PASS -h $TEST_DB_HOST $TEST_DB_NAME
|
||||||
|
|
Loading…
Reference in New Issue