Skip to content

Instantly share code, notes, and snippets.

View NilukaSripalim's full-sized avatar
🏢
Working From Office

Niluka Sripali Monnankulama NilukaSripalim

🏢
Working From Office
View GitHub Profile
public static void assertResponseCodeIs
( final HttpResponse response, final int expectedCode ){
final int statusCode = httpResponse.getStatusLine().getStatusCode();
assertEquals( expectedCode, statusCode );
}
/// <reference types="cypress" />
// ***********************************************************
// This example plugins/index.js can be used to load plugins
//
// You can change the location of this file or turn off loading
// the plugins file with the 'pluginsFile' configuration option.
//
// You can read more here:
// https://on.cypress.io/plugins-guide
// ***********************************************************
@NilukaSripalim
NilukaSripalim / then-command.js
Created February 27, 2021 07:45
Cypress then() Example1
/// <reference types="cypress" />
describe('Cypress Test Automation with then command', () => {
const log = console.log
it('then functionality example', () => {
/**
* then() calls the passed anonymous functions
*/
cy.then(() => log("The basic with then command"));
@NilukaSripalim
NilukaSripalim / Variables inner for loop
Last active October 7, 2021 19:30
JavaScript Essentials
function learnJS() {
for(var i = 0 ; i < 5; i++) {
console.log(i)
}
}
learnJS();
@NilukaSripalim
NilukaSripalim / gist:2ad9809da3d299a49749337c47c8a7e4
Last active February 27, 2022 18:22
CI with Cypress & GitHub Action
# CI name
name: Cypress GitHub Actions
# The on key is used to define when
# the CI should be triggered, aka Event
on:
# When someone push or merge a pull request
# inside the master branch
push:
branches:
@NilukaSripalim
NilukaSripalim / gist:a1d3235a28a62852ba9e1ecabe4cbf55
Created February 27, 2022 19:25
Asgardeo Sign in Cypress Test
describe('Successfully Sign-in to Asgardeo ', () => {
before(() => {
cy.window().then((win) => {
win.onbeforeunload = null;
});
// Visit Asgardeo console
cy.visit("https://dev.console.asgardeo.io/", {
onBeforeLoad: (win) => {
@NilukaSripalim
NilukaSripalim / Cypress Dashboard Record
Created February 27, 2022 22:43
.yml file for record Cypress dashboard from GitHub Actions
# CI name
name: Cypress GitHub Actions
# The on key is used to define when
# the CI should be triggered, aka Event
on:
# When someone push or merge a pull request
# inside the master branch
push:
branches:
@NilukaSripalim
NilukaSripalim / callChoreoUKIPAdaptiveScript.js
Last active November 28, 2022 11:54
Sample adaptive authentication script for callChoreo - IP address from UK
var connectionMetaData = {
"url": "https://2599de0c-00bf-49f4-b922-505be18a8677-dev.e1-us-east-azure.choreoapis.dev/iraa/testnilukaasgardeo/1.0.0/risk",
"consumerKey": "<consumer key>",
"consumerSecret": "<consumer secret>",
};
var onLoginRequest = function(context) {
executeStep(1, {
onSuccess: function (context) {
import ballerina/http;
import ballerina/io;
import ballerina/lang.runtime;
# A service representing a network-accessible API
# bound to port `9090`.
#
# + hasRisk - Field Description
type RiskResponse record {
boolean hasRisk;
@NilukaSripalim
NilukaSripalim / gist:f637fd2f9020274886cfbeb3331679de
Created August 21, 2023 10:53
Asgardeo Claim Mapping via Adaptive Script
var onLoginRequest = function(context) {
executeStep(1, {
onSuccess: function(context) {
var user = context.currentKnownSubject;
user.localClaims['http://wso2.org/claims/givenname'] = "test";
user.localClaims['http://wso2.org/claims/entitlement'] = "Upon a hill, the sun does rise,Painting the world with golden skies. Nature's beauty, a gentle song, In every heart, it does belong.";
}
});
};