Skip to content

Commit

Permalink
replaced dev auth passwords
Browse files Browse the repository at this point in the history
  • Loading branch information
murraydailymaverick committed Apr 16, 2024
1 parent bdac0f7 commit 41917d1
Show file tree
Hide file tree
Showing 2 changed files with 202 additions and 4 deletions.
8 changes: 4 additions & 4 deletions cypress.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,8 @@ module.exports = defineConfig({
},
env: {
credentials: {
username: "devautotest",
password: "ZMk4pz2T2dmSgPF"
username: "dmdev",
password: "D@ily168!"
},
wp_credentials: {
username: "ck_55e71f9d79f05f7142482820b183afbe8cc82804",
Expand All @@ -26,8 +26,8 @@ module.exports = defineConfig({
chromeWebSecurity: false,
env: 'dev',
authtoken: 'beee7136f05573bdd84bd161dbd01fd9a9a792f0aa920e13f2a59d815089ba3e',
notifyUrl: 'https://devautotest:ZMk4pz2T2dmSgPF@dev.dailymaverick.co.za',
authUrl: 'https://devautotest:ZMk4pz2T2dmSgPF@dev.dailymaverick.co.za',
notifyUrl: 'https://dmdev:D@ily168!@dev.dailymaverick.co.za',
authUrl: 'https://dmdev:D@ily168!@dev.dailymaverick.co.za',
baseUrl: 'https://dev.dailymaverick.co.za',
insiderBlockUrl: 'https://dev.dailymaverick.co.za/insider/',
loginUrl: 'https://dev.dailymaverick.co.za/sign-in/',
Expand Down
198 changes: 198 additions & 0 deletions cypress/e2e/automated/revio.cy.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,198 @@
describe('test revio payments', () => {
var users = Cypress.env('users');
var subscriber = users.subscriber;
var insider = users.insider;

before(function () {
// cy.clearWordPressCookies();
// cy.deleteUser(subscriber);
});

after(function (){
cy.deleteUser(subscriber);
})

it( 'registers via the navigation via otp.', function(){
cy.viewport(1440, 1024);
cy.intercept('POST', Cypress.env('dashboardUrl') + '/admin-ajax.php').as('ajaxPost');
cy.visit( Cypress.env('baseUrl') +'?utm_source=testing&utm_medium=testing&utm_campaign=testing&utm_term=testing&utm_content=testing');
cy.get('a.login-button').click();
cy.get('.send-magic-email').type(subscriber.email);
cy.get('.mail-login-engine-shortcode-sumbit').click();
cy.get('.email-label').should('contain.text', 'Perhaps you entered your email incorrectly?' );
cy.get('.your-email').should('contain.text', subscriber.email );
cy.get('.register-btn').click();
cy.get('.email-sent-to').should('contain.text', subscriber.email );
cy.get('#otp').should('be.visible' );
cy.setCode(subscriber);
cy.wait(1000);
cy.get('#otp input[data-index=0]').type('9');
cy.get('#otp input[data-index=1]').type('7');
cy.get('#otp input[data-index=2]').type('1');
cy.get('#otp input[data-index=3]').type('3');

cy.wait(1000);
cy.visit( Cypress.env('baseUrl') +'?utm_source=testing&utm_medium=testing&utm_campaign=testing&utm_term=testing&utm_content=testing');
//cy.get('.your-account').should('be.visible' ).should('contain.text', 'Your Account' );
cy.getWordPressCookies('subscriber');
});

it( 'set session, signs up via the insider blocks and checks out via DebiCheck', function(){
cy.setWordPressCookies('subscriber');
cy.viewport(1440, 1024);
cy.visit( Cypress.env('insiderBlockUrl') +'?utm_source=testing&utm_medium=testing&utm_campaign=testing&utm_term=testing&utm_content=testing');
cy.get('.test-me form.benefits-form button').should('contain.text', '200').click(); //clicks the R200 value
cy.location('pathname').should( 'contain', 'checkout' );
cy.populateDebitForm(subscriber);
cy.debiCheckModalWait();
cy.getWordPressCookies('subscriber');
});


it( 'logs in as the /insider to check the manage-membership page.', function(){
cy.intercept('POST', Cypress.env('dashboardUrl') + '/admin-ajax.php').as('ajaxPost');
cy.setWordPressCookies('subscriber');
cy.visit(Cypress.env('baseUrl')+'/manage-membership/');
cy.location('pathname').should( 'contain', '/manage-membership/' );

cy.get('#whyQuestionsModal').should("be.visible");
cy.get('ul.wc-radios li label').should('have.length', 8);
cy.get('ul.wc-radios li label').first().click();
cy.get('#submitWhyQuestions').click();
cy.wait('@ajaxPost');
cy.visit(Cypress.env('baseUrl')+'/manage-membership/');
});

//check order here:
it( 'checks the payfast order info.', function(){
cy.checkSubscriptionAndOrder(subscriber, {amount:'200.00', payment_method: 'payfast', status: 'completed'});
});

it( 'set session, check insiderBlockUrl redirect, check active message, switch to 150 and checks out via DebiCheck', function(){
cy.setWordPressCookies('subscriber');
cy.viewport(1440, 1024);
cy.visit( Cypress.env('insiderBlockUrl') +'?utm_source=testing&utm_medium=testing&utm_campaign=testing&utm_term=testing&utm_content=testing');
cy.location('pathname').should( 'contain', 'manage-membership' );
cy.get('#manage-membership-holder .col-xs-12 h3').should('contain.text', 'Please see your membership details below:');
cy.get('#manage-membership-holder .col-xs-12 .woocommerce-info').should('contain.text', 'You currently have an active membership of R 200 / Monthly with Payfast as your payment method. To change your membership details, please choose your preferences below and complete the checkout process.');

cy.get('.switchSubscription').click();
cy.get('#switchSubscription .modal-dialog').should('be.visible');
cy.get('button[data-switch-amount=150]').click();

cy.location('pathname').should( 'contain', 'checkout' );
cy.get('#revio_paymenttype_debicheck').click();
cy.populateDebitForm(subscriber);
cy.debiCheckModalWait();
cy.getWordPressCookies('subscriber');
});

//check order here:
it( 'checks the DebiCheck order info.', function(){
cy.checkSubscriptionAndOrder(subscriber, { amount:'200.00', payment_method: 'dmrevio', status: 'completed' });
});

//start revio
/*
it( 'deletes the subscriber', function(){
cy.deleteUser(subscriber);
});
*/

it( 'logged out, registers a new user, checks out via revio DebiCheck', function(){
cy.clearWordPressCookies();
cy.viewport(1440, 1024);
cy.intercept('POST', Cypress.env('dashboardUrl') + '/admin-ajax.php').as('ajaxPost');
cy.visit( Cypress.env('insiderBlockUrl') +'?utm_source=testing&utm_medium=testing&utm_campaign=testing&utm_term=testing&utm_content=testing');
cy.get('.test-me form.benefits-form button').should('contain.text', '200').click(); //clicks the R200 value
cy.location('pathname').should( 'contain', 'checkout' );
cy.loggedOutRegistersUsesOTPToLogin(subscriber);
cy.populateDebitForm(subscriber);
cy.debiCheckModalWait();
cy.getWordPressCookies('subscriber');
});

it( 'checks the DebiCheck order info.', function(){
cy.checkSubscriptionAndOrder(subscriber, { amount:'200.00', payment_method: 'dmrevio', status: 'completed' });
});

it( 'logged out and uses OTP to login, checks out via DebiCheck', function(){
cy.viewport(1440, 1024);
cy.intercept('POST', Cypress.env('dashboardUrl') + '/admin-ajax.php').as('ajaxPost');
cy.visit( Cypress.env('insiderBlockUrl') +'?utm_source=testing&utm_medium=testing&utm_campaign=testing&utm_term=testing&utm_content=testing');
cy.get('.different-amount form.benefits-form button').should('contain.text', '150').click(); //clicks th R200 value
cy.location('pathname').should( 'contain', 'checkout' );
cy.loggedOutUsesOTPToLogin( subscriber );
cy.getWordPressCookies('subscriber');
//page should refresh and login via token.
cy.location('pathname').should( 'contain', 'checkout' );
cy.populateDebitForm(subscriber);
cy.debiCheckModalWait();
cy.checkWhySignUpModal();
});

it( 'OTP login, existing subscription, chooses different amount, checks out via revio CreditCard', function(){
cy.viewport(1440, 1024);
cy.intercept('POST', Cypress.env('dashboardUrl') + '/admin-ajax.php').as('ajaxPost');
cy.visit( Cypress.env('baseUrl') +'?utm_source=testing&utm_medium=testing&utm_campaign=testing&utm_term=testing&utm_content=testing');
cy.get('a.login-button').click();
cy.loggedOutUsesOTPToLogin(subscriber);
cy.visit( Cypress.env('insiderBlockUrl') +'?utm_source=testing&utm_medium=testing&utm_campaign=testing&utm_term=testing&utm_content=testing');
cy.location('pathname').should( 'contain', 'manage-membership' );
cy.get('#manage-membership-holder .col-xs-12 h3').should('contain.text', 'Please see your membership details below:');
// cy.get('#manage-membership-holder .col-xs-12 .woocommerce-info').should('contain.text', 'You currently have an active membership of R 200 / Monthly with Payfast as your payment method. To change your membership details, please choose your preferences below and complete the checkout process.');

cy.get('.switchSubscription').click();
cy.get('#switchSubscription .modal-dialog').should('be.visible');
cy.get('button[data-switch-amount=150]').click();
cy.chooseCreditCardForm( subscriber );
cy.get('button[name="woocommerce_checkout_place_order"]').click();
cy.fillCreditCardForm(subscriber);
});

it( 'checks the revio credit card order order info.', function(){
cy.checkSubscriptionAndOrder(subscriber, { amount:'150.00', payment_method: 'dmrevio', status: 'failed' });
});

it( 'existing session, existing subscription, chooses different amount, checks out via revio CreditCard', function(){
cy.viewport(1440, 1024);
cy.setWordPressCookies('subscriber');
cy.intercept('POST', Cypress.env('dashboardUrl') + '/admin-ajax.php').as('ajaxPost');
cy.visit( Cypress.env('insiderBlockUrl') +'?utm_source=testing&utm_medium=testing&utm_campaign=testing&utm_term=testing&utm_content=testing');
cy.get('.different-amount form.benefits-form button').should('contain.text', '150').click(); //clicks th R200 value
cy.location('pathname').should( 'contain', 'checkout' );
cy.chooseCreditCardForm( subscriber );
cy.get('button[name="woocommerce_checkout_place_order"]').click();
cy.fillCreditCardForm(subscriber);
});

it( 'checks the revio credit card order order info.', function(){
cy.checkSubscriptionAndOrder(subscriber, { amount:'150.00', payment_method: 'dmrevio', status: 'failed' });
});

it( 'registers a new subscriber via the gutenburg block, pays via revio cc.', function(){
cy.intercept('POST', Cypress.env('dashboardUrl') + '/admin-ajax.php').as('ajaxPost');
cy.intercept('POST', '/?wc-ajax=checkout&elementor_page_id=').as('ajaxelementor_page_id');
//todo test the utm tags
cy.visit( Cypress.env('baseUrl') +'/support-daily-maverick/?utm_source=testing&utm_medium=testing&utm_campaign=testing&utm_term=testing&utm_content=testing');
cy.get('.components-button-group .components-button:first-child').click();
cy.get('.hero-submit-button.selected').click();
cy.location('pathname').should( 'contain', Cypress.env('localfolder')+'/checkout/' );
cy.loggedOutRegistersUsesOTPToLogin(subscriber);
cy.chooseCreditCardForm( subscriber );
cy.get('button[name="woocommerce_checkout_place_order"]').click();
cy.fillCreditCardForm(subscriber);
cy.getWordPressCookies('subscriber');
});


// it( 'sends an itn to the site', function(){
// cy.updatePayfastOrder('1640405');
// });

})
Cypress.on('uncaught:exception', (err, runnable) => {
let messageArray = [err, runnable];
return false;
})

0 comments on commit 41917d1

Please sign in to comment.