Skip to content

Commit 10a0818

Browse files
committed
Finalise test methods
1 parent f40a15d commit 10a0818

1 file changed

Lines changed: 18 additions & 33 deletions

File tree

cypress/support/phoenix_test_methods.js

Lines changed: 18 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -12,10 +12,10 @@ export var TestMethods = {
1212
RemoteVersionLogUrl: Cypress.env('REMOTE_LOG_URL'),
1313

1414
/** Construct some variables to be used bellow. */
15-
ShopName: 'oscommerce',
15+
ShopName: 'phoenixcart',
1616
PaylikeName: 'paylike',
17-
PaymentMethodsAdminUrl: '/modules.php?set=payment',
18-
SystemInfoAdminUrl: '/server_info.php',
17+
PaymentMethodsAdminUrl: '/modules.php?set=payment&module=paylike&action=edit',
18+
SystemInfoAdminUrl: '/version_check.php',
1919

2020
/**
2121
* Login to admin backend account
@@ -27,7 +27,6 @@ export var TestMethods = {
2727
* Login to client|user frontend account
2828
*/
2929
loginIntoClientAccount() {
30-
cy.get('a[id=tdb3]').click();
3130
cy.loginIntoAccount('input[name=email_address]', 'input[name=password]', 'client');
3231
},
3332

@@ -40,15 +39,10 @@ export var TestMethods = {
4039
/** Go to Paylike payment method. */
4140
cy.phoenixGoToPage(this.PaymentMethodsAdminUrl);
4241

43-
/** Select Paylike. */
44-
cy.get('.dataTableContent').contains(this.PaylikeName, {matchCase: false}).click();
45-
46-
cy.get('#tdb2').click();
47-
4842
/** Select capture mode. */
4943
cy.get(`input[value=${captureMode}]`).click()
5044

51-
cy.get('#tdb2').click();
45+
cy.get('.btn.btn-success.mr-2').click();
5246
},
5347

5448
/**
@@ -77,29 +71,30 @@ export var TestMethods = {
7771

7872
cy.wait(500);
7973

80-
/** Select random product (products are randomize by default). */
81-
cy.get('td a img').first().click();
82-
83-
cy.get('button#tdb5').click();
74+
/** Select first product. */
75+
cy.get('.btn.btn-light.btn-product-listing.btn-buy').first().click();
8476

8577
/** Go to checkout. */
86-
cy.get('.ui-button-icon-primary.ui-icon.ui-icon-triangle-1-e').first().click();
78+
cy.get('#btn2').click();
8779

8880
/** Continue checkout. */
89-
cy.get('button#tdb6').click();
81+
cy.get('.btn.btn-success.btn-lg.btn-block').click();
9082

9183
/** Choose Paylike. */
92-
cy.get(`input[value=${this.PaylikeName}]`).click();
84+
cy.get(`.custom-control label[for=p_${this.PaylikeName}]`).click();
9385

9486
/** Continue checkout. */
95-
cy.get('button#tdb6').click();
87+
cy.get('.btn.btn-success.btn-lg.btn-block').click();
9688

9789
/** Get total amount. */
9890
cy.get(':nth-child(2) > strong').then($grandTotal => {
9991
var expectedAmount = PaylikeTestHelper.filterAndGetAmountInMinor($grandTotal, currency);
10092
cy.wrap(expectedAmount).as('expectedAmount');
10193
});
10294

95+
/** Agree T&C. */
96+
cy.get('#inputMATC').click();
97+
10398
/** Show paylike popup. */
10499
cy.get('#payLikeCheckout').click();
105100

@@ -118,14 +113,15 @@ export var TestMethods = {
118113

119114
cy.wait(500);
120115

121-
cy.get('h1').should('contain', 'Your Order Has Been Processed!');
116+
cy.get('h1').should('contain', 'Your Order is Complete');
122117
},
123118

124119
/**
125120
* Change shop currency in frontend
126121
*/
127122
changeShopCurrency(currency) {
128-
cy.get('select[name=currency]').select(currency);
123+
cy.get('#navDropdownCurrencies').click();
124+
cy.get(`a[href*=${currency}]`).click();
129125
},
130126

131127
/**
@@ -138,23 +134,12 @@ export var TestMethods = {
138134
cy.wait(1000);
139135

140136
/** Get framework version. */
141-
cy.get('h1').contains(this.ShopName, {matchCase: false}).then($frameworkVersion => {
137+
cy.get('.lead > strong').then($frameworkVersion => {
142138
var frameworkVersion = ($frameworkVersion.text()).replace(/\.?[^0-9.]/g, '');
143139
cy.wrap(frameworkVersion).as('frameworkVersion');
144140
});
145141

146-
// Cypress.$.ajax({
147-
// method: 'POST',
148-
// url: this.StoreUrl + '/includes/modules/paylike.php?action=getOrderTotalsData',
149-
// auth: {
150-
// username: Cypress.env('ENV_HTTP_USER'),
151-
// password: Cypress.env('ENV_HTTP_PASS')
152-
// },
153-
// }).then((resp) => {
154-
// cy.wrap(resp).as('paylikeVersion');
155-
// });
156-
157-
/** Get paylike version with request from a file. */
142+
/** Get paylike version from a file. */
158143
cy.request({
159144
url: this.StoreUrl + '/includes/modules/payment/paylike_version.txt',
160145
auth: {

0 commit comments

Comments
 (0)