This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
export const fetchLatestSMS = async (twilioClient, toNumber, timeout = 10000) => { | |
return new Promise((resolve, reject) => { | |
setTimeout(async () => { | |
try { | |
// Fetch the latest message to a specific number | |
const messages = await twilioClient.messages.list({ | |
to: toNumber, // Filter messages sent to this number | |
limit: 1, // Fetch only the most recent message | |
order: 'desc' // Order by date sent in descending order | |
}); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const { expect, test } = require('@playwright/test') | |
const twilio = require('twilio'); | |
import { fetchLatestSMS } from './smsHelpers.ts'; | |
const TWILIO_ACCOUNT_SID = "" | |
const TWILIO_AUTH_TOKEN = "" | |
test('Verify SMS code', async ({ page }) => { | |
const twilioClient = twilio(TWILIO_ACCOUNT_SID, TWILIO_AUTH_TOKEN); | |
const toNumber = "+44xxxxxxxxxx" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import { expect, test } from '@playwright/test' | |
const headers = { | |
'X-My-Header': 'value' | |
}; | |
test('visit page and take screenshot with an extra http header for every request', async ({ browser }) => { | |
const context = await browser.newContext(); | |
await context.setExtraHTTPHeaders(headers); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var RSA = function () { | |
/** BEGIN JSBN (http://www-cs-students.stanford.edu/~tjw/jsbn/jsbn.js) **/ | |
/*! | |
* Copyright (c) 2003-2005 Tom Wu | |
* All Rights Reserved. | |
* | |
* Permission is hereby granted, free of charge, to any person obtaining | |
* a copy of this software and associated documentation files (the |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const { test, expect } = require('@playwright/test'); | |
const { sendEncryptedResponse } = require('./snippets/functions.js') | |
const auth_token = process.env.KOSMA_AUTH_TOKEN | |
const psu_ua = "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/80.0.3987.122 Safari/537.36"; | |
const psu_ip = "10.20.30.40" | |
test.describe('Klarna Open Banking', () => { | |
test('XS2A API Flow', async ({ request }) => { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import WebSocket from 'ws'; | |
const url = `wss://ws.postman-echo.com/raw` | |
const ws = new WebSocket(url); | |
const timeout = setTimeout(function () { | |
console.log('Failed to receive expected data within timeout. Terminating the WebSocket connection.') | |
ws.close() | |
throw new Error('Failed to receive expected data within timeout.') | |
}, 10000) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import { test, expect } from '@playwright/test' | |
const token = '_ZMd4xxx' | |
const url = 'https://crudapi.co.uk/api/v1/tasks' | |
const headers = { | |
Authorization: `Bearer ${token}` | |
} | |
test('multi-step api', async ({ request }) => { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const { test, expect } = require('@playwright/test'); | |
const crawl_url = "https://checklyhq.com"; | |
test('Check all links on a page', async ({ page }) => { | |
test.setTimeout(120000) | |
// Navigate to the URL | |
await page.goto(crawl_url); // Replace with your URL | |
// Get all links on the page |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const { expect, test } = require('@playwright/test') | |
const aws4 = require('aws4') | |
const axios = require('axios').default | |
const S3_BUCKET_NAME = 'xxx'; | |
const S3_OBJECT_KEY = '/image.jpg'; // The name you want to give to the uploaded image file | |
const AWS_REGION = 'eu-west-2' | |
test('visit page and take screenshot', async ({ page }) => { | |
const response = await page.goto(process.env.ENVIRONMENT_URL || 'https://checklyhq.com') |