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 { test } from '@playwright/test'; | |
/** | |
* Decorator that wraps a function with a Playwright test step. | |
* Used for reporting purposes. | |
* | |
* @example | |
``` | |
import { step } from './step_decorator'; | |
class MyTestClass { |
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 { | |
FullResult, Reporter, TestCase, TestResult, | |
} from '@playwright/test/types/testReporter'; | |
class PlaywrightSlackReporter implements Reporter { | |
allResults: Array<{ test: TestCase, result: TestResult }>; | |
constructor(private conf: { enabled: boolean, webhookUrl: string }) { | |
this.conf = conf; | |
this.allResults = []; |
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 { browser } from 'protractor'; | |
/** | |
* This function tries to highlight exact point at webpage where click was failed, | |
* by placing special red square into failed coordinate. | |
* So allure screenshots will show exact failing location | |
* @param error exception object | |
*/ | |
export async function drawClickPointAttempt(error: Error) { | |
try { |
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 * as fs from 'fs'; | |
import * as path from 'path'; | |
import { URL } from 'url'; | |
import got from 'got'; | |
import FormData from 'form-data'; | |
async function compress(srcFolder: string, zipFilePath: string) { | |
const archiver = require('archiver'); | |
const targetBasePath = path.dirname(zipFilePath); |
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
/** | |
* @url https://github.com/kochetkov-ma/allure-server | |
*/ | |
const got = require('got') | |
const fs = require('fs'); | |
const FormData = require('form-data'); | |
const baseUrl = new URL(`http://93.126.97.71:5001`) |
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
// Use http://93.126.97.71:10082/mp3-players to simplify these tests. Mp3 players does not have custom params on details page. | |
// bonus points: | |
// - use preconditions | |
// - use dataprovider | |
describe('Items', function () { | |
// You must be logged in to use wishlist | |
it('can be added to wishlist', function () { |
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
/** | |
- Try to implement as much tests as you can | |
- Do not overload tests with logic, be simple | |
- browser.pause() allowed | |
- copy/paste is allowed | |
- prefer css selectors | |
- don't forget about assertions | |
*/ | |
// this test gives you 20 points |
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 { element, By } from 'protractor'; | |
/** | |
* Find element inside nested shadow doms: | |
* shadow1(shadowDOM -> shadow2(shadowDOM -> shadow3(shadowDOM -> button))) | |
* | |
* @example | |
* new SomeElement(shadow$(['shadow1', 'shadow2', 'shadow3'], 'button')).click() | |
* | |
* @param shadowDomCssSelectors |
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
/** Add custom browser and Element commands here */ | |
export {}; | |
declare global { | |
namespace WebdriverIO { | |
// interface Browser { | |
// browserCustomCommand: (arg: any) => Promise<void> | |
// } | |
// interface MultiRemoteBrowser { | |
// browserCustomCommand: (arg: any) => Promise<void> |
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
type OptionsPart = { | |
timeoutMs?: number, | |
poolIntervalMs?: number, | |
errorMessage?: string, | |
falsyError?: boolean | |
} | |
export async function waitForResult<T>(options: { | |
predicate: () => Promise<{ bool: boolean, lastResult: T }>, |
NewerOlder