Add gravity flow demo

This commit is contained in:
Almira Krdzic
2018-06-28 10:02:07 +02:00
parent 1b5076bf2f
commit 12a5066018
1106 changed files with 317603 additions and 4720 deletions

View File

@@ -0,0 +1,37 @@
<?php
/*
* Purpose: Test the field conditional logic and the numeric input validation
*/
$I = new AcceptanceTester( $scenario );
$I->wantTo( 'Test the field conditional logic and the numeric input validation' );
// Submit the form
$I->amOnPage( '/0001-conditional-field' );
$I->see( 'Conditional Field' );
$I->scrollTo( [ 'css' => '.gform_title' ] ); // needed for chromedriver
$I->selectOption( 'input[name=input_1]', 'Second Choice' );
$I->seeElement('select[name="input_3"]');
$I->selectOption( 'select[name=input_3]', 'Second Choice' );
$I->seeElement('input[name="input_4"]');
$I->fillField( 'input[name=input_4]', '123NAN' );
$I->scrollTo( [ 'css' => 'input[type=submit]' ] ); // needed for chromedriver
$I->click( 'Submit' );
// trow number field error
$I->waitForElement( 'div.validation_error', 3 );
// fill number field with correct values
$I->fillField( 'input[name=input_4]', '1234' );
$I->click( 'Submit' );
$I->waitForText( 'Thanks for contacting us! We will get in touch with you shortly.', 3 );
// Login to wp-admin
$I->loginAsAdmin();
// Go to Status
$I->amOnWorkflowPage( 'Status' );
$I->click( 'Conditional Field' );
$I->waitForText( 'Status: Complete', 3 );

View File

@@ -0,0 +1,45 @@
<?php
/*
* Purpose: Test the field conditional logic on the user input step
*/
$I = new AcceptanceTester( $scenario );
$I->wantTo( 'Test the field conditional logic on the user input step' );
// Submit the form
$I->amOnPage( '/0002-conditional-logic' );
$I->see( 'Conditional Logic' );
$I->scrollTo( [ 'css' => '.gform_title' ], 20, 50 ); // needed for chromedriver
$I->selectOption( 'input[name=input_7]', 'Second Choice' );
$I->dontSeeElement( 'textarea[name=input_15]' );
$I->checkOption( 'input[name=input_13\\.1]' );
$I->seeElement( 'textarea[name=input_15]' );
$I->fillField( 'textarea[name=input_15]', 'Some text' );
$I->scrollTo( [ 'css' => '.gform_page_footer .gform_next_button' ], 20, 50 ); // needed for chromedriver
// Next page
$I->click( '.gform_page_footer .gform_next_button' );
$I->click( 'input[type=submit]' );
$I->waitForText( 'Thanks for contacting us!', 3 );
// Login to wp-admin
$I->loginAsAdmin();
$I->seeInCurrentUrl( '/wp-admin/' );
// Go to Inbox
$I->amOnWorkflowPage( 'Inbox' );
$I->click( 'Conditional Logic' );
// Approve
$I->waitForElement( 'button[value=approved]', 3 );
$I->click( 'button[value=approved]' );
// Check field conditional logic on the user input step
$I->waitForText( 'Some text', 3 );
$I->see( 'Second Section - Second Choice' );
$I->seeElement( 'textarea[name=input_15]' );
$I->uncheckOption( 'input[name=input_13\\.1]' );
$I->dontSeeElement( 'textarea[name=input_15]' );

View File

@@ -0,0 +1,39 @@
<?php
/*
* Purpose: Test assignee routing based on the value of a checkbox field
*/
$I = new AcceptanceTester( $scenario );
$I->wantTo( 'Test assignee routing based on the value of a checkbox field' );
// Submit the form
$I->amOnPage( '/0003-dynamic-assignee-routing' );
$I->scrollTo( [ 'css' => '.gform_title' ] );
$I->fillField( 'Single Line', 'Some Text' );
$I->fillField( 'Paragraph', 'Some Text' );
$I->checkOption( 'Publisher 1' );
$I->checkOption( 'Publisher 3' );
$I->scrollTo( [ 'css' => 'input[type=submit]' ] );
$I->click( 'Submit' );
$I->loginAsAdmin();
$I->amOnWorkflowPage( 'Inbox' );
$I->click( 'Dynamic Assignee Routing' );
$I->waitForText( 'User: admin1 admin1 (Pending)', 3 );
$I->see( 'User: admin3 admin3 (Pending)' );
$I->dontSee( 'User: admin2 admin2 (Pending)' );
// Add admin2 to the assignees (configured in the step conditional routing)
$I->checkOption( 'Publisher 2' );
$I->click( 'Update' );
$I->waitForText( 'User: admin1 admin1 (Pending)', 3 );
$I->see( 'User: admin2 admin2 (Pending)' );
$I->see( 'User: admin3 admin3 (Pending)' );

View File

@@ -0,0 +1,54 @@
<?php
/*
* Purpose: Test dynamically pre populate fields
*/
$I = new AcceptanceTester( $scenario );
$I->wantTo( 'Test dynamically pre populate fields' );
// Submit the form
$I->amOnPage( '/0004-dynamically-pre-populate-fields/?quant=10&prodname=Test product&prodprice=25' );
$I->waitForText( 'Dynamically Pre Populate Fields', 3 );
$I->scrollTo( [ 'css' => '.gform_title' ], 20, 50 ); // needed for chromedriver
$I->selectOption( 'input[name="input_3.1"]', 'First Option' );
$I->selectOption( 'input[name="input_3.2"]', 'Second Option' );
$I->see( '$320.00' );
$I->scrollTo( [ 'css' => 'input[type=submit]' ], 20, 50 ); // needed for chromedriver
// Next page
$I->click( '.gform_page_footer .gform_next_button' );
$I->fillField( 'textarea[name="input_6"]', 'Discussion text field.' );
$I->selectOption( 'select[name=input_8]', 'admin2 admin2' );
$I->click( 'Submit' );
$I->waitForText( 'Thanks for contacting us! We will get in touch with you shortly.', 3 );
// Login as admin2
$I->loginAs( 'admin2', 'admin2' );
$I->seeInCurrentUrl( '/wp-admin/' );
// Go to Inbox
$I->amOnWorkflowPage( 'Inbox' );
$I->click( 'Dynamically Pre Populate Fields' );
$I->fillField( 'input[name="input_2"]', '11' );
$I->fillField( 'textarea[name="gravityflow_note"]', 'Quantity updated!' );
$I->click( 'Submit' );
// Log out
$I->logOut();
// Login as Admin
$I->loginAsAdmin();
$I->seeInCurrentUrl( '/wp-admin/' );
// Go to Inbox
$I->amOnWorkflowPage( 'Inbox' );
$I->click( 'Dynamically Pre Populate Fields' );
// Approve
$I->fillField( 'textarea[name="gravityflow_note"]', 'Order approved' );
$I->seeElement( 'button[value=approved]' );
$I->click( 'button[value=approved]' );
$I->waitForText( 'Status: Approved', 3 );

View File

@@ -0,0 +1,35 @@
<?php
/*
* Purpose: Test the file upload field in the user input step
*/
$I = new AcceptanceTester( $scenario );
$I->wantTo( 'Test the file upload field in the user input step' );
// Submit the form
$I->amOnPage( '/0005-file-upload-user-input' );
$I->see( 'File Upload User Input' );
$I->scrollTo( [ 'css' => '.gform_title' ], 20, 50 ); // needed for chromedriver
$I->fillField( 'Single Line Text', 'testing' );
$I->scrollTo( [ 'css' => 'input[type=submit]' ], 20, 50 );
$I->click( 'Submit' );
$I->see( 'Thanks for contacting us! We will get in touch with you shortly.' );
// Login to wp-admin
$I->loginAsAdmin();
$I->seeInCurrentUrl( '/wp-admin/' );
// Go to Inbox
$I->amOnWorkflowPage( 'Inbox' );
$I->click( 'File Upload User Input' );
$I->attachFile( 'input[name=input_2]', 'gravityflow-logo.png' );
$I->click( 'Submit' );
$I->waitForElement( 'div.gravityflow_validation_error', 3 );
$I->selectOption( 'input[name=input_3]', 'Second Choice' );
$I->click( 'Submit' );
$I->waitForText( 'gravityflow-logo.png', 3 );
$I->seeLink( 'gravityflow-logo.png' );

View File

@@ -0,0 +1,21 @@
<?php
/*
* Purpose: Test calculations that use fields that are not editable or displayed
*/
$I = new AcceptanceTester( $scenario );
$I->wantTo( 'Test calculations that use fields that are not editable or displayed.');
$I->amOnPage( '/0006-hidden-field-calculations' );
$I->fillField( 'Single Line', 'Test' );
$I->fillField( 'Number', 2 );
$I->click( 'Submit' );
$I->loginAsAdmin();
$I->amOnWorkflowPage( 'Inbox' );
$I->click( 'Hidden Field Calculations' );
$I->waitForText( 'Single Line', 3 );
$I->seeInField( 'Number 2', '4' );
$I->seeInField( 'Number 3', '8' );

View File

@@ -0,0 +1,77 @@
<?php
/*
* Purpose: Test the job apply workflow
*/
$I = new AcceptanceTester( $scenario );
$I->wantTo( 'Test the job apply workflow' );
// Submit the form
$I->amOnPage( '/0007-job-apply-agency' );
$I->see( 'Job Apply Agency' );
$I->scrollTo( [ 'css' => '.gform_title' ], 20, 50 ); // needed for chromedriver
$I->fillField( 'input[name="input_3.3"]', 'First' );
$I->fillField( 'input[name="input_3.6"]', 'Last' );
$I->selectOption( 'select[name="input_2"]', 'Female' );
$I->selectOption( 'select[name="input_6"]', '65 or Above' );
$I->selectOption( 'select[name="input_7"]', 'Homemaker' );
$I->selectOption( 'select[name="input_8"]', 'Seasonal' );
$I->scrollTo( [ 'css' => 'input[type=submit]' ], 20, 50 ); // needed for chromedriver
$I->click( 'Submit' );
$I->waitForText( 'Thanks for contacting us! We will get in touch with you shortly.', 3 );
// Login as admin2
$I->loginAs( 'admin2', 'admin2' );
$I->seeInCurrentUrl( '/wp-admin/' );
// Go to Inbox
$I->amOnWorkflowPage( 'Inbox' );
$I->click( '0007 Job Apply Agency' );
// Approve
$I->fillField( 'textarea[name="gravityflow_note"]', 'Added to DB' );
$I->seeElement( 'button[value=approved]' );
$I->click( 'button[value=approved]' );
// Check data
$I->wait(1);
$I->fillField( 'input[name="input_4"]', '0210000000' );
$I->fillField( 'textarea[name="gravityflow_note"]', 'Phone added' );
$I->click( 'Submit' );
// Log out
$I->logOut();
// Login as admin1
$I->loginAs( 'admin1', 'admin1' );
$I->seeInCurrentUrl( '/wp-admin/' );
// Go to Inbox
$I->amOnWorkflowPage( 'Inbox' );
$I->click( '0007 Job Apply Agency' );
// Check data
$I->fillField( 'input[name="input_5"]', 'example@example.com' );
$I->fillField( 'textarea[name="gravityflow_note"]', 'Email added' );
$I->click( 'Submit' );
// Log out
$I->logOut();
// Login as Admin
$I->loginAsAdmin();
$I->seeInCurrentUrl( '/wp-admin/' );
// Go to Inbox
$I->amOnWorkflowPage( 'Inbox' );
$I->click( '0007 Job Apply Agency' );
// Approve
$I->fillField( 'textarea[name="gravityflow_note"]', 'Entry approved' );
$I->seeElement( 'button[value=approved]' );
$I->click( 'button[value=approved]' );
$I->waitForText( 'Status: Approved', 3 );

View File

@@ -0,0 +1,49 @@
<?php
/*
* Purpose: Test the approval steps
*/
$I = new AcceptanceTester( $scenario );
$I->wantTo( 'Test the approval steps' );
// Submit the form
$I->amOnPage( '/0008-request-salary-raise' );
$I->waitForText( 'Request Salary Raise', 3 );
$I->scrollTo( [ 'css' => '.gform_title' ], 20, 50 ); // needed for chromedriver
$I->fillField( 'input[name=input_1]', '20%' );
$I->selectOption( 'select[name=input_2]', 'Third Choice' );
$I->scrollTo( [ 'css' => 'input[type=submit]' ], 20, 50 ); // needed for chromedriver
$I->click( 'Submit' );
// trow number field error
$I->seeElement( 'div.validation_error' );
// fill number field with correct values
$I->fillField( 'input[name=input_1]', '1234' );
$I->scrollTo( [ 'css' => 'input[type=submit]' ], 20, 50 ); // needed for chromedriver
$I->click( 'Submit' );
$I->waitForText( 'Thanks for contacting us! We will get in touch with you shortly.', 3 );
// Login to wp-admin
$I->loginAsAdmin();
// Go to Inbox
$I->amOnWorkflowPage( 'Inbox' );
$I->waitForText( 'Request Salary Raise', 3 );
$I->click( '0008 Request Salary Raise' );
// Approve
$I->waitForElement( 'button[value=approved]', 3 );
$I->click( 'button[value=approved]' );
// Send to CEO
$I->selectOption( 'select[name=gravityflow_admin_action]', 'CEO approval' );
$I->click( 'Apply' );
// Approve
$I->waitForElement( 'button[value=approved]', 3 );
$I->click( 'button[value=approved]' );
$I->waitForText( 'Status: Approved', 3 );

View File

@@ -0,0 +1,30 @@
<?php
/*
* Purpose: Test scheduling a step
*/
$I = new AcceptanceTester( $scenario );
$I->wantTo( 'Test scheduling a step' );
// Submit the form
$I->amOnPage( '/0009-schedule-step' );
$I->waitForText( 'Schedule Step', 3 );
$I->scrollTo( [ 'css' => '.gform_title' ], 20, 50 ); // needed for chromedriver
$I->fillField( 'input[name="input_1"]', 'Some text' );
$I->fillField( 'textarea[name="input_2"]', 'Some paragraph text' );
$I->scrollTo( [ 'css' => 'input[type=submit]' ], 20, 50 ); // needed for chromedriver
$I->click( 'Submit' );
$I->waitForText( 'Thanks for contacting us! We will get in touch with you shortly.', 3 );
// Login to wp-admin
$I->loginAsAdmin();
$I->seeInCurrentUrl( '/wp-admin/' );
// Go to Status
$I->amOnWorkflowPage( 'Status' );
$I->waitForText( 'Schedule Step', 3 );
$I->click( '0009 Schedule Step' );
$I->waitForText( 'Send schedule notification (Queued)', 3 );

View File

@@ -0,0 +1,69 @@
<?php
/*
* Purpose: Test specific assign
*/
$I = new AcceptanceTester( $scenario );
$I->wantTo( 'Test specific assign' );
// Submit the form
$I->amOnPage( '/0010-specific-assign' );
$I->see( 'Specific Assign' );
$I->scrollTo( [ 'css' => '.gform_title' ], 20, 50 ); // needed for chromedriver
$I->fillField( 'input[name="input_1"]', 'Some text' );
$I->fillField( 'textarea[name="input_2"]', 'Some paragraph text' );
$I->fillField( 'input[name="input_3"]', 'Tag 1, Tag 2, Tag 3' );
$I->selectOption( 'input[name="input_4.2"]', 'Second Choice' );
$I->selectOption( 'input[name="input_4.3"]', 'Third Choice' );
$I->scrollTo( [ 'css' => 'input[type=submit]' ], 20, 50 ); // needed for chromedriver
$I->click( 'Submit' );
$I->see( 'Thanks for contacting us! We will get in touch with you shortly.' );
// Login to wp-admin
$I->loginAsAdmin();
$I->seeInCurrentUrl( '/wp-admin/' );
// Go to Inbox
$I->click( 'Workflow' );
$I->click( 'Inbox' );
$I->see( 'Workflow Inbox' );
$I->click( 'Specific Assign' );
// Approve
$I->seeElement( 'button[value=approved]' );
$I->click( 'button[value=approved]' );
// Log out
$I->logOut();
// Login as admin2
$I->loginAs( 'admin2', 'admin2' );
$I->seeInCurrentUrl( '/wp-admin/' );
// Go to Inbox
$I->amOnWorkflowPage( 'Inbox' );
$I->click( 'Specific Assign' );
// Approve
$I->waitForElement( 'button[value=approved]', 3 );
$I->click( 'button[value=approved]' );
// Log out
$I->logOut();
// Login as admin3
$I->loginAs( 'admin3', 'admin3' );
$I->seeInCurrentUrl( '/wp-admin/' );
// Go to Inbox
$I->amOnWorkflowPage( 'Inbox' );
$I->click( 'Specific Assign' );
// Approve
$I->waitForElement( 'button[value=approved]', 3 );
$I->click( 'button[value=approved]' );
$I->waitForText( 'Status: Approved', 3 );

View File

@@ -0,0 +1,33 @@
<?php
/*
* Purpose: Test step conditional logic
*/
$I = new AcceptanceTester( $scenario );
$I->wantTo( 'Test step conditional logic' );
$I->loginAsAdmin();
$I->amOnPage( '/0011-step-conditional-logic' );
$I->fillField( 'Single Line', 'test' );
$I->fillField( 'Paragraph', 'test' );
$I->selectOption( 'User', '1' );
$I->click( 'Submit' );
$I->amOnWorkflowPage( 'Inbox' );
$I->click( '0011 Step Conditional Logic' );
$I->waitforText( 'Approval if Created By ID1' );
$I->see( 'Approval if Created By ID1', '.gravityflow-status-box' );
$I->dontSee( 'Approval if Created By ID2', '.gravityflow-status-box' );
$I->click( 'Approve' );
$I->waitforText( 'Approval if User Field ID1' );
$I->see( 'Approval if User Field ID1', '.gravityflow-status-box' );
$I->dontSee( 'Approval if User Field ID2', '.gravityflow-status-box' );
$I->click( 'Approve' );
$I->see( 'Entry Approved' );

View File

@@ -0,0 +1,54 @@
<?php
/*
* Purpose: Test revert user
*/
$I = new AcceptanceTester( $scenario );
$I->wantTo( 'Test Revert User' );
// Submit the form
$I->amOnPage( '/0012-test-revert-user' );
$I->see( 'Test Revert User' );
$I->scrollTo( [ 'css' => '.gform_title' ], 20, 50 ); // needed for chromedriver
$I->fillField( 'input[name="input_1"]', 'Some text' );
$I->selectOption( 'select[name="input_2"]', 'Second Choice' );
// Next page
$I->click( '.gform_page_footer .gform_next_button' );
$I->fillField( 'input[name="input_4"]', '42' );
$I->scrollTo( [ 'css' => 'input[type=submit]' ], 20, 50 ); // needed for chromedriver
$I->click( 'Submit' );
$I->see( 'Thanks for contacting us! We will get in touch with you shortly.' );
// Login to wp-admin
$I->loginAsAdmin();
$I->seeInCurrentUrl( '/wp-admin/' );
// Go to Inbox
$I->amOnWorkflowPage( 'Inbox' );
$I->click( '0012 Test Revert User' );
// Approve
$I->waitForElement( 'button[value=approved]', 3 );
$I->click( 'button[value=approved]' );
// Verify number
$I->seeElement( 'input[name="input_4"]' );
$I->fillField( 'input[name="input_4"]', '40' );
$I->click( 'Submit' );
// Revert
$I->waitForElement( 'button[value=revert]', 3 );
$I->click( 'button[value=revert]' );
// Update number
$I->waitForElement( 'input[name="input_4"]', 3 );
$I->fillField( 'input[name="input_4"]', '41' );
$I->click( 'Submit' );
// Approve
$I->waitForElement( 'button[value=approved]', 3 );
$I->click( 'button[value=approved]' );
$I->see( 'Entry Approved' );

View File

@@ -0,0 +1,51 @@
<?php
/*
* Purpose: Test total depending on quantity
*/
$I = new AcceptanceTester( $scenario );
$I->wantTo( 'Test total depending on quantity' );
// Submit the form
$I->amOnPage( '/0013-total-depending-on-quantity' );
$I->see( '0013 Total Depending On Quantity' );
$I->scrollTo( [ 'css' => '.gform_title' ], 20, 50 ); // needed for chromedriver
$I->fillField( 'input[name="input_1"]', 'Some text' );
$I->fillField( 'textarea[name="input_2"]', 'Some paragraph text' );
$I->selectOption( 'input[name=input_4]', 'Second Choice' );
$I->selectOption( 'select[name="input_5"]', 'Medium' );
$I->fillField( 'input[name="input_6"]', '1' );
$I->scrollTo( [ 'css' => '.gfield_shipping' ], 20, 50 );
$I->selectOption( 'input[name="input_7"]', 'Third Choice' );
$I->see( '$24.00' );
$I->scrollTo( [ 'css' => 'input[type=submit]' ], 20, 50 ); // needed for chromedriver
$I->click( 'Submit' );
$I->waitForText( 'Thanks for contacting us! We will get in touch with you shortly.', 3 );
// Login to wp-admin
$I->loginAsAdmin();
$I->seeInCurrentUrl( '/wp-admin/' );
// Go to Inbox
$I->amOnWorkflowPage( 'Inbox' );
$I->click( '0013 Total Depending On Quantity' );
// Approve
$I->fillField( 'textarea[name="gravityflow_note"]', 'Change quantity to 2' );
$I->seeElement( 'button[value=rejected]' );
$I->click( 'button[value=rejected]' );
// Change quantity
$I->seeElement( 'input[name="input_6"]' );
$I->fillField( 'input[name="input_6"]', '2' );
$I->click( 'Submit' );
// Approve
$I->waitForText( '$44.00', 3 );
$I->seeElement( 'button[value=approved]' );
$I->click( 'button[value=approved]' );
$I->see( 'Entry Approved' );

View File

@@ -0,0 +1,47 @@
<?php
/*
* Purpose: Test the two pages on the user input step
*/
$I = new AcceptanceTester( $scenario );
$I->wantTo( 'Test the two pages on the user input step' );
// Submit the form
$I->amOnPage( '/0014-two-pages-rejected' );
$I->makeScreenshot( 'Form loaded.' );
$I->see( '0014 Two Pages Rejected' );
$I->scrollTo( [ 'css' => '.gform_title' ], 20, 50 ); // needed for chromedriver
$I->selectOption( 'input[name=input_7]', 'Third Choice' );
$I->scrollTo( [ 'css' => '.gform_page_footer .gform_next_button' ], 20, 50 ); // needed for chromedriver
// Next page
$I->click( '.gform_page_footer .gform_next_button' );
$I->selectOption( 'select[name=input_20]', 'Third Choice' );
$I->makeScreenshot( 'Before form submit.' );
$I->click( 'input[type=submit]' );
$I->makeScreenshot( 'Form submitted.' );
$I->see( 'Thanks for contacting us!' );
// Login to wp-admin
$I->loginAsAdmin();
$I->seeInCurrentUrl( '/wp-admin/' );
// Go to Inbox
$I->amOnWorkflowPage( 'Inbox' );
$I->click( '0014 Two Pages Rejected' );
// Reject
$I->click( 'Reject' );
// Complete
$I->waitForText( 'Rejected request (Pending Input)', 3 );
$I->click( 'Submit' );
$I->waitForText( 'Status: Rejected', 3 );

View File

@@ -0,0 +1,41 @@
<?php
/*
* Purpose: Test the field conditional logic on the user input step
*/
$I = new AcceptanceTester( $scenario );
$I->wantTo( 'Test the field conditional logic on the user input step' );
// Submit the form
$I->amOnPage( '/0015-user-input' );
$I->see( '0015 User Input' );
$I->scrollTo( [ 'css' => '.gform_title' ], 20, 50 ); // needed for chromedriver
$I->fillField( 'Paragraph', 'Some text' );
$I->scrollTo( [ 'css' => 'input[type=submit]' ], 20, 50 ); // needed for chromedriver
// Next page
$I->click( 'Submit' );
$I->waitForText( 'Thanks for contacting us!', 3 );
// Login to wp-admin
$I->loginAsAdmin();
$I->seeInCurrentUrl( '/wp-admin/' );
// Go to Inbox
$I->amOnWorkflowPage( 'Inbox' );
$I->click( '0015 User Input' );
$I->selectOption( 'input[name=gravityflow_status]', 'complete' );
$I->click( 'Update' );
// Approve
$I->waitForElement( 'div.validation_message', 3 );
// Check field conditional logic on the user input step
$I->see( 'This field is required' );
$I->selectOption( 'input[name=input_13]', 'Second Choice' );
$I->scrollTo( '#gravityflow-note' );
$I->selectOption( 'input[name=gravityflow_status]', 'complete' );
$I->click( 'Update' );
$I->waitForElement( 'div.notice-success', 3 );
$I->waitForText( 'Entry updated and marked complete', 3 );

View File

@@ -0,0 +1,35 @@
<?php
/*
* Purpose: Test the vacation request form
*/
$I = new AcceptanceTester( $scenario );
$I->wantTo( 'Test the vacation request form' );
// Submit the form
$I->amOnPage( '/0016-vacation-request' );
$I->see( '0016 Vacation Request' );
$I->scrollTo( [ 'css' => '.gform_title' ] );
$I->fillField('First', 'Some');
$I->fillField('Last', 'Text');
$I->selectOption( 'Dep', 'Third Choice' );
$I->fillField( 'Third choice text', 'Third choice text' );
$I->fillField( 'Date from', '08/17/2016' );
$I->fillField( 'Date to', '08/18/2016' );
$I->fillField( 'Comments', 'Comments text' );
$I->scrollTo( [ 'css' => 'input[type=submit]' ] );
$I->click( 'input[type=submit]' );
// Login to wp-admin
$I->loginAsAdmin();
$I->seeInCurrentUrl( '/wp-admin/' );
// Go to Inbox
$I->amOnWorkflowPage( 'Inbox' );
$I->click( '0016 Vacation Request' );
// Approve
$I->waitForElement( 'button[value=approved]', 3 );
$I->click( 'button[value=approved]' );
$I->see( 'Entry Approved' );

View File

@@ -0,0 +1,47 @@
<?php
/*
* Purpose: Test workflow required fields
*/
$I = new AcceptanceTester( $scenario );
$I->wantTo( 'Test workflow required fields' );
// Submit the form
$I->amOnPage( '/0017-workflow-required-fields' );
$I->see( '0017 Workflow Required Fields' );
$I->scrollTo( [ 'css' => '.gform_title' ], 20, 50 ); // needed for chromedriver
$I->fillField( 'input[name="input_2"]', 'Text' );
$I->fillField( 'textarea[name="input_1"]', 'Pharagraph text' );
$I->scrollTo( [ 'css' => 'input[type=submit]' ], 20, 50 ); // needed for chromedriver
$I->click( 'Submit' );
$I->see( 'Thanks for contacting us! We will get in touch with you shortly.' );
// Login as Admin
$I->loginAsAdmin();
$I->seeInCurrentUrl( '/wp-admin/' );
// Go to Inbox
$I->amOnWorkflowPage( 'Inbox' );
$I->click( '0017 Workflow Required Fields' );
$I->see( 'Instructions: please review the values in the fields below and click on the Approve or Reject button' );
$I->seeElement( 'button[value=approved]' );
$I->click( 'button[value=approved]' );
$I->waitForText( 'A note is required', 3 );
$I->fillField( 'textarea[name="gravityflow_note"]', 'First note added' );
$I->click( 'button[value=approved]' );
$I->waitForText( 'Editable instructions.', 3 );
$I->seeElement( 'input[name=gravityflow_status]' );
$I->click( 'Update' );
$I->waitForText( 'A note is required', 3 );
$I->fillField( 'textarea[name="gravityflow_note"]', 'Second note added' );
$I->click( 'Update' );
$I->selectOption( 'input[name="gravityflow_status"]', 'Complete' );
$I->click( 'Update' );
$I->waitForText( 'Entry updated and marked complete.', 3 );

View File

@@ -0,0 +1,41 @@
<?php
/*
* Purpose: Test the vacation request form with rejected note
*/
$I = new AcceptanceTester( $scenario );
$I->wantTo( 'Test the vacation request form with rejected note' );
// Submit the form
$I->amOnPage( '/0018-vacation-request-reject-note' );
$I->see( '0018 Vacation Request Reject Note' );
$I->scrollTo( [ 'css' => '.gform_title' ] );
$I->fillField('First', 'Some');
$I->fillField('Last', 'Text');
$I->selectOption( 'Dep', 'Third Choice' );
$I->fillField( 'Third choice text', 'Third choice text' );
$I->fillField( 'Date from', '08/17/2016' );
$I->fillField( 'Date to', '08/18/2016' );
$I->fillField( 'Comments', 'Comments text' );
$I->scrollTo( [ 'css' => 'input[type=submit]' ] );
$I->click( 'input[type=submit]' );
// Login to wp-admin
$I->loginAsAdmin();
$I->seeInCurrentUrl( '/wp-admin/' );
// Go to Inbox
$I->amOnWorkflowPage( 'Inbox' );
$I->click( 'Vacation Request' );
// Reject without note
$I->waitForElement( 'button[value=rejected]', 3 );
$I->click( 'button[value=rejected]' );
// Reject with note
$I->waitForElement( 'button[value=rejected]', 3 );
$I->see( 'A note is required' );
$I->fillField( ['name' => 'gravityflow_note'], 'Dates are expired.' );
$I->click( 'button[value=rejected]' );
$I->see( 'Entry Rejected' );

View File

@@ -0,0 +1,37 @@
<?php
/*
* Purpose: Test if editable fields highlighted on the user input step
*/
$I = new AcceptanceTester( $scenario );
$I->wantTo( 'Test if editable fields highlighted on the user input step' );
// Submit the form
$I->amOnPage( '/0019-user-input-highlight-editable-fields' );
$I->see( '0019 User Input Highlight Editable Fields' );
$I->scrollTo( [ 'css' => '.gform_title' ] );
$I->fillField( 'Paragraph', 'Some text' );
$I->selectOption( 'Dropdown', 'Third Choice' );
$I->fillField( 'Email', 'test@gmail.com' );
$I->scrollTo( [ 'css' => 'input[type=submit]' ] );
$I->click( 'Submit' );
$I->waitForText( 'Thanks for contacting us!', 3 );
// Login to wp-admin
$I->loginAsAdmin();
$I->seeInCurrentUrl( '/wp-admin/' );
// Go to Inbox
$I->amOnWorkflowPage( 'Inbox' );
$I->click( '0019 User Input Highlight Editable Fields' );
// Find 3 highlighted fields
$I->see( 'Paragraph', ['css' => '.green-background label'] );
$I->see( 'Dropdown', ['css' => '.green-background label'] );
$I->see( 'Admin only radio required', ['css' => '.green-background label'] );
// Can't find other fields highlighted
$I->cantsee( 'Email', ['css' => '.green-background label'] );
$I->cantsee( 'Calc', ['css' => '.green-background label'] );
$I->cantsee( 'Checkboxes', ['css' => '.green-background label'] );

View File

@@ -0,0 +1,35 @@
<?php
//$scenario->skip();
/*
* Test summary: perform step if previous step status is rejected
*
* Test details:
* - Fill in the form fields.
* - Login to back-end, go to Inbox
* - Click on the 'Step Status Conditional Logic' Workflow
* - Click on the 'Reject' button
* - Go to 'Approval if Previous Approval Step Rejected' step
* - Click on the 'Approve' button
*/
$I = new AcceptanceTester( $scenario );
$I->loginAsAdmin();
$I->amOnPage( '/step-status-conditional-logic' );
$I->fillField( 'Single Line', 'test' );
$I->fillField( 'Paragraph', 'test' );
$I->selectOption( 'User', '1' );
$I->click( 'Submit' );
$I->amOnWorkflowPage( 'Inbox' );
$I->click( 'Step Status Conditional Logic' );
$I->waitforText( 'Approval Step' );
$I->see( 'Approval Step', '.gravityflow-status-box' );
$I->click( 'Reject' );
$I->waitforText( 'Approval if Previous Approval Step Rejected' );
$I->see( 'Approval if Previous Approval Step Rejected', '.gravityflow-status-box' );
$I->dontSee( 'Approval if Previous Approval Step Approved', '.gravityflow-status-box' );

View File

@@ -0,0 +1,42 @@
<?php
/*
* Purpose: Test the section field conditional logic on the user input step
*/
$I = new AcceptanceTester( $scenario );
$I->wantTo( 'Test the section field conditional logic on the user input step' );
// Submit the form
$I->amOnPage( '/0021-hs4878-user-input-section-logic' );
$I->see( '0021 HS4878 User Input Section Logic' );
$I->scrollTo( [ 'css' => '.gform_title' ], 20, 50 ); // needed for chromedriver
$I->checkOption( 'input[name=input_1\\.2]' );
$I->click( 'input[type=submit]' );
$I->waitForText( 'Thanks for contacting us! We will get in touch with you shortly.', 3 );
// Login to wp-admin
$I->loginAsAdmin();
$I->seeInCurrentUrl( '/wp-admin/' );
// Go to Inbox
$I->amOnWorkflowPage( 'Inbox' );
$I->click( 'HS4878 User Input Section Logic' );
$I->waitForText( 'Second Choice', 3 );
$I->dontSee( 'Hidden Section' );
$I->dontSeeElement( 'input[name=input_3]' );
$I->see( 'Visible Section' );
$I->seeElement( 'input[name=input_5]' );
$I->fillField( 'Text Two', 'Value Two' );
$I->click( 'Submit' );
$I->waitForText( 'Entry updated and marked complete.', 3 );
$I->dontSee( 'Hidden Section' );
$I->dontSee( 'Value One' );
$I->see( 'Visible Section' );
$I->see( 'Value Two' );

View File

@@ -0,0 +1,51 @@
<?php
/*
* Purpose: Test if "send to step" admin action can work after workflow completed
*/
$I = new AcceptanceTester( $scenario );
$I->wantTo( 'Test if "send to step" admin action can work after workflow completed' );
$I->amOnPage( '/0022-send-to-step' );
$I->amGoingTo( 'Submit the form.' );
$I->see( '0022 Send To Step' );
$I->scrollTo( [ 'css' => '.gform_title' ] );
$I->fillField( 'Text Field', 'Some text' );
$I->fillField( 'Email Field', 'test@gmail.com' );
$I->scrollTo( [ 'css' => 'input[type=submit]' ] );
$I->click( 'Submit' );
$I->waitForText( 'Thanks for contacting us!', 3 );
$I->amGoingTo( 'Log into WP Dashboard.' );
$I->loginAsAdmin();
$I->seeInCurrentUrl( '/wp-admin/' );
$I->amGoingTo( 'View Workflow Inbox.' );
$I->amOnWorkflowPage( 'Inbox' );
$I->amGoingTo( 'Approve the entry to complete the Approval Step.' );
$I->click( '0022 Send To Step' );
$I->seeElement( 'button[value=approved]' );
$I->click( 'button[value=approved]' );
$I->waitForText( 'Entry Approved', 3 );
$I->amGoingTo( 'Submit the form to complete the User Input Step and also complete the workflow.' );
$I->see( 'User Input (Pending Input)' );
$I->click( 'input[value=Submit]' );
$I->waitForText( 'Entry updated and marked complete.', 3 );
$I->amGoingTo( 'View Workflow Status.' );
$I->amOnWorkflowPage( 'Status' );
$I->amGoingTo( 'Make sure the entry has been approved.' );
$I->click( '0022 Send To Step' );
$I->waitForText( 'Status: Approved', 3 );
$I->amGoingTo( 'Select and admin action that send this entry to Notification Step.' );
$I->selectOption( '//*[@id="gravityflow-admin-action"]', 'Notification Step' );
$I->click( 'input[name=_gravityflow_admin_action]' );
$I->waitForText( 'Sent to step: Notification Step', 3 );
$I->scrollTo( ['css' => '.gravityflow-note-notification'], 20, 50 );
$I->seeNumberOfElements( ['css' => '.gravityflow-note-notification'], 2 );

View File

@@ -0,0 +1,65 @@
<?php
/*
* Purpose: Test the save progress types
*/
$I = new AcceptanceTester( $scenario );
$I->wantTo( 'Test the save progress types for user input step' );
// Submit the form
$I->amOnPage( '/0023-user-input-save-progress' );
$I->see( '0023 - User Input Save Progress' );
$I->scrollTo( [ 'css' => '.gform_title' ] ); // needed for chromedriver
$I->selectOption( 'input[name=input_1]', 'Blue' );
$I->fillField( 'textarea[name="input_2"]', 'Ozone tints the light of the sun' );
$I->scrollTo( [ 'css' => 'input[type=submit]' ] ); // needed for chromedriver
$I->click( 'Submit' );
$I->waitForText( 'Thanks for contacting us! We will get in touch with you shortly.', 3 );
// Login to wp-admin
$I->loginAsAdmin();
// Go to Inbox
$I->amOnWorkflowPage( 'Inbox' );
// Test - Submit Buttons
$I->click( '0023 - User Input Save Progress' );
$I->waitForText( 'Save Progress - Submit Buttons (Pending Input)' );
$I->see( 'Save Progress - Submit Buttons (Pending Input)' );
$I->click( '#gravityflow_save_progress_button' );
$I->waitForText( 'Entry updated - in progress.' );
$I->see( 'Entry updated - in progress.' );
$I->click( '#gravityflow_submit_button' );
$I->waitForText( 'Entry updated and marked complete.' );
$I->see( 'Entry updated and marked complete.' );
// Test - Radio Buttons - In Progress
$I->waitForText( 'Save Progress - Radio Buttons - In Progress Default (Pending Input)' );
$I->see( 'Save Progress - Radio Buttons - In Progress Default (Pending Input)' );
$I->seeOptionIsSelected( 'input[name=gravityflow_status]', 'in_progress' );
$I->click( '#gravityflow_update_button' );
$I->waitForText( 'Entry updated - in progress.' );
$I->see( 'Entry updated - in progress.' );
$I->click( 'input#gravityflow_complete' );
$I->click( '#gravityflow_update_button' );
$I->waitForText( 'Entry updated and marked complete.' );
$I->see( 'Entry updated and marked complete.' );
// Test - Radio Buttons - Complete
$I->waitForText( 'Save Progress - Radio Buttons - Complete Default (Pending Input)' );
$I->see( 'Save Progress - Radio Buttons - Complete Default (Pending Input)' );
$I->seeOptionIsSelected( 'input[name=gravityflow_status]', 'complete' );
$I->click( '#gravityflow_update_button' );
$I->waitForText( 'Entry updated and marked complete.' );
$I->see( 'Entry updated and marked complete.' );
// Test - Disabled
$I->waitForText( 'Save Progress - Disabled (Pending Input)' );
$I->see( 'Save Progress - Disabled (Pending Input)' );
$I->dontSeeElement( 'input[name=gravityflow_status]' );
$I->click( '#gravityflow_update_button' );
$I->waitForText( 'Entry updated and marked complete.' );
$I->see( 'Entry updated and marked complete.' );

View File

@@ -0,0 +1,46 @@
<?php
/*
* Purpose: Test that calculated product fields hidden by conditional logic do not reappear in the order summary after the user input step saves the entry.
*/
$I = new AcceptanceTester( $scenario );
$I->wantTo( 'Test that calculated product fields hidden by conditional logic do not reappear in the order summary after the user input step saves the entry.' );
// Submit the form
$I->amOnPage( '/0024-hs5197-calculated-product-logic' );
$I->see( '0024 HS5197 Calculated Product Logic' );
$I->scrollTo( [ 'css' => '.gform_title' ], 20, 50 ); // needed for chromedriver
$I->click( 'input[type=submit]' );
$I->waitForText( 'Thanks for contacting us! We will get in touch with you shortly.', 3 );
// Login to wp-admin
$I->loginAsAdmin();
$I->seeInCurrentUrl( '/wp-admin/' );
// Go to Inbox
$I->amOnWorkflowPage( 'Inbox' );
$I->click( '0024 HS5197 Calculated Product Logic' );
$I->waitForText( 'Checkbox', 3 );
$I->dontSee( 'First Number' );
$I->see( 'Order' );
$I->dontSee( 'First Product' );
$I->see( 'Second Product' );
$I->see( '$50.00' );
$I->click( 'Submit' );
$I->waitForText( 'Entry updated and marked complete.', 3 );
$I->see( 'Checkbox' );
$I->see( 'Second Choice' );
$I->dontSee( 'First Number' );
$I->see( 'Order' );
$I->dontSee( 'First Product' );
$I->dontSee( '$0.00' );
$I->see( 'Second Product' );
$I->see( '$50.00' );

View File

@@ -0,0 +1,60 @@
<?php
/*
* Purpose: Test that the display fields setting displays the correct fields on the workflow detail page.
*/
$I = new AcceptanceTester( $scenario );
$I->wantTo( 'Test that the display fields setting displays the correct fields on the workflow detail page.' );
// Submit the form
$I->amOnPage( '/0025-display-fields' );
$I->see( '0025 Display Fields' );
$I->scrollTo( [ 'css' => '.gform_title' ], 20, 50 ); // needed for chromedriver
$I->click( 'input[type=submit]' );
$I->waitForText( 'Thanks for contacting us! We will get in touch with you shortly.', 3 );
// Login to wp-admin
$I->loginAsAdmin();
$I->seeInCurrentUrl( '/wp-admin/' );
// Go to Inbox
$I->amOnWorkflowPage( 'Inbox' );
$I->click( '0025 Display Fields' );
// Approval Step - Display: All Fields.
$I->waitForText( '0025 Display Fields : Entry #', 3 );
$I->see( 'Value 1' );
$I->see( 'Section 1' );
$I->see( 'Value 2' );
$I->see( 'Section 2' );
$I->see( 'Value 3' );
$I->click( 'Approve' );
// User Input Step - Display: All Fields Except
$I->waitForText( 'Entry Approved', 3 );
$I->see( 'Value 1' );
$I->see( 'Section 1' );
$I->seeElement( 'input[name=input_3]' );
$I->fillField( 'Two', 'Value 2 - Updated' );
$I->dontSee( 'Section 2' );
$I->dontSee( 'Value 3' );
$I->click( 'Submit' );
// Approval Step - Display: Selected Fields.
$I->waitForText( 'Entry updated and marked complete.', 3 );
$I->dontSee( 'Value 1' );
$I->dontSee( 'Section 1' );
$I->dontSee( 'Value 2 - Updated' );
$I->see( 'Section 2' );
$I->see( 'Value 3' );
$I->click( 'Approve' );
// Workflow Completed - Display: All Fields.
$I->waitForText( 'Entry Approved', 3 );
$I->see( 'Value 1' );
$I->see( 'Section 1' );
$I->see( 'Value 2 - Updated' );
$I->see( 'Section 2' );
$I->see( 'Value 3' );

View File

@@ -0,0 +1,43 @@
<?php
/*
* Purpose: Test that the display fields setting displays the correct fields on the workflow detail page.
*/
$I = new AcceptanceTester( $scenario );
$I->wantTo( 'Test that the Role Assignee Token works.' );
// Make sure we're logged out
$I->logOut();
$I->resetCookie( 'gflow_access_token' );
// Submit the form
$I->amOnPage( '/0026-role-assignee-token' );
$I->see( '0026 Role Assignee Token' );
$I->scrollTo( [ 'css' => '.gform_title' ], 20, 50 ); // needed for chromedriver
$I->fillField( 'Single Line Text', 'Test' );
$I->fillField( 'Paragraph', 'Test' );
$I->click( 'input[type=submit]' );
$I->waitForText( 'Thanks for contacting us! We will get in touch with you shortly.', 3 );
$I->amOnPage( sanitize_title_with_dashes( '0026 Email - Role Assignee - Token - Approval' ) );
$I->see( 'Open Workflow Entry Detail' );
$I->click( 'Open Workflow Entry Detail' );
$I->waitForText( 'Approve', 3 );
$I->click( 'Approve' );
$I->waitForText( 'User Input (Pending Input)', 3 );
$I->resetCookie( 'gflow_access_token' );
$I->amOnPage( sanitize_title_with_dashes( '0026 Email - Role Assignee - Token - Approval' ) );
$I->see( 'Open Workflow Entry Detail' );
$I->click( 'Open Workflow Entry Detail' );
$I->fillField( 'Single Line Text', 'Test2' );
$I->fillField( 'Paragraph', 'Test2' );
$I->click( 'Submit' );
$I->waitForText( 'Status: Approved', 3 );
$I->see( 'Status: Approved' );

View File

@@ -0,0 +1,112 @@
<?php
global $wp_rewrite, $wpdb;
$wp_rewrite->set_permalink_structure( '/%postname%/' );
$wp_rewrite->flush_rules();
GFFormsModel::drop_tables();
// Flush out the feeds
$wpdb->query( "TRUNCATE TABLE {$wpdb->prefix}gf_addon_feed" );
GFForms::setup( true );
update_option( 'gform_pending_installation', false );
update_option( 'gravityflow_pending_installation', false );
function setup_gravity_forms_pages() {
require_once( GFCommon::get_base_path() . '/export.php' );
$form_filenames = glob( dirname( __FILE__ ) . '/../_data/forms/*.json' );
foreach ( $form_filenames as $filename ) {
GFExport::import_file( $filename );
}
$active_forms = GFAPI::get_forms( true );
echo "\nActive Form count: " . count( $active_forms );
$inactive_forms = GFAPI::get_forms( false );
echo "\nInactive Form count: " . count( $inactive_forms );
$forms = array_merge( $active_forms, $inactive_forms );
echo "\nForm count: " . count( $forms );
foreach ( $forms as $form ) {
GFFormsModel::update_form_active( $form['id'], true );
$page = array(
'post_type' => 'page',
'post_content' => '[gravityform id=' . $form['id'] . ']',
'post_name' => sanitize_title_with_dashes( $form['title'] ),
'post_parent' => 0,
'post_author' => 1,
'post_status' => 'publish',
'post_title' => $form['title'],
);
wp_insert_post( $page );
}
}
setup_gravity_forms_pages();
// add admins
function tests_create_testing_users() {
$users = array( 'admin1', 'admin2', 'admin3', 'admin4', 'admin5' );
foreach ( $users as $user ) {
$userData = array(
'user_login' => $user,
'first_name' => $user,
'last_name' => $user,
'user_pass' => $user,
'user_email' => $user . '@mail.com',
'user_url' => '',
'role' => 'administrator',
);
wp_insert_user( $userData );
}
}
tests_create_testing_users();
function copy_to_dir( $pattern, $dir ) {
foreach ( glob( $pattern ) as $file ) {
if ( ! is_dir( $file ) && is_readable( $file ) ) {
$dest = realpath( $dir ) . DIRECTORY_SEPARATOR . basename( $file );
copy( $file, $dest );
}
}
}
if ( ! is_dir( WPMU_PLUGIN_DIR ) ) {
mkdir( WPMU_PLUGIN_DIR );
};
echo 'Copying mu plugins to ' . WP_CONTENT_DIR . '/mu-plugins';
copy_to_dir( dirname( dirname( __FILE__ ) ) . '/_mu-plugins/*.php', WPMU_PLUGIN_DIR );
$settings = gravity_flow()->get_app_settings();
$settings['inbox_page'] = create_workflow_page( 'inbox' );
$settings['status_page'] = create_workflow_page( 'status' );
$settings['submit_page'] = create_workflow_page( 'submit' );
gravity_flow()->update_app_settings( $settings );
/**
* Creates a new page containing the gravityflow shortcode for the specified page type.
*
* @param string $page The page type: inbox, status, or submit.
*
* @return int|string|WP_Error
*/
function create_workflow_page( $page ) {
$post = array(
'post_title' => $page,
'post_content' => sprintf( '[gravityflow page="%s"]', $page ),
'post_excerpt' => $page,
'post_status' => 'publish',
'post_type' => 'page',
);
$post_id = wp_insert_post( $post );
return $post_id ? $post_id : '';
}