Skip to content

Instantly share code, notes, and snippets.

View Apiko-tutorials's full-sized avatar

Code Tutorials [by Apiko] Apiko-tutorials

View GitHub Profile
@Apiko-tutorials
Apiko-tutorials / create fixture event. JS
Last active February 14, 2018 09:42
End-to-end testing for online marketplace platform
Meteor.methods({
'fixtures.createEvent'(eventData) {
check(eventData, Match.Maybe(Object));
// creation of fixture event data
return createEvent(eventData || {});
},
});
describe('Booking and payment via credit card', () => {
let event;
let userEmail;
before(() =>
common.goToRoot()
const guestUser = server.call('fixtures.createUser', {
settings: {
bookingType: true,
},
@Apiko-tutorials
Apiko-tutorials / book button testing
Created February 14, 2018 09:58
end-to-end testing
before(() => {
/*...*/
});
describe('Event details page', () => {
it('"Book this meal" button should exist', () => {
browser.waitForExist('.book-button');
});
it('should redirect to "Booking" page after click on "Book this meal" button', () => {
common.click('.book-button');
click(clickElementSelector) {
browser.scroll(clickElementSelector);
browser.click(clickElementSelector);
}
describe('Event booking page', () => {
const getPriceFromBooking = () => parseFloat(browser.getText('.price').slice(1));
it('Booking total price should be changed after changing guests number', () => {
const guestsNumber = 2;
const initPrice = getPriceFromBooking();
const selectField = browser.element('.guests-number-select-field');
selectField.click();
browser.waitForExist('.guests-count-select-field.active');
assert.equal(getPriceFromBooking(), initPrice * guestsnumber);
describe('Event booking page', () => {
/*...*/
it('should be error when do not agree with terms', () => {
common.click('.book-button');
browser.waitForExist('.terms-error');
assert.equal(browser.getText('.terms-error'), 'Please agree with our terms to continue');
common.click(selector['Booking terms checkbox']);
});
});
describe('Event booking page', () => {
/*...*/
it('"Book" button should be exist', () => {
browser.waitForExist('.book-button');
});
it('Redirect to "Event detail" page after click on "Book" button', () => {
common.click('terms-checkbox');
common.click('#book-button');
browser.waitForExist('.dynamic--payment');
describe('Payment methods page', () => {
it('"Credit Card" payment method should be active', () => {
browser.waitForExist('li.creditcard');
});
it('Redirect to "Credit card payment" page after click on "Pay with Credit Card" button', () => {
common.click('li.creditcard');
browser.waitForExist('.payment-confirm');
const currentUrl = browser.getUrl();
assert.match(currentUrl, /payment/);
assert.match(currentUrl, /creditcard/);
describe('Confirm payment page', () => {
const testUserAddress = {
givenName: 'John',
familyName: 'Smith',
countryName: 'NL',
city: 'Amsterdam',
street1: 'John M. Keynesplein',
street2: '12-45',
state: 'Noord-Holland',
zip: '1066 EP',
describe('Payment service page', () => {
it('should be redirected to "Payment status" page after submit Payment service form', () => {
common.click('input[value="paid"]');
common.click('.confirm-payment');
browser.waitForExist('.payment_status .card--confirm');
assert.match(browser.getUrl(), /success/);
});
});