1. Uncategorized

Coding demo

Praesent risus minim distinctio adipisci cubilia auctor sem felis, qui urna facilisis omnis error, aliquid excepteur, ex, felis. Donec repudiandae tempori.

// type definitions for Cypress object "cy"
// <reference types="cypress" />

import HomePage from '../../support/PageObjects/HomePage';
import CheckoutPage from '../../support/PageObjects/CheckoutPage';
import BillingPage from '../../support/PageObjects/BillingPage'

describe('Automation Test Suite ', function() {

//Mostly used for Setup Part
before(function(){
cy.fixture('example').then(function(data)
{
this.data=data ;
})
})

it('My First Test Case', function() {
//Object Creation for PageObject Page Class and assigning it to a constant variable

const homePage=new HomePage();
const checkoutPage= new CheckoutPage();
const billingPage=new BillingPage();

//Calling
cy.visit(Cypress.env('url'));
homePage.getUserName().type(this.data.Username);
homePage.getEmail().type(this.data.Email);
homePage.getPassword().type(this.data.Password)

homePage.getPassword().type(this.data.NewPassword);
homePage.getRegisterButton().click();

//Checking whether the Registration is successful and whether UserName is populated under login section
homePage.getLoginUserName().should('have.value',this.data.Username);

cy.screenshot('Capturing the screenshot after successful login');
}

use strict'

var extend = require('extend')
var cookies = require('./lib/cookies')
var helpers = require('./lib/helpers')

var paramsHaveRequestBody = helpers.paramsHaveRequestBody

// organize params for patch, post, put, head, del
function initParams (uri, options, callback) {
if (typeof options === 'function') {
callback = options
}

var params = {}
if (options !== null && typeof options === 'object') {
extend(params, options, {uri: uri})
} else if (typeof uri === 'string') {
extend(params, {uri: uri})
} else {
extend(params, uri)
}

params.callback = callback || params.callback
return params
}

function request (uri, options, callback) {
if (typeof uri === ‘undefined’) {
throw new Error(‘undefined is not a valid uri or options object.’)
}

var params = initParams(uri, options, callback)

if (params.method === ‘HEAD’ && paramsHaveRequestBody(params)) {
throw new Error(‘HTTP HEAD requests MUST NOT include a request body.’)
}

return new request.Request(params)
}

function verbFunc (verb) {
var method = verb.toUpperCase()
return function (uri, options, callback) {
var params = initParams(uri, options, callback)
params.method = method
return request(params, params.callback)
}
}

// define like this to please codeintel/intellisense IDEs
request.get = verbFunc(‘get’)
request.head = verbFunc(‘head’)
request.options = verbFunc(‘options’)
request.post = verbFunc(‘post’)

Done

Set