add smoke test daily log in

This commit is contained in:
Ron Rennick 2021-04-01 17:17:34 -03:00
parent e5c2e32a7b
commit 9355c92231
3 changed files with 71 additions and 0 deletions

38
.github/workflows/smoke-test-daily.yml vendored Normal file
View File

@ -0,0 +1,38 @@
name: Smoke test daily
on:
schedule:
- cron: '3 25 * * *'
jobs:
login-run:
name: Log into smoke test site.
runs-on: ubuntu-18.04
steps:
- name: Create dirs.
run: |
mkdir -p code/woocommerce
mkdir -p package/woocommerce
mkdir -p tmp/woocommerce
mkdir -p node_modules
- name: Checkout code.
uses: actions/checkout@v2
with:
path: package/woocommerce
- name: Run npm install.
working-directory: package/woocommerce
run: npm install
- name: Move current directory to code. We will install zip file in this dir later.
run: mv ./package/woocommerce/* ./code/woocommerce
- name: Run login test.
working-directory: code/woocommerce
env:
SMOKE_TEST_URL: ${{ secrets.SMOKE_TEST_URL }}
SMOKE_TEST_ADMIN_USER: ${{ secrets.SMOKE_TEST_ADMIN_USER }}
SMOKE_TEST_ADMIN_PASSWORD: ${{ secrets.SMOKE_TEST_ADMIN_PASSWORD }}
SMOKE_TEST_CUSTOMER_USER: ${{ secrets.SMOKE_TEST_CUSTOMER_USER }}
SMOKE_TEST_CUSTOMER_PASSWORD: ${{ secrets.SMOKE_TEST_CUSTOMER_PASSWORD }}
run: npx wc-e2e test:e2e ./tests/e2e/specs/activate-and-setup/test-activation.js

View File

@ -0,0 +1,13 @@
{
"url": "SMOKE_TEST_URL",
"users": {
"admin": {
"username": "SMOKE_TEST_ADMIN_USER",
"password": "SMOKE_TEST_ADMIN_PASSWORD"
},
"customer": {
"username": "SMOKE_TEST_CUSTOMER_USER",
"password": "SMOKE_TEST_CUSTOMER_PASSWORD"
}
}
}

View File

@ -19,10 +19,30 @@ if ( fs.existsSync( localTestConfigFile ) ) {
);
}
/**
* Get test container configuration.
* @returns {any}
*/
const getTestConfig = () => {
const rawTestConfig = fs.readFileSync( testConfigFile );
const config = require( 'config' );
const url = config.get( 'url' );
const users = config.get( 'users' );
// Support for environment variable overrides.
let testConfig = JSON.parse( rawTestConfig );
if ( url ) {
testConfig.url = url;
}
if ( users ) {
if ( users.admin ) {
testConfig.users.admin = users.admin;
}
if ( users.customer ) {
testConfig.users.customer = users.customer;
}
}
let testPort = testConfig.url.match( /[0-9]+/ );
testConfig.baseUrl = testConfig.url.substr( 0, testConfig.url.length - 1 );
if ( Array.isArray( testPort ) ) {