Skip to content

Instantly share code, notes, and snippets.

View unickq's full-sized avatar

Nick Chursin unickq

View GitHub Profile
@unickq
unickq / playwright_step.ts
Last active April 23, 2024 15:08
Playwright typescript @step decorator
import { test } from "@playwright/test";
export function step(title?: string) {
return function actualDecorator(
target: (this: any, ...args: any[]) => Promise<any>,
context: ClassMethodDecoratorContext,
) {
async function replacementMethod(this: any, ...args: any): Promise<any> {
const name =
title ||
function createEvent(typeOfEvent) {
var event =document.createEvent("CustomEvent");
event.initCustomEvent(typeOfEvent,true, true, null);
event.dataTransfer = {
data: {},
setData: function (key, value) {
this.data[key] = value;
},
getData: function (key) {
return this.data[key];
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "https://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<style type="text/css">
body{margin: 0px;padding: 15px}body, td, th{font-family: "Lucida Grande", "Lucida Sans Unicode", Helvetica, Arial, Tahoma, sans-serif;font-size: 10pt}th{text-align: left}h1{margin-top: 0px}a{color:#4a72af}
.status{background-color:<%=build.result.toString() == "SUCCESS" ? 'green' : 'gold' %>;font-size:28px;font-weight:bold;color:white;width:720px;height:52px;margin-bottom:18px;text-align:center;vertical-align:middle;border-collapse:collapse;background-repeat:no-repeat}
.status .info{color:white!important;text-shadow:0 -1px 0 rgba(0,0,0,0.3);font-size:32px;line-height:36px;padding:8px 0}
</style>
<body>
<div class="content round_border">