This file contains 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 type { Reporter, TestCase, TestResult } from '@playwright/test/reporter'; | |
import axios, { AxiosResponse } from 'axios'; | |
class ElasticReporter implements Reporter { | |
testResultsPromises: Array<Promise<AxiosResponse>> = []; | |
elasticUrl = process.env.ELASTIC_URL || undefined; | |
elasticDataBase = { | |
project: 'your-project', | |
team: 'your-team', | |
repo: 'repo', |
This file contains 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 { LOGIN_SELECTORS as selectors} from "./login.selectors" | |
import { authenticationData as authData } from "../../fixtures/authData" | |
const identityServerUrl = Cypress.env("IDENTITY_SERVER_URL") | |
Cypress.Commands.add('loginAPI', (username, password) => { | |
const authEndpoint = `${identityServerUrl}/connect/authorize` | |
const loginPageEndpoint = `${identityServerUrl}/Account/Login` | |
cy.session(['loginAPI', username], () => { | |
cy.request({ |
This file contains 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 sendDataToElastic = currentTest => { | |
if (Cypress.env('ELASTIC_URL')) { | |
const timestampElasticData = new Date().toISOString() | |
const timestampIndex = format(new Date(),'yyyy.MM.dd') | |
const index = `qa-test-report-${timestampIndex}` | |
const elasticData = { | |
'@timestamp': timestampElasticData, | |
project: 'project-name-here', | |
environment: Cypress.env('GITHUB_RUN_ID') ? 'github' : 'local', | |
testTitle: currentTest.title, |