Skip to content

Instantly share code, notes, and snippets.

import { test, expect } from '@playwright/test';
import * as fs from 'fs';
import * as path from 'path';
const TOKEN_PATH = '../playwright/.auth/user.json'
let access_token: string; // Declare accessToken
// This hook runs before all tests in THIS specific file
test.beforeAll(async () => {
// global-setup.ts (or .js)
import { request, expect } from '@playwright/test';
import * as fs from 'fs';
import * as path from 'path';
// Credentials for Basic Authentication
const LOGIN_EMAIL = '[email protected]';
const LOGIN_PASSWORD = 'changeme';
async function globalSetup() {
import { defineConfig, devices } from '@playwright/test';
/**
* Read environment variables from file.
* https://github.com/motdotla/dotenv
*/
// import dotenv from 'dotenv';
// import path from 'path';
// dotenv.config({ path: path.resolve(__dirname, '.env') });
@oofnivek
oofnivek / Program.cs
Last active June 6, 2025 00:13
Async correctly
namespace LearnAsync;
class Program
{
static async Task Main(string[] args)
{
var start = DateTime.Now;
var taskEgg = FryEggAsync(2); // declaring task at the top
var taskBacon = FryBaconAsync(3); // declaring task at the top
@oofnivek
oofnivek / Program.cs
Last active June 6, 2025 00:06
Async wrongly
namespace LearnAsync;
class Program
{
static async Task Main(string[] args)
{
var start = DateTime.Now;
Coffee coffee = PourCoffee();
Console.WriteLine("coffee is ready");
@oofnivek
oofnivek / Program.cs
Last active May 26, 2025 14:41
Synchronous application for comparison
namespace LearnAsync;
class Program
{
static void Main(string[] args)
{
var start = DateTime.Now;
Coffee coffee = PourCoffee();
Console.WriteLine("coffee is ready");
package stepDefinitions;
import org.openqa.selenium.By;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.chrome.ChromeDriver;
import org.testng.Assert;
import io.cucumber.java.en.Given;
import io.cucumber.java.en.Then;
import io.cucumber.java.en.When;
Feature: Wikipedia search
Scenario: Search with title
Given User is at home page
When User searched for a title "iPhone"
Then User found the page
package cucumberOptions;
import io.cucumber.testng.AbstractTestNGCucumberTests;
import io.cucumber.testng.CucumberOptions;
@CucumberOptions(features="src/test/java/features", glue="stepDefinitions", monochrome=true)
public class TestNGRunner extends AbstractTestNGCucumberTests {
}
@oofnivek
oofnivek / Main.java
Last active January 11, 2024 17:31
Extract certificate from JKS in PEM format
package org.example;
import org.bouncycastle.jce.provider.BouncyCastleProvider;
import org.bouncycastle.openssl.jcajce.JcaPEMWriter;
import org.bouncycastle.util.io.pem.PemObject;
import java.io.*;
import java.security.Key;
import java.security.KeyStore;
import java.security.KeyStoreException;