Skip to content

Instantly share code, notes, and snippets.

View jeremieflrnt's full-sized avatar

jeremieflrnt

  • Montpellier, France
View GitHub Profile
@jeremieflrnt
jeremieflrnt / Workflow-to-Report-Test-Failures.md
Last active October 7, 2024 16:44
Power Automate workflow to report test failures to Teams

Workflow to Report Test Failures to Microsoft Teams with Power Automate

This document outlines a workflow using Microsoft Power Automate to report test failures to a specific Microsoft Teams channel. The workflow enables users to take immediate action to either resolve the issue or automatically create a Jira ticket.

It is part of a medium article I wrote here.

Overview

Whenever a test fails, a dynamic card is sent to the designated Teams channel. The card includes test failure details and offers two primary actions:

@jeremieflrnt
jeremieflrnt / userChrome.css
Created January 26, 2024 15:06
userChrome for Firefox on MacOS with Tab Center Reborn extension
/* For MacOS & Tab Center Reborn */
.tabbrowser-tab {
visibility: collapse;
}
#nav-bar {
padding-left: 66px;
margin-right: 80px;
margin-top: -45px;
@jeremieflrnt
jeremieflrnt / reporter.ts
Created September 11, 2022 14:47
Upgraded dot reporter for Playwright
import { FullConfig } from '@playwright/test';
import { FullResult, Reporter, Suite, TestCase, TestResult } from '@playwright/test/reporter';
class MyReporter implements Reporter {
_testTotal: number;
_counterLine: number;
_counterTestExecuted: number;
_counterSuccess: number;
_counterFailure: number;
_counterFlaky: number;
@jeremieflrnt
jeremieflrnt / createBugsOnJira.ts
Last active September 5, 2022 15:08
Creating a issue on Jira based on latest failed report on Gitlab CI
import axios from 'axios';
import fs from 'fs';
createBugsOnJira();
interface reportJson {
suites: [ { suites: [ { specs: [ { title: string; ok: boolean; tests: [{ annotations: [{ type: string; description: string }] | [] }]; } ]; } ]; } ];
}
function createBugsOnJira() {
@jeremieflrnt
jeremieflrnt / gitlab-ci.yml
Last active September 17, 2024 06:51
Gitlab-ci: job for E2E tests with Playwright
stages:
- install
- build
- deploy
- e2e
test_e2e:
stage: e2e
allow_failure: false
image: mcr.microsoft.com/playwright:focal
@jeremieflrnt
jeremieflrnt / regex.ts
Created August 9, 2022 14:54
Ultimate regex specific domain
export const getValidUrlRegex = (domainName?: string) => {
return domainName
? RegExp(
/^(?:https?:\/\/)?(?:www\.)?(?:(?<subdomain>[a-z0-9-]+)\.)?/.source +
RegExp(domainName).source +
/\.(?:(?<tld>[a-z]{1,63}))?(?::(?<port>[0-9]{1,5}))??(?:[/#](?<path>[\w/\-._~:/?#[\]@!$&'()*+,;=.]*)?)?$/
.source,
)
: /^(?:https?:\/\/)?(?:www\.)?(?:(?<subdomain>[a-z0-9-]+)\.)?(?<domain>[a-z0-9-]+)\.(?:(?<tld>[a-z]{1,63}))?(?::(?<port>[0-9]{1,5}))??(?:[/#](?<path>[\w/\-._~:/?#[\]@!$&'()*+,;=.]*)?)?$/;
};
@jeremieflrnt
jeremieflrnt / SmartTests.spec.ts
Last active August 9, 2022 13:34
Write tests for every story
import componentList from '../resources/componentList.json';
const iFrameUrl = '/iframe.html?id=';
for (const [component, stories] of Object.entries(componentList)) {
test.describe(`Smart tests for component: ${component}`, () => {
for (const story of stories) {
test(`Smart test for story: ${story.split('--')[1]}`, async ({
page,
baseURL,
@jeremieflrnt
jeremieflrnt / GetAllStories.spec.ts
Created August 9, 2022 13:22
Get Stories from storybook
test.describe('Get a list of all stories', () => {
test('Get a list of all stories', async ({ page, baseURL }) => {
await page.goto(baseURL);
await page.click('#storybook-explorer-tree >> #components >> //*[name()="svg"]');
const componentList = {};
const components = await page
.locator('#storybook-explorer-tree >> //*[@data-nodetype="component"]')
.allTextContents();
for (const component of components) {