mdt-e2e-dev
Advanced tools
Comparing version 31.3.1 to 31.4.0
@@ -81,4 +81,3 @@ "use strict"; | ||
} | ||
yield this.waitForLoading(); | ||
}); | ||
}); |
@@ -20,3 +20,2 @@ "use strict"; | ||
const page = yield context.newPage(); | ||
workaroundForGoogleFontRequests(page); | ||
const [_, response] = yield Promise.all([ | ||
@@ -36,14 +35,1 @@ page.goto(url), | ||
exports.pageAfterRetries = pageAfterRetries; | ||
function workaroundForGoogleFontRequests(page) { | ||
page.route(`**/*`, (route) => { | ||
const url = route.request().url(); | ||
if (url.includes("fonts.gstatic.com")) { | ||
const headers = route.request().headers(); | ||
delete headers["Authorization"]; | ||
route.continue({ headers }); | ||
} | ||
else { | ||
route.continue(); | ||
} | ||
}); | ||
} |
import { Page } from "../pageObject/page"; | ||
import type { StepDefinition } from "../types/types"; | ||
declare type ModuleStepDefinition = StepDefinition<Page>; | ||
type ModuleStepDefinition = StepDefinition<Page>; | ||
declare const Given: ModuleStepDefinition; | ||
@@ -5,0 +5,0 @@ declare const When: ModuleStepDefinition; |
import { ModulePage as Page } from "../modulePageObject/page"; | ||
import type { StepDefinition } from "../types/types"; | ||
export declare type ModulePage = Pick<Page, "locator">; | ||
declare type ModuleStepDefinition = StepDefinition<ModulePage>; | ||
export type ModulePage = Pick<Page, "locator">; | ||
type ModuleStepDefinition = StepDefinition<ModulePage>; | ||
declare const Given: ModuleStepDefinition; | ||
@@ -6,0 +6,0 @@ declare const When: ModuleStepDefinition; |
import { Locator } from "@playwright/test"; | ||
import { NaturalNumber } from "../../utils/numberAndIndex"; | ||
export interface Dropdown { | ||
export declare class Dropdown { | ||
el: Locator; | ||
item: Locator; | ||
action: Locator; | ||
constructor(parentEl: Locator); | ||
itemByTitle(itemTitle: string): Locator; | ||
itemByNumber(number: NaturalNumber): Locator; | ||
actionsLength(): Promise<number>; | ||
isExist(): Promise<boolean>; | ||
} | ||
export declare function getDropdown(parentEl: Locator): Dropdown; |
"use strict"; | ||
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) { | ||
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); } | ||
return new (P || (P = Promise))(function (resolve, reject) { | ||
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } } | ||
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } } | ||
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); } | ||
step((generator = generator.apply(thisArg, _arguments || [])).next()); | ||
}); | ||
}; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.getDropdown = void 0; | ||
exports.Dropdown = void 0; | ||
const getSelector_1 = require("../../utils/getSelector"); | ||
const numberAndIndex_1 = require("../../utils/numberAndIndex"); | ||
function getDropdown(parentEl) { | ||
const el = parentEl.locator(".dropdown-wrap .dropdown-menu").last(); | ||
const item = el.locator(".dropdown-menu-item"); | ||
const action = (0, getSelector_1.getSelector)({ | ||
testid: "dropdown-menu-action" | ||
}); | ||
return { | ||
el, | ||
item, | ||
itemByTitle(itemTitle) { | ||
return item.locator(`${action}:has(:text-is("${itemTitle}"))`).first(); | ||
}, | ||
itemByNumber(number) { | ||
const index = (0, numberAndIndex_1.getIndexFromNumber)(number); | ||
return item.nth(index); | ||
}, | ||
actionsLength() { | ||
return item.locator(action).count(); | ||
}, | ||
isExist() { | ||
return __awaiter(this, void 0, void 0, function* () { | ||
return yield el.isVisible(); | ||
}); | ||
} | ||
}; | ||
const selectors = (0, getSelector_1.getSelectors)({ | ||
action: "dropdown-menu-action" | ||
}); | ||
class Dropdown { | ||
constructor(parentEl) { | ||
this.el = parentEl.locator(".dropdown-wrap .dropdown-menu").last(); | ||
this.item = this.el.locator(".dropdown-menu-item"); | ||
this.action = this.item.locator(selectors.action); | ||
} | ||
itemByTitle(itemTitle) { | ||
return this.item.locator(`${selectors.action}:has(:text-is("${itemTitle}"))`).first(); | ||
} | ||
itemByNumber(number) { | ||
const index = (0, numberAndIndex_1.getIndexFromNumber)(number); | ||
return this.item.nth(index); | ||
} | ||
isExist() { | ||
return this.el.isVisible(); | ||
} | ||
} | ||
exports.getDropdown = getDropdown; | ||
exports.Dropdown = Dropdown; |
@@ -7,3 +7,3 @@ import { Locator } from "@playwright/test"; | ||
getWidth(): Promise<number>; | ||
isExist(): Promise<boolean>; | ||
waitForExist(): Promise<void>; | ||
displayValueAsync(): Promise<string | null>; | ||
@@ -10,0 +10,0 @@ isReadonly(): Promise<boolean>; |
@@ -38,4 +38,3 @@ "use strict"; | ||
yield waitForUnlocked(); | ||
if (yield this.el.isHidden()) | ||
throw new Error(`Поле "${fieldName}" не найдено.`); | ||
yield this.waitForExist(); | ||
const control = yield (0, controls_1.getControl)(el); | ||
@@ -50,7 +49,5 @@ if (control) | ||
}, | ||
isExist() { | ||
return __awaiter(this, void 0, void 0, function* () { | ||
if (yield this.el.isVisible()) | ||
return true; | ||
throw new Error(`Поле "${fieldName}" не найдено.`); | ||
waitForExist() { | ||
return this.el.waitFor().catch(() => { | ||
throw `Поле "${fieldName}" не найдено.`; | ||
}); | ||
@@ -57,0 +54,0 @@ }, |
@@ -30,4 +30,4 @@ import { Locator } from "@playwright/test"; | ||
export declare function isBoolean(parentEl: Locator): Promise<boolean>; | ||
export declare function getBooleanData(parentEl: Locator): Promise<string>; | ||
export declare function getDataFromBoolean(value: boolean | null): string; | ||
export declare function isValueBoolean(value: string): boolean; | ||
export declare function getBooleanValue(parentEl: Locator): Promise<string>; | ||
export declare function getBooleanFromData(value: string): boolean | null; |
@@ -12,3 +12,3 @@ "use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.getBooleanFromData = exports.getDataFromBoolean = exports.getBooleanData = exports.isBoolean = exports.booleanData = exports.booleanSelector = exports.booleanSelectors = exports.setCheckboxValue = exports.getBooleanControl = exports.getCheckbox = exports.Boolean = void 0; | ||
exports.getBooleanFromData = exports.getBooleanValue = exports.isValueBoolean = exports.isBoolean = exports.booleanData = exports.booleanSelector = exports.booleanSelectors = exports.setCheckboxValue = exports.getBooleanControl = exports.getCheckbox = exports.Boolean = void 0; | ||
const getSelector_1 = require("../../../../../utils/getSelector"); | ||
@@ -28,3 +28,3 @@ class Boolean { | ||
return __awaiter(this, void 0, void 0, function* () { | ||
return yield getBooleanData(this.parentEl); | ||
return yield getBooleanValue(this.parentEl); | ||
}); | ||
@@ -37,5 +37,5 @@ } | ||
return __awaiter(this, void 0, void 0, function* () { | ||
const oldValue = yield getBooleanData(this.parentEl); | ||
const oldValue = yield getBooleanValue(this.parentEl); | ||
yield this.el.click(); | ||
const newValue = yield getBooleanData(this.parentEl); | ||
const newValue = yield getBooleanValue(this.parentEl); | ||
const input = yield this.input.isHidden(); | ||
@@ -104,19 +104,18 @@ if (oldValue != newValue) { | ||
exports.isBoolean = isBoolean; | ||
function getBooleanData(parentEl) { | ||
function isValueBoolean(value) { | ||
return [exports.booleanData.false, exports.booleanData.indeterminate, exports.booleanData.truthy].includes(value); | ||
} | ||
exports.isValueBoolean = isValueBoolean; | ||
function getBooleanValue(parentEl) { | ||
return __awaiter(this, void 0, void 0, function* () { | ||
const booleanValue = yield getBooleanFromEl(parentEl); | ||
return getDataFromBoolean(booleanValue); | ||
const booleanValue = yield getBooleanValueFormEl(parentEl); | ||
if (booleanValue == null) | ||
return exports.booleanData.indeterminate; | ||
if (booleanValue) | ||
return exports.booleanData.truthy; | ||
if (booleanValue == false) | ||
return exports.booleanData.false; | ||
}); | ||
} | ||
exports.getBooleanData = getBooleanData; | ||
function getDataFromBoolean(value) { | ||
if (value == null) | ||
return exports.booleanData.indeterminate; | ||
if (value) | ||
return exports.booleanData.truthy; | ||
if (value == false) | ||
return exports.booleanData.false; | ||
return "Error"; | ||
} | ||
exports.getDataFromBoolean = getDataFromBoolean; | ||
exports.getBooleanValue = getBooleanValue; | ||
function getBooleanFromData(value) { | ||
@@ -129,6 +128,6 @@ if (value == exports.booleanData.indeterminate) | ||
return false; | ||
throw new Error("Не удалось преобразовать значение: " + value); | ||
throw "Не удалось преобразовать значение: " + value; | ||
} | ||
exports.getBooleanFromData = getBooleanFromData; | ||
function getBooleanFromEl(el) { | ||
function getBooleanValueFormEl(el) { | ||
return __awaiter(this, void 0, void 0, function* () { | ||
@@ -152,4 +151,4 @@ if (yield getCheckbox(el).isVisible()) { | ||
} | ||
throw new Error(`Значение в элементе ${el} не булево.`); | ||
throw `Значение в элементе ${el} не булево.`; | ||
}); | ||
} |
@@ -11,2 +11,3 @@ import { Locator } from "@playwright/test"; | ||
import { RadioPicker } from "./radioPicker/radioPicker"; | ||
import { EmptyText } from "./emptyText/emptyText"; | ||
export interface IControl { | ||
@@ -19,4 +20,4 @@ type: ControlType; | ||
} | ||
declare type ControlType = Control["type"]; | ||
export declare type Control = MultiPicker | Picker | DatePicker | FileControl | SelectControl | Boolean | InputControl | TextAreaControl | ContentEditableControl | RadioPicker; | ||
type ControlType = Control["type"]; | ||
export type Control = MultiPicker | Picker | DatePicker | FileControl | SelectControl | Boolean | InputControl | TextAreaControl | ContentEditableControl | RadioPicker | EmptyText; | ||
export declare function getControl(parentEl: Locator, type?: ControlType): Promise<Control | undefined>; | ||
@@ -23,0 +24,0 @@ export declare function setControlValue(page: Page, control: Control, value: string): Promise<void>; |
@@ -21,5 +21,7 @@ "use strict"; | ||
const radioPicker_1 = require("./radioPicker/radioPicker"); | ||
const emptyText_1 = require("./emptyText/emptyText"); | ||
function getControl(parentEl, type) { | ||
return __awaiter(this, void 0, void 0, function* () { | ||
const controls = [ | ||
emptyText_1.getEmptyText, | ||
multiPicker_1.getMultiPicker, | ||
@@ -26,0 +28,0 @@ picker_1.getPicker, |
@@ -61,3 +61,2 @@ "use strict"; | ||
return __awaiter(this, void 0, void 0, function* () { | ||
yield clearDatePickerValue(date); | ||
yield date.textEl.fill(value); | ||
@@ -64,0 +63,0 @@ }); |
@@ -75,5 +75,5 @@ "use strict"; | ||
yield picker.el.hover(); | ||
yield picker.clear.waitFor(); | ||
if (yield picker.clear.isVisible()) { | ||
yield picker.clear.click(); | ||
yield page.waitForLoading(); | ||
} | ||
@@ -83,13 +83,15 @@ else | ||
} | ||
yield picker.input.clear(); | ||
yield page.dropdown.el.waitFor(); | ||
if (yield page.dropdown.el.isHidden()) { | ||
else { | ||
yield picker.input.click(); | ||
} | ||
const dropdown = yield (0, dropdown_steps_1.getReadyDropdown)(page.dropdown); | ||
const item = dropdown.itemByTitle(value); | ||
yield page.waitForLoadingIndicator(); | ||
let dropdown = yield (0, dropdown_steps_1.getReadyDropdown)(page.dropdown); | ||
let item = dropdown.itemByTitle(value); | ||
if (yield item.isHidden()) { | ||
yield picker.input.fill(value); | ||
yield page.waitForLoading(); | ||
yield page.waitForLoadingIndicator(); | ||
dropdown = yield (0, dropdown_steps_1.getReadyDropdown)(page.dropdown); | ||
item = dropdown.itemByTitle(value); | ||
} | ||
yield item.waitFor(); | ||
yield item.click(); | ||
@@ -96,0 +98,0 @@ yield dropdown.el.waitFor({ state: "hidden" }); |
import { Locator } from "@playwright/test"; | ||
import { TagMenu } from "../tag/tag"; | ||
import { Skeleton } from "../progressBar/skeleton/skeleton"; | ||
export declare type FormRecord = Record<string, string>; | ||
export type FormRecord = Record<string, string>; | ||
interface FormOptions { | ||
@@ -6,0 +6,0 @@ designerWrapper: Locator; |
@@ -17,3 +17,3 @@ "use strict"; | ||
const asyncArray_1 = require("../../utils/asyncArray"); | ||
const dateMatcher_1 = require("../../utils/dateMatcher"); | ||
const dateMatcher_1 = require("../../utils/date/dateMatcher/dateMatcher"); | ||
const isNullOrEmpty_1 = require("../../utils/isNullOrEmpty"); | ||
@@ -31,3 +31,3 @@ const tableManager_1 = require("../../utils/tableManager"); | ||
const radioPicker_1 = require("./Field/fieldControls/radioPicker/radioPicker"); | ||
const strictListCompare_steps_1 = require("../list/steps/compare/strictListCompare.steps"); | ||
const compareByRowsOrder_1 = require("../list/steps/compare/compareByRowsOrder"); | ||
/* | ||
@@ -79,2 +79,4 @@ Когда заполняем поля формы следующими значениями: | ||
yield (0, test_1.expect)(item).toBeHidden(); | ||
yield this.cucumberPage.keyboard.press("Escape"); | ||
yield dropdown.el.waitFor({ state: "hidden" }); | ||
}); | ||
@@ -505,2 +507,4 @@ }); | ||
return __awaiter(this, void 0, void 0, function* () { | ||
const form = yield page.getForm(); | ||
yield form.waitForReady(); | ||
const list = yield (0, list_steps_1.getList)(page, title); | ||
@@ -521,3 +525,3 @@ yield (0, test_1.expect)(list.el).toBeVisible(); | ||
*/ | ||
(0, cucumber_1.Then)("на форме есть список {string}:", function (listTitle, dataTable) { | ||
(0, cucumber_1.Then)("на форме есть список {string}:", { timeout: -1 }, function (listTitle, dataTable) { | ||
return __awaiter(this, void 0, void 0, function* () { | ||
@@ -527,3 +531,3 @@ const list = yield (0, list_steps_1.getList)(this, listTitle); | ||
yield (0, test_1.expect)(list.el).toBeVisible(); | ||
yield (0, strictListCompare_steps_1.strictListEquality)(list, (0, tableManager_1.getListData)(dataTable)); | ||
yield (0, compareByRowsOrder_1.compareByRowsOrder)(list, (0, tableManager_1.getListData)(dataTable)); | ||
}); | ||
@@ -530,0 +534,0 @@ }); |
@@ -16,3 +16,3 @@ "use strict"; | ||
const form_steps_1 = require("../form.steps"); | ||
const strictListCompare_steps_1 = require("../../list/steps/compare/strictListCompare.steps"); | ||
const compareByRowsOrder_1 = require("../../list/steps/compare/compareByRowsOrder"); | ||
(0, cucumber_1.When)("на форме нажимаем на вкладку {string}.", function (tabTitle) { | ||
@@ -32,9 +32,9 @@ return __awaiter(this, void 0, void 0, function* () { | ||
}); | ||
(0, cucumber_1.Then)("на вкладке {string} есть список со следующими записями:", function (tabTitle, dataTable) { | ||
(0, cucumber_1.Then)("на вкладке {string} есть список со следующими записями:", { timeout: -1 }, function (tabTitle, dataTable) { | ||
return __awaiter(this, void 0, void 0, function* () { | ||
const tab = yield getTabFromForm(this, tabTitle); | ||
const list = yield this.getList({ parentEl: tab.content }); | ||
yield list.isReady(); | ||
yield (0, test_1.expect)(list.el).toBeVisible(); | ||
const listData = (0, tableManager_1.getListData)(dataTable); | ||
yield (0, strictListCompare_steps_1.strictListEquality)(list, listData); | ||
yield (0, compareByRowsOrder_1.compareByRowsOrder)(list, (0, tableManager_1.getListData)(dataTable)); | ||
}); | ||
@@ -41,0 +41,0 @@ }); |
@@ -22,11 +22,10 @@ import { Locator } from "@playwright/test"; | ||
export declare function getColumnMenu(dropdown: Dropdown): ColumnMenu; | ||
interface ColumnMenuAggregation { | ||
el: Locator; | ||
itemByTitle(title: string): { | ||
export declare class AggregationColumnMenu { | ||
dropdown: Dropdown; | ||
private selectors; | ||
constructor(dropdown: Dropdown); | ||
item(title?: string): { | ||
el: Locator; | ||
value(): Promise<string>; | ||
value: () => Promise<string>; | ||
}; | ||
itemsLength(): Promise<number>; | ||
} | ||
export declare function getAggregation(dropdown: Dropdown): ColumnMenuAggregation; | ||
export {}; |
@@ -12,3 +12,3 @@ "use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.getAggregation = exports.getColumnMenu = void 0; | ||
exports.AggregationColumnMenu = exports.getColumnMenu = void 0; | ||
const getSelector_1 = require("../../../utils/getSelector"); | ||
@@ -69,30 +69,25 @@ const quickFilter_1 = require("./quickFilter/quickFilter"); | ||
exports.getColumnMenu = getColumnMenu; | ||
function getAggregation(dropdown) { | ||
const el = dropdown.el; | ||
const itemSelector = (0, getSelector_1.getSelector)({ | ||
testid: "aggregation-cm-item" | ||
}); | ||
return { | ||
el, | ||
itemByTitle(title) { | ||
const titleSelector = (0, getSelector_1.getSelector)({ | ||
testid: "aggregation-cm-item-title" | ||
}); | ||
const itemEl = dropdown.item.locator(`${itemSelector}:has(${titleSelector}:text-is("${title}"))`); | ||
return { | ||
el: itemEl, | ||
value() { | ||
return itemEl | ||
.locator((0, getSelector_1.getSelector)({ | ||
testid: "aggregation-cm-item-value" | ||
})) | ||
.textContent(); | ||
} | ||
}; | ||
}, | ||
itemsLength() { | ||
return dropdown.actionsLength(); | ||
class AggregationColumnMenu { | ||
constructor(dropdown) { | ||
this.dropdown = dropdown; | ||
this.selectors = (0, getSelector_1.getSelectors)({ | ||
itemTitle: "aggregation-cm-item-title", | ||
item: "aggregation-cm-item", | ||
itemValue: "aggregation-cm-item-value" | ||
}); | ||
} | ||
item(title) { | ||
let selector = this.selectors.item; | ||
if (title) { | ||
selector += `:has(${this.selectors.itemTitle}:text-is("${title}"))`; | ||
} | ||
}; | ||
const itemEl = this.dropdown.item.locator(selector); | ||
return { | ||
el: itemEl, | ||
value: () => { | ||
return itemEl.locator(this.selectors.itemValue).textContent(); | ||
} | ||
}; | ||
} | ||
} | ||
exports.getAggregation = getAggregation; | ||
exports.AggregationColumnMenu = AggregationColumnMenu; |
@@ -15,3 +15,3 @@ "use strict"; | ||
const asyncArray_1 = require("../../../utils/asyncArray"); | ||
const dateMatcher_1 = require("../../../utils/dateMatcher"); | ||
const dateMatcher_1 = require("../../../utils/date/dateMatcher/dateMatcher"); | ||
const getSelector_1 = require("../../../utils/getSelector"); | ||
@@ -24,2 +24,4 @@ const tableManager_1 = require("../../../utils/tableManager"); | ||
const setup_1 = require("../../../../setup/setup"); | ||
const customWaitFor_1 = require("../../../utils/customWaitFor"); | ||
const customMatchers_1 = require("../../../utils/customMatchers"); | ||
(0, cucumber_1.When)("в колоночном меню нажимаем на значение {string}.", function (valueItemTitle) { | ||
@@ -36,2 +38,3 @@ return __awaiter(this, void 0, void 0, function* () { | ||
const columnMenu = yield getColumnMenuAsync(this); | ||
yield columnMenu.valuesFilter.waitForLoading(); | ||
yield columnMenu.valuesFilter.values.scrollToLast(); | ||
@@ -59,3 +62,2 @@ }); | ||
yield columnMenu.valuesFilter.waitForChange(); | ||
yield columnMenu.valuesFilter.waitForLoading(); | ||
}); | ||
@@ -128,8 +130,7 @@ }); | ||
const dropdown = yield (0, dropdown_steps_1.getReadyDropdown)(this.dropdown); | ||
const aggregation = (0, columnMenu_1.getAggregation)(dropdown); | ||
const aggregation = new columnMenu_1.AggregationColumnMenu(dropdown); | ||
const aggregationRecord = (0, tableManager_1.getRecord)(AggregationRow); | ||
const propsCount = Object.keys(aggregationRecord).length; | ||
(0, test_1.expect)(yield aggregation.itemsLength()).toBe(propsCount); | ||
yield (0, test_1.expect)(aggregation.item().el).toHaveCount(Object.keys(aggregationRecord).length); | ||
yield (0, asyncArray_1.asyncForEach)(Object.keys(aggregationRecord), (itemTitle) => __awaiter(this, void 0, void 0, function* () { | ||
const item = aggregation.itemByTitle(itemTitle); | ||
const item = aggregation.item(itemTitle); | ||
yield (0, test_1.expect)(item.el).toBeVisible(); | ||
@@ -159,27 +160,37 @@ const itemValue = yield item.value(); | ||
}); | ||
(0, cucumber_1.Then)("в колоночном меню есть значения:", function (tableData) { | ||
(0, cucumber_1.Then)("в колоночном меню есть значения:", { timeout: -1 }, function (tableData) { | ||
return __awaiter(this, void 0, void 0, function* () { | ||
const rows = (0, tableManager_1.getRowsData)(tableData); | ||
validateValuesFilterTable(rows); | ||
const columnMenu = yield getColumnMenuAsync(this); | ||
const rows = (0, tableManager_1.getRowsData)(tableData); | ||
yield (0, asyncArray_1.asyncForEach)(rows, (row) => __awaiter(this, void 0, void 0, function* () { | ||
if (row.length != 2) | ||
throw new Error("Таблица сопоставления значений для колоночного меню должна содержать 2 столбца."); | ||
const valueItem = yield getValueItem(columnMenu, row[1]); | ||
(0, test_1.expect)(yield valueItem.value()).toSoftEqual(row[0]); | ||
yield (0, asyncArray_1.asyncForEach)(rows, ([value, title]) => __awaiter(this, void 0, void 0, function* () { | ||
const valueItem = yield getValueItem(columnMenu, title); | ||
yield (0, customWaitFor_1.customWaitFor)(() => __awaiter(this, void 0, void 0, function* () { | ||
return (0, customMatchers_1.areSoftEqual)(yield valueItem.value(), value); | ||
})).catch(() => { | ||
throw `В элементе ${title} значение не равно ${value}`; | ||
}); | ||
})); | ||
}); | ||
}); | ||
(0, cucumber_1.Then)("значения колоночного меню расположены в следующем порядке:", function (tableData) { | ||
(0, cucumber_1.Then)("значения колоночного меню расположены в следующем порядке:", { timeout: -1 }, function (tableData) { | ||
return __awaiter(this, void 0, void 0, function* () { | ||
const rows = (0, tableManager_1.getRowsData)(tableData); | ||
validateValuesFilterTable(rows); | ||
const columnMenu = yield getColumnMenuAsync(this); | ||
const rows = (0, tableManager_1.getRowsData)(tableData); | ||
yield (0, asyncArray_1.asyncForEach)(rows, (row, index) => __awaiter(this, void 0, void 0, function* () { | ||
if (row.length != 2) | ||
throw new Error("Таблица сопоставления значений для колоночного меню должна содержать 2 столбца."); | ||
yield (0, asyncArray_1.asyncForEach)(rows, ([value, title], index) => __awaiter(this, void 0, void 0, function* () { | ||
const valueItem = columnMenu.valuesFilter.values.item(index); | ||
(0, test_1.expect)(yield valueItem.value()).toSoftEqual(row[0]); | ||
(0, test_1.expect)(yield valueItem.title.textContent()).toSoftEqual(row[1]); | ||
yield (0, customWaitFor_1.customWaitFor)(() => __awaiter(this, void 0, void 0, function* () { | ||
return ((0, customMatchers_1.areSoftEqual)(yield valueItem.value(), value) && | ||
(0, customMatchers_1.areSoftEqual)(yield valueItem.title.textContent(), title)); | ||
})).catch(() => { | ||
throw `Значение ${title} ${value} не найдено`; | ||
}); | ||
})); | ||
}); | ||
}); | ||
function validateValuesFilterTable(rows) { | ||
if (rows.find((r) => r.length != 2)) | ||
throw "Таблица сопоставления значений для колоночного меню должна содержать 2 столбца."; | ||
} | ||
(0, cucumber_1.Then)("в колоночном меню у быстрого фильтра есть значение {string}", function (filterValue) { | ||
@@ -216,6 +227,10 @@ return __awaiter(this, void 0, void 0, function* () { | ||
} | ||
function getValueItem(columnMenu, valueItemTitle) { | ||
function getValueItem(columnMenu, title) { | ||
return __awaiter(this, void 0, void 0, function* () { | ||
yield columnMenu.valuesFilter.waitForLoading(); | ||
return yield columnMenu.valuesFilter.values.get((0, dateMatcher_1.parseIfAlias)(valueItemTitle)); | ||
const item = columnMenu.valuesFilter.values.itemByTitle((0, dateMatcher_1.parseIfAlias)(title)); | ||
yield item.el.waitFor().catch(() => { | ||
throw `Значение ${title} не найдено`; | ||
}); | ||
return item; | ||
}); | ||
@@ -222,0 +237,0 @@ } |
import { Locator } from "@playwright/test"; | ||
import { DatePicker } from "../../../form/Field/fieldControls/date/date"; | ||
import { InputControl } from "../../../form/Field/fieldControls/text/text"; | ||
export declare type QuickFilter = { | ||
export type QuickFilter = { | ||
control: InputControl | QuickFilterDatePicker; | ||
@@ -6,0 +6,0 @@ waitForChange(): Promise<void>; |
import { Locator } from "@playwright/test"; | ||
import { Index } from "../../../../utils/numberAndIndex"; | ||
import { InputControl } from "../../../form/Field/fieldControls/text/text"; | ||
@@ -11,10 +10,2 @@ export interface ValuesFilter { | ||
export declare function getValuesFilter(parentEl: Locator): ValuesFilter; | ||
interface ColumnMenuValues { | ||
el: Locator; | ||
readonly selectAllItem: ValueItem; | ||
get(itemTitle: string): Promise<ValueItem>; | ||
isAllSelected(): Promise<boolean>; | ||
scrollToLast(): Promise<void>; | ||
item(index: Index): ValueItem; | ||
} | ||
interface ValueItem { | ||
@@ -26,2 +17,14 @@ el: Locator; | ||
} | ||
declare class ColumnMenuValues { | ||
el: Locator; | ||
itemEl: Locator; | ||
private allChecked; | ||
constructor(parentEl: Locator); | ||
get selectAllItem(): ValueItem; | ||
scrollToLast(): Promise<void>; | ||
item(index: number): ValueItem; | ||
get loading(): Locator; | ||
itemByTitle(title: string): ValueItem; | ||
isAllSelected(): Promise<boolean>; | ||
} | ||
export {}; |
@@ -19,3 +19,2 @@ "use strict"; | ||
const valuesFilterItem = parentEl.locator((0, getSelector_1.getSelector)({ testid: "values-filter" })); | ||
const values = parentEl.locator((0, getSelector_1.getSelector)({ testid: "values-filter-checkboxes" })); | ||
return { | ||
@@ -25,7 +24,6 @@ input: (0, text_1.getInputControl)(valuesFilterItem.locator((0, getSelector_1.getSelector)({ testid: "values-filter-input" }))), | ||
return __awaiter(this, void 0, void 0, function* () { | ||
const loading = values.locator((0, getSelector_1.getSelector)({ testid: "more-loading" })); | ||
if (yield loading.isVisible()) | ||
yield loading.waitFor({ | ||
state: "hidden" | ||
}); | ||
const loading = this.values.loading; | ||
yield loading.waitFor({ | ||
state: "hidden" | ||
}); | ||
}); | ||
@@ -38,48 +36,44 @@ }, | ||
}, | ||
values: getColumnMenuValues(values) | ||
values: new ColumnMenuValues(parentEl) | ||
}; | ||
} | ||
exports.getValuesFilter = getValuesFilter; | ||
function getColumnMenuValues(parentEl) { | ||
const values = parentEl; | ||
const allChecked = values.locator((0, getSelector_1.getSelector)({ testid: "filter-checkbox", allChecked: "true" })); | ||
const item = values.locator((0, getSelector_1.getSelector)({ testid: "filter-checkbox" })); | ||
return { | ||
el: values, | ||
get selectAllItem() { | ||
const valueItem = (0, checkbox_1.getCheckbox)(allChecked); | ||
return getValueItem(valueItem); | ||
}, | ||
scrollToLast() { | ||
return __awaiter(this, void 0, void 0, function* () { | ||
item.last().scrollIntoViewIfNeeded(); | ||
}); | ||
}, | ||
item(index) { | ||
return getValueItem(item.nth(index)); | ||
}, | ||
get(itemTitle) { | ||
return __awaiter(this, void 0, void 0, function* () { | ||
const valueItem = item.locator(`:has-text("${itemTitle}")`); | ||
const count = yield valueItem.count(); | ||
for (let i = 0; i < count; i++) { | ||
const valueItemLocator = valueItem.nth(i); | ||
return getValueItem(valueItemLocator); | ||
} | ||
}); | ||
}, | ||
isAllSelected() { | ||
return __awaiter(this, void 0, void 0, function* () { | ||
const count = yield item.count(); | ||
for (let i = 0; i < count; i++) { | ||
const valueItemLocator = item.nth(i); | ||
const valueItem = getValueItem(valueItemLocator); | ||
const value = yield valueItem.value(); | ||
if ((0, checkbox_1.getBooleanFromData)(value)) | ||
return false; | ||
} | ||
return true; | ||
}); | ||
} | ||
}; | ||
class ColumnMenuValues { | ||
constructor(parentEl) { | ||
this.el = parentEl.locator((0, getSelector_1.getSelector)({ testid: "values-filter-checkboxes" })); | ||
this.itemEl = this.el.locator((0, getSelector_1.getSelector)({ testid: "filter-checkbox" })); | ||
this.allChecked = this.el.locator((0, getSelector_1.getSelector)({ testid: "filter-checkbox", allChecked: "true" })); | ||
} | ||
get selectAllItem() { | ||
const valueItem = (0, checkbox_1.getCheckbox)(this.allChecked); | ||
return getValueItem(valueItem); | ||
} | ||
scrollToLast() { | ||
return __awaiter(this, void 0, void 0, function* () { | ||
this.itemEl.last().scrollIntoViewIfNeeded(); | ||
}); | ||
} | ||
item(index) { | ||
return getValueItem(this.itemEl.nth(index)); | ||
} | ||
get loading() { | ||
return this.el.locator((0, getSelector_1.getSelector)({ testid: "more-loading" })); | ||
} | ||
itemByTitle(title) { | ||
const valueItem = this.itemEl.locator(`:has-text("${title}")`).first(); | ||
return getValueItem(valueItem); | ||
} | ||
isAllSelected() { | ||
return __awaiter(this, void 0, void 0, function* () { | ||
const count = yield this.itemEl.count(); | ||
for (let i = 0; i < count; i++) { | ||
const valueItemLocator = this.itemEl.nth(i); | ||
const valueItem = getValueItem(valueItemLocator); | ||
const value = yield valueItem.value(); | ||
if ((0, checkbox_1.getBooleanFromData)(value)) | ||
return false; | ||
} | ||
return true; | ||
}); | ||
} | ||
} | ||
@@ -94,3 +88,3 @@ function getValueItem(itemEl) { | ||
return __awaiter(this, void 0, void 0, function* () { | ||
return (0, checkbox_1.getBooleanData)(el); | ||
return (0, checkbox_1.getBooleanValue)(el); | ||
}); | ||
@@ -97,0 +91,0 @@ } |
@@ -135,3 +135,3 @@ "use strict"; | ||
return __awaiter(this, void 0, void 0, function* () { | ||
const cellValue = yield (0, checkbox_1.getBooleanData)(this.el); | ||
const cellValue = yield (0, checkbox_1.getBooleanValue)(this.el); | ||
return (0, checkbox_1.getBooleanFromData)(cellValue); | ||
@@ -143,3 +143,3 @@ }); | ||
if (yield (0, checkbox_1.isBoolean)(this.el)) { | ||
const cellValue = yield (0, checkbox_1.getBooleanData)(this.el); | ||
const cellValue = yield (0, checkbox_1.getBooleanValue)(this.el); | ||
return cellValue; | ||
@@ -146,0 +146,0 @@ } |
@@ -21,3 +21,3 @@ import { Locator } from "@playwright/test"; | ||
getRow(rowNumber: NaturalNumber): Promise<Row>; | ||
getColumnsIndexes(columns: string[]): Promise<Record<string, number>>; | ||
getColumnsIndexes(columns: string[]): Promise<ColumnIndexes>; | ||
findSimilar(record: MdtRecord, columnIndexes: Record<string, number>): Promise<Row | undefined>; | ||
@@ -37,1 +37,2 @@ areRowSimilar(row: Row, record: MdtRecord, columnIndexes: Record<string, number>): Promise<boolean>; | ||
} | ||
export type ColumnIndexes = Record<string, number>; |
@@ -70,3 +70,3 @@ "use strict"; | ||
return (0, indexData_1.getIndexes)(columns, listColumns, (key) => { | ||
throw new Error(`Поля "${key}" нет в списке.`); | ||
throw `Поля "${key}" нет в списке.`; | ||
}); | ||
@@ -73,0 +73,0 @@ }); |
@@ -67,3 +67,3 @@ "use strict"; | ||
}); | ||
(0, cucumber_1.When)("нажимаем кнопку {string} в списке.", function (buttonTitle) { | ||
(0, cucumber_1.When)("нажимаем кнопку {string} в списке.", { timeout: -1 }, function (buttonTitle) { | ||
return __awaiter(this, void 0, void 0, function* () { | ||
@@ -496,4 +496,3 @@ yield clickButtonFromListStep(this, buttonTitle); | ||
const list = yield getList(this); | ||
const listRowsCount = yield list.displayRowsCount(); | ||
(0, test_1.expect)(listRowsCount).toBe(rowsCount); | ||
yield (0, test_1.expect)(list.tr).toHaveCount(rowsCount); | ||
}); | ||
@@ -500,0 +499,0 @@ }); |
@@ -25,14 +25,15 @@ import { Locator } from "@playwright/test"; | ||
export declare function getRow(row: Locator, headerRow: HeaderRow): Row; | ||
export interface RowCell { | ||
export declare class RowCell { | ||
el: Locator; | ||
tagMark: Locator; | ||
value(): Promise<string | null>; | ||
clearValue(): Promise<void>; | ||
constructor(el: Locator); | ||
isSelect(): Promise<boolean>; | ||
isReadonly(): Promise<boolean>; | ||
getClasses(): Promise<string[] | null>; | ||
getClasses(): Promise<string[]>; | ||
value(): Promise<string>; | ||
waitForValue(value: string): Promise<void>; | ||
edit(): Promise<void>; | ||
image(number?: NaturalNumber): Locator; | ||
clearValue(): Promise<void>; | ||
get tagMark(): Locator; | ||
} | ||
export declare function getRowCell(cell: Locator): RowCell; | ||
export declare function setCellValue(page: Page, cell: RowCell, value: string): Promise<void>; |
@@ -12,5 +12,5 @@ "use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.setCellValue = exports.getRowCell = exports.getRow = void 0; | ||
exports.setCellValue = exports.RowCell = exports.getRow = void 0; | ||
const asyncArray_1 = require("../../../utils/asyncArray"); | ||
const dateMatcher_1 = require("../../../utils/dateMatcher"); | ||
const dateMatcher_1 = require("../../../utils/date/dateMatcher/dateMatcher"); | ||
const isNullOrEmpty_1 = require("../../../utils/isNullOrEmpty"); | ||
@@ -20,2 +20,4 @@ const numberAndIndex_1 = require("../../../utils/numberAndIndex"); | ||
const controls_1 = require("../../form/Field/fieldControls/controls"); | ||
const customMatchers_1 = require("../../../utils/customMatchers"); | ||
const customWaitFor_1 = require("../../../utils/customWaitFor"); | ||
function getRow(row, headerRow) { | ||
@@ -51,6 +53,6 @@ const el = row; | ||
getCellByIndex(cellIndex) { | ||
return getRowCell(this.el.locator(`td`).nth(cellIndex)); | ||
return new RowCell(this.el.locator(`td`).nth(cellIndex)); | ||
}, | ||
formOpener: el.locator(`td ${formOpener}`), | ||
formOpenerCell: getRowCell(el.locator(`td:has(${formOpener})`)), | ||
formOpenerCell: new RowCell(el.locator(`td:has(${formOpener})`)), | ||
selectCell() { | ||
@@ -143,76 +145,83 @@ return __awaiter(this, void 0, void 0, function* () { | ||
exports.getRow = getRow; | ||
function getRowCell(cell) { | ||
const el = cell; | ||
return { | ||
el, | ||
isSelect() { | ||
var _a; | ||
return __awaiter(this, void 0, void 0, function* () { | ||
const classList = yield this.el.getAttribute("class"); | ||
if (!classList) | ||
return false; | ||
return ((_a = classList.match(/select-cell/)) === null || _a === void 0 ? void 0 : _a.length) == 1; | ||
}); | ||
}, | ||
isReadonly() { | ||
return __awaiter(this, void 0, void 0, function* () { | ||
yield el.click(); | ||
const cellContent = yield el.innerHTML(); | ||
yield el.dblclick(); | ||
yield el.press("F2"); | ||
const isContentNotChanged = cellContent == (yield el.innerHTML()); | ||
return isContentNotChanged; | ||
}); | ||
}, | ||
getClasses() { | ||
return __awaiter(this, void 0, void 0, function* () { | ||
const classList = yield this.el.evaluate((el) => [...el.classList]); | ||
return classList; | ||
}); | ||
}, | ||
value() { | ||
return __awaiter(this, void 0, void 0, function* () { | ||
const control = yield (0, controls_1.getControl)(this.el); | ||
if (control) | ||
return yield control.displayValueAsync(); | ||
if (yield cell.locator(".selector-link").isVisible()) { | ||
const cellValue = yield cell.locator(".selector-link").textContent(); | ||
return cellValue; | ||
} | ||
if (yield cell.locator(".value-wrap, .word-wrap").isVisible()) { | ||
const cellValue = yield cell.locator(".value-wrap, .word-wrap").textContent(); | ||
return cellValue; | ||
} | ||
const cellValue = yield cell.textContent(); | ||
return cellValue.trim(); | ||
}); | ||
}, | ||
edit() { | ||
return __awaiter(this, void 0, void 0, function* () { | ||
yield el.click(); | ||
yield el.press("F2"); | ||
yield el.hover(); | ||
}); | ||
}, | ||
image(number) { | ||
const index = number ? (0, numberAndIndex_1.getIndexFromNumber)(number) : 0; | ||
return el.locator((0, getSelector_1.getSelector)({ testid: "file-image-content" })).nth(index); | ||
}, | ||
clearValue() { | ||
return __awaiter(this, void 0, void 0, function* () { | ||
yield this.edit(); | ||
const control = yield (0, controls_1.getControl)(this.el); | ||
if (!control) | ||
throw "Не удалось определить тип компонента в ячейке, чтобы ее очистить"; | ||
yield (0, controls_1.clearControlValue)(control); | ||
}); | ||
}, | ||
get tagMark() { | ||
return el.locator((0, getSelector_1.getSelector)({ | ||
testid: "cell-tag-mark" | ||
class RowCell { | ||
constructor(el) { | ||
this.el = el; | ||
} | ||
isSelect() { | ||
var _a; | ||
return __awaiter(this, void 0, void 0, function* () { | ||
const classList = yield this.el.getAttribute("class"); | ||
if (!classList) | ||
return false; | ||
return ((_a = classList.match(/select-cell/)) === null || _a === void 0 ? void 0 : _a.length) == 1; | ||
}); | ||
} | ||
isReadonly() { | ||
return __awaiter(this, void 0, void 0, function* () { | ||
yield this.el.click(); | ||
const cellContent = yield this.el.innerHTML(); | ||
yield this.el.dblclick(); | ||
yield this.el.press("F2"); | ||
const isContentNotChanged = cellContent == (yield this.el.innerHTML()); | ||
return isContentNotChanged; | ||
}); | ||
} | ||
getClasses() { | ||
return __awaiter(this, void 0, void 0, function* () { | ||
const classList = yield this.el.evaluate((el) => [...el.classList]); | ||
return classList; | ||
}); | ||
} | ||
value() { | ||
return __awaiter(this, void 0, void 0, function* () { | ||
const control = yield (0, controls_1.getControl)(this.el); | ||
if (control) | ||
return yield control.displayValueAsync(); | ||
if (yield this.el.locator(".selector-link").isVisible()) { | ||
const cellValue = yield this.el.locator(".selector-link").textContent(); | ||
return cellValue; | ||
} | ||
if (yield this.el.locator(".value-wrap, .word-wrap").isVisible()) { | ||
const cellValue = yield this.el.locator(".value-wrap, .word-wrap").textContent(); | ||
return cellValue; | ||
} | ||
const cellValue = yield this.el.textContent(); | ||
return cellValue.trim(); | ||
}); | ||
} | ||
waitForValue(value) { | ||
return __awaiter(this, void 0, void 0, function* () { | ||
yield (0, customWaitFor_1.customWaitFor)(() => __awaiter(this, void 0, void 0, function* () { | ||
const cellValue = yield this.value(); | ||
return (0, customMatchers_1.areSoftEqual)(value, cellValue); | ||
})); | ||
} | ||
}; | ||
}); | ||
} | ||
edit() { | ||
return __awaiter(this, void 0, void 0, function* () { | ||
yield this.el.click(); | ||
yield this.el.press("F2"); | ||
yield this.el.hover(); | ||
}); | ||
} | ||
image(number) { | ||
const index = number ? (0, numberAndIndex_1.getIndexFromNumber)(number) : 0; | ||
return this.el.locator((0, getSelector_1.getSelector)({ testid: "file-image-content" })).nth(index); | ||
} | ||
clearValue() { | ||
return __awaiter(this, void 0, void 0, function* () { | ||
yield this.edit(); | ||
const control = yield (0, controls_1.getControl)(this.el); | ||
if (!control) | ||
throw "Не удалось определить тип компонента в ячейке, чтобы ее очистить"; | ||
yield (0, controls_1.clearControlValue)(control); | ||
}); | ||
} | ||
get tagMark() { | ||
return this.el.locator((0, getSelector_1.getSelector)({ | ||
testid: "cell-tag-mark" | ||
})); | ||
} | ||
} | ||
exports.getRowCell = getRowCell; | ||
exports.RowCell = RowCell; | ||
function setCellValue(page, cell, value) { | ||
@@ -219,0 +228,0 @@ return __awaiter(this, void 0, void 0, function* () { |
@@ -17,8 +17,10 @@ "use strict"; | ||
const tableManager_1 = require("../../../../utils/tableManager"); | ||
const list_steps_1 = require("../../list.steps"); | ||
const notFoundRecords_1 = require("./notFoundRecords"); | ||
const compareByRowsOrder_1 = require("./compareByRowsOrder"); | ||
const withTimeoutHelpers_1 = require("./withTimeoutHelpers"); | ||
/** | ||
* Проверяется полное совпадение списка, включая порядок колонок, порядок записей и количество записей | ||
* Учитывает порядок колонок | ||
* Учитывает порядок записей | ||
* Учитывает количество записей | ||
* | ||
Пусть в списке есть следующие записи: | ||
Пусть список выглядит следующим образом: | ||
| | Наименования_поля | Булево_поле | Поле_с_датой | | ||
@@ -31,3 +33,3 @@ | [ ] | Значение_1 | [ ] | 29.02.2024 | | ||
return __awaiter(this, void 0, void 0, function* () { | ||
const list = yield (0, list_steps_1.getList)(this); | ||
const list = yield (0, withTimeoutHelpers_1.getListWithTimeout)(this); | ||
const listData = (0, tableManager_1.getListData)(dataTable); | ||
@@ -39,2 +41,3 @@ yield expectExactlyMatchList(list, listData); | ||
return __awaiter(this, void 0, void 0, function* () { | ||
// Проверяем порядок колонок | ||
yield expectExactlyHeaderRow(list.getHeaderRow(), listData.getHeaderRow()); | ||
@@ -58,10 +61,4 @@ yield expectExacltyMatchRows(list, listData); | ||
throw "Количество записей не совпадает"; | ||
const headerRow = listData.getHeaderRow(); | ||
const notFoundRecords = yield (0, notFoundRecords_1.getNotFoundRecords)(records, list, (row) => { | ||
return (0, asyncArray_1.asyncMap)(headerRow, (column, i) => { | ||
return row.getCellByIndex(i).value(); | ||
}); | ||
}); | ||
(0, notFoundRecords_1.showNotFoundRecord)(notFoundRecords); | ||
yield (0, compareByRowsOrder_1.compareByRowsOrder)(list, listData); | ||
}); | ||
} |
@@ -14,7 +14,5 @@ "use strict"; | ||
const cucumber_1 = require("@cucumber/cucumber"); | ||
const setup_1 = require("../../../../../setup/setup"); | ||
const asyncArray_1 = require("../../../../utils/asyncArray"); | ||
const tableManager_1 = require("../../../../utils/tableManager"); | ||
const list_steps_1 = require("../../list.steps"); | ||
const notFoundRecords_1 = require("./notFoundRecords"); | ||
const withTimeoutHelpers_1 = require("./withTimeoutHelpers"); | ||
const compareByRowsOrder_1 = require("./compareByRowsOrder"); | ||
/** | ||
@@ -30,3 +28,3 @@ * Учитывает порядок записей | ||
*/ | ||
(0, cucumber_1.Given)("список содержит следующие записи:", { timeout: setup_1.config.largeTimeout }, function (dataTable) { | ||
(0, cucumber_1.Given)("список содержит следующие записи:", { timeout: -1 }, function (dataTable) { | ||
return __awaiter(this, void 0, void 0, function* () { | ||
@@ -46,3 +44,3 @@ yield listContainRecordsStep(this, dataTable); | ||
*/ | ||
(0, cucumber_1.Then)("список будет содержать следующие записи:", { timeout: setup_1.config.largeTimeout }, function (dataTable) { | ||
(0, cucumber_1.Then)("список будет содержать следующие записи:", { timeout: -1 }, function (dataTable) { | ||
return __awaiter(this, void 0, void 0, function* () { | ||
@@ -54,19 +52,7 @@ yield listContainRecordsStep(this, dataTable); | ||
return __awaiter(this, void 0, void 0, function* () { | ||
const list = yield (0, list_steps_1.getList)(page); | ||
const list = yield (0, withTimeoutHelpers_1.getListWithTimeout)(page); | ||
const listData = (0, tableManager_1.getListData)(dataTable); | ||
yield checkListContainsRecords(list, listData); | ||
yield (0, compareByRowsOrder_1.compareByRowsOrder)(list, listData); | ||
}); | ||
} | ||
exports.listContainRecordsStep = listContainRecordsStep; | ||
function checkListContainsRecords(list, listData) { | ||
return __awaiter(this, void 0, void 0, function* () { | ||
const headerRow = listData.getHeaderRow(); | ||
const columnIndexes = yield list.getColumnsIndexes(headerRow); | ||
const notFoundRecords = yield (0, notFoundRecords_1.getNotFoundRecords)(listData.getRecords(), list, (row) => { | ||
return (0, asyncArray_1.asyncMap)(headerRow, (column) => { | ||
return row.getCellByIndex(columnIndexes[column]).value(); | ||
}); | ||
}); | ||
(0, notFoundRecords_1.showNotFoundRecord)(notFoundRecords); | ||
}); | ||
} |
import { DataRow, MdtRecord } from "../../../../utils/tableManager"; | ||
import { List } from "../../list"; | ||
import { ColumnIndexes, List } from "../../list"; | ||
import { Row } from "../../row/row"; | ||
export declare function getNotFoundRecords(records: MdtRecord[], list: List, getRowData: (row: Row) => Promise<DataRow>): Promise<NotFoundRecord[]>; | ||
export declare function showNotFoundRecord(data: NotFoundRecord[]): void; | ||
export interface NotFoundRecord { | ||
n: number; | ||
export declare function getNotFoundRecords(records: MdtRecord[], list: List, columnIndexes: ColumnIndexes): Promise<NotFoundRecords>; | ||
export declare function waitForRow(options: { | ||
row: Row; | ||
record: MdtRecord; | ||
columnIndexes: ColumnIndexes; | ||
onRowNotFound: (details?: NotFoundRecordDetails) => void; | ||
}): Promise<void>; | ||
export declare function showNotFoundRecords(data: NotFoundRecords): void; | ||
export declare function notFoundDetailsMessage(details?: NotFoundRecordDetails): string; | ||
export type NotFoundRecords = Map<number, { | ||
row: DataRow; | ||
details?: NotFoundRecordDetails[]; | ||
} | ||
export interface NotFoundRecordDetails { | ||
fieldCode: string; | ||
details?: NotFoundRecordDetails; | ||
}>; | ||
export type NotFoundRecordDetails = Map<string, { | ||
expected: string; | ||
received: string; | ||
} | ||
}>; |
@@ -12,38 +12,25 @@ "use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.showNotFoundRecord = exports.getNotFoundRecords = void 0; | ||
const asyncArray_1 = require("../../../../utils/asyncArray"); | ||
const customMatchers_1 = require("../../../../utils/customMatchers"); | ||
exports.notFoundDetailsMessage = exports.showNotFoundRecords = exports.waitForRow = exports.getNotFoundRecords = void 0; | ||
const setup_1 = require("../../../../../setup/setup"); | ||
const numberAndIndex_1 = require("../../../../utils/numberAndIndex"); | ||
function getNotFoundRecords(records, list, getRowData) { | ||
function getNotFoundRecords(records, list, columnIndexes) { | ||
return __awaiter(this, void 0, void 0, function* () { | ||
const notFound = []; | ||
yield (0, asyncArray_1.asyncForEach)(records, (record, recordIndex) => __awaiter(this, void 0, void 0, function* () { | ||
const notFound = new Map(); | ||
const checkRecordPromises = []; | ||
for (const [recordIndex, record] of records.entries()) { | ||
const row = yield list.getRow((0, numberAndIndex_1.getNumberFromIndex)(recordIndex)); | ||
if (yield row.el.isHidden()) { | ||
notFound.push({ | ||
n: recordIndex + 1, | ||
row: Object.values(record) | ||
}); | ||
return; | ||
} | ||
const rowData = yield getRowData(row); | ||
const details = []; | ||
Object.entries(record).forEach(([key, expected], i) => { | ||
const received = rowData[i]; | ||
if ((0, customMatchers_1.areSoftEqual)(expected, received)) | ||
return; | ||
details.push({ | ||
fieldCode: key, | ||
expected, | ||
received | ||
}); | ||
}); | ||
if (details.length) { | ||
notFound.push({ | ||
n: recordIndex + 1, | ||
row: Object.values(record), | ||
details | ||
}); | ||
} | ||
})); | ||
const rowNumber = recordIndex + 1; | ||
checkRecordPromises.push(waitForRow({ | ||
row, | ||
record, | ||
columnIndexes, | ||
onRowNotFound: (details) => { | ||
notFound.set(rowNumber, { | ||
row: Object.values(record), | ||
details | ||
}); | ||
} | ||
})); | ||
} | ||
yield Promise.all(checkRecordPromises); | ||
return notFound; | ||
@@ -53,19 +40,56 @@ }); | ||
exports.getNotFoundRecords = getNotFoundRecords; | ||
function showNotFoundRecord(data) { | ||
if (data.length) | ||
throw buildErrorMessage(data); | ||
function waitForRow(options) { | ||
return __awaiter(this, void 0, void 0, function* () { | ||
const { row, record, columnIndexes, onRowNotFound } = options; | ||
const rejected = yield row.el.waitFor({ timeout: setup_1.config.timeout }).catch(() => { | ||
onRowNotFound(); | ||
return true; | ||
}); | ||
if (rejected) | ||
return; | ||
const details = new Map(); | ||
const fieldsCheckPromises = Object.entries(record).map(([column, expected], i) => { | ||
return (() => __awaiter(this, void 0, void 0, function* () { | ||
const cell = row.getCellByIndex(columnIndexes[column]); | ||
const rejected = yield cell.waitForValue(expected).catch(() => true); | ||
if (rejected) { | ||
const received = yield cell.value(); | ||
details.set(column, { | ||
expected, | ||
received | ||
}); | ||
} | ||
}))(); | ||
}); | ||
yield Promise.all(fieldsCheckPromises); | ||
if (details.size) { | ||
onRowNotFound(details); | ||
} | ||
}); | ||
} | ||
exports.showNotFoundRecord = showNotFoundRecord; | ||
function buildErrorMessage(data) { | ||
let result = `Не найдены следующие записи:`; | ||
data.forEach(({ n, row, details }) => { | ||
const recordString = row.map((v) => `${v} |`).join(" "); | ||
result += `\nЗапись №${n}: | ${recordString}`; | ||
if (details === null || details === void 0 ? void 0 : details.length) { | ||
details.forEach(({ fieldCode, expected, received }) => { | ||
result += `\n\t В поле "${fieldCode}" ожидалось "${expected || ""}" получено "${received || ""}"`; | ||
}); | ||
exports.waitForRow = waitForRow; | ||
function showNotFoundRecords(data) { | ||
if (data.size) { | ||
let result = `Не найдены следующие записи:`; | ||
for (const [n, { row, details }] of data.entries()) { | ||
const recordString = row.map((v) => `${v} |`).join(" "); | ||
result += `\nЗапись №${n}: | ${recordString}`; | ||
result += notFoundDetailsMessage(details); | ||
} | ||
}); | ||
throw result; | ||
} | ||
} | ||
exports.showNotFoundRecords = showNotFoundRecords; | ||
function notFoundDetailsMessage(details) { | ||
let result = ""; | ||
if ((details === null || details === void 0 ? void 0 : details.size) > 0) { | ||
for (const [fieldCode, { expected, received }] of details.entries()) { | ||
result += `\n\t ${notFoundFieldMessage(fieldCode, expected, received)}`; | ||
} | ||
} | ||
return result; | ||
} | ||
exports.notFoundDetailsMessage = notFoundDetailsMessage; | ||
function notFoundFieldMessage(fieldCode, expected, received) { | ||
`В поле "${fieldCode}" ожидалось "${expected || ""}" получено "${received || ""}"`; | ||
} |
@@ -14,6 +14,6 @@ "use strict"; | ||
const cucumber_1 = require("@cucumber/cucumber"); | ||
const asyncArray_1 = require("../../../../utils/asyncArray"); | ||
const tableManager_1 = require("../../../../utils/tableManager"); | ||
const list_steps_1 = require("../../list.steps"); | ||
const notFoundRecords_1 = require("./notFoundRecords"); | ||
const withTimeoutHelpers_1 = require("./withTimeoutHelpers"); | ||
const customWaitFor_1 = require("../../../../utils/customWaitFor"); | ||
/** | ||
@@ -30,3 +30,3 @@ * Проверяет что список содержит записи | ||
*/ | ||
(0, cucumber_1.Then)("список содержит следующие записи в любом порядке:", { timeout: 30000 }, function (dataTable) { | ||
(0, cucumber_1.Then)("список содержит следующие записи в любом порядке:", { timeout: -1 }, function (dataTable) { | ||
return __awaiter(this, void 0, void 0, function* () { | ||
@@ -38,20 +38,21 @@ yield softListCompareStep(this, dataTable); | ||
return __awaiter(this, void 0, void 0, function* () { | ||
const list = yield (0, list_steps_1.getList)(page); | ||
const list = yield (0, withTimeoutHelpers_1.getListWithTimeout)(page); | ||
const listData = (0, tableManager_1.getListData)(dataTable); | ||
const records = listData.getRecords(); | ||
const columnIndexes = yield list.getColumnsIndexes(listData.getHeaderRow()); | ||
const notFound = []; | ||
yield (0, asyncArray_1.asyncForEach)(records, (record, recordIndex) => __awaiter(this, void 0, void 0, function* () { | ||
const row = yield list.findSimilar(record, columnIndexes); | ||
if (row) | ||
return; | ||
notFound.push({ | ||
n: recordIndex + 1, | ||
row: Object.values(record) | ||
}); | ||
return; | ||
})); | ||
(0, notFoundRecords_1.showNotFoundRecord)(notFound); | ||
const notFound = new Map(); | ||
let promises = []; | ||
for (const [recordIndex, record] of records.entries()) { | ||
promises.push((0, customWaitFor_1.customWaitFor)(() => __awaiter(this, void 0, void 0, function* () { | ||
return !!(yield list.findSimilar(record, columnIndexes)); | ||
})).catch(() => { | ||
notFound.set(recordIndex + 1, { | ||
row: Object.values(record) | ||
}); | ||
})); | ||
} | ||
yield Promise.all(promises); | ||
(0, notFoundRecords_1.showNotFoundRecords)(notFound); | ||
}); | ||
} | ||
exports.softListCompareStep = softListCompareStep; |
@@ -1,3 +0,1 @@ | ||
import { ListData } from "../../../../utils/tableManager"; | ||
import { List } from "../../list"; | ||
export declare function strictListEquality(list: List, listData: ListData): Promise<void>; | ||
export {}; |
@@ -12,15 +12,12 @@ "use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.strictListEquality = void 0; | ||
const cucumber_1 = require("@cucumber/cucumber"); | ||
const tableManager_1 = require("../../../../utils/tableManager"); | ||
const list_steps_1 = require("../../list.steps"); | ||
const setup_1 = require("../../../../../setup/setup"); | ||
const headerCompare_steps_1 = require("../headerCompare.steps"); | ||
const notFoundRecords_1 = require("./notFoundRecords"); | ||
const compareByRowsOrder_1 = require("./compareByRowsOrder"); | ||
const withTimeoutHelpers_1 = require("./withTimeoutHelpers"); | ||
/** | ||
* Список из нескольких записей, можно указать колонку выбора записей | ||
* Учитывается порядок записей | ||
* Учитывается порядок колонок | ||
* Учитывает порядок колонок | ||
* | ||
* | ||
Пусть в списке есть следующие записи: | ||
@@ -32,11 +29,7 @@ | | Наименования_поля | Булево_поле | Поле_с_датой | | ||
*/ | ||
(0, cucumber_1.Given)("в списке есть следующие записи:", { timeout: setup_1.config.largeTimeout }, function (dataTable) { | ||
return __awaiter(this, void 0, void 0, function* () { | ||
const list = yield (0, list_steps_1.getList)(this); | ||
const listData = (0, tableManager_1.getListData)(dataTable); | ||
yield strictListEquality(list, listData); | ||
}); | ||
}); | ||
(0, cucumber_1.Given)("в списке есть следующие записи:", { timeout: -1 }, strictListEqualityStep); | ||
/** | ||
* Список из нескольких записей, можно указать колонку выбора записей | ||
* Учитывается порядок записей | ||
* Учитывает порядок колонок | ||
* | ||
@@ -49,11 +42,7 @@ Пусть в списке есть следующие записи: | ||
*/ | ||
(0, cucumber_1.Then)("в списке будут следующие записи:", { timeout: setup_1.config.largeTimeout }, function (dataTable) { | ||
(0, cucumber_1.Then)("в списке будут следующие записи:", { timeout: -1 }, strictListEqualityStep); | ||
function strictListEqualityStep(dataTable) { | ||
return __awaiter(this, void 0, void 0, function* () { | ||
const list = yield (0, list_steps_1.getList)(this); | ||
const list = yield (0, withTimeoutHelpers_1.getListWithTimeout)(this); | ||
const listData = (0, tableManager_1.getListData)(dataTable); | ||
yield strictListEquality(list, listData); | ||
}); | ||
}); | ||
function strictListEquality(list, listData) { | ||
return __awaiter(this, void 0, void 0, function* () { | ||
const options = { | ||
@@ -63,9 +52,4 @@ hasSelect: listData.hasSelectColumn() | ||
yield (0, headerCompare_steps_1.strictHeaderRowCompare)(list.getHeaderRow(), listData.getHeaderRow(), options); | ||
const records = listData.getRecords(); | ||
const notFoundRecords = yield (0, notFoundRecords_1.getNotFoundRecords)(records, list, (row) => { | ||
return row.cellsValue(options); | ||
}); | ||
(0, notFoundRecords_1.showNotFoundRecord)(notFoundRecords); | ||
yield (0, compareByRowsOrder_1.compareByRowsOrder)(list, listData); | ||
}); | ||
} | ||
exports.strictListEquality = strictListEquality; |
@@ -5,1 +5,6 @@ import { DataRow } from "../../../utils/tableManager"; | ||
export declare function strictHeaderRowCompare(headerRow: HeaderRow, listDataHeaderRow: DataRow, options?: ListExtraColumns): Promise<void>; | ||
/** | ||
* Возможные типы | ||
* Строка или boolean | ||
* | ||
*/ |
@@ -53,1 +53,6 @@ "use strict"; | ||
exports.strictHeaderRowCompare = strictHeaderRowCompare; | ||
/** | ||
* Возможные типы | ||
* Строка или boolean | ||
* | ||
*/ |
import { NaturalNumber } from "../../../utils/numberAndIndex"; | ||
import { DataRow, MdtRecord } from "../../../utils/tableManager"; | ||
import { DataRow, ListData } from "../../../utils/tableManager"; | ||
import { List, ListExtraColumns } from "../list"; | ||
import { Row } from "../row/row"; | ||
export declare function expectListRowData(list: List, row: MdtRecord, rowNumber: NaturalNumber): Promise<void>; | ||
export declare function expectListRowData(list: List, listData: ListData, rowNumber: NaturalNumber): Promise<void>; | ||
export declare function rowCompare(listRow: Row, listDataRow: DataRow, options?: ListExtraColumns): Promise<void>; |
@@ -19,2 +19,4 @@ "use strict"; | ||
const test_1 = require("@playwright/test"); | ||
const withTimeoutHelpers_1 = require("./compare/withTimeoutHelpers"); | ||
const notFoundRecords_1 = require("./compare/notFoundRecords"); | ||
/** | ||
@@ -29,3 +31,3 @@ То в списке запись №1 будет: | ||
const listData = (0, tableManager_1.getListData)(dataTable); | ||
yield expectListRowData(list, listData.getRecords()[0], rowNumber); | ||
yield expectListRowData(list, listData, rowNumber); | ||
}); | ||
@@ -49,8 +51,19 @@ }); | ||
}); | ||
function expectListRowData(list, row, rowNumber) { | ||
function expectListRowData(list, listData, rowNumber) { | ||
return __awaiter(this, void 0, void 0, function* () { | ||
const listHeaderRow = list.getHeaderRow(); | ||
const listRow = yield list.getRow(rowNumber); | ||
yield (0, headerCompare_steps_1.strictHeaderRowCompare)(listHeaderRow, Object.keys(row)); | ||
yield rowCompare(listRow, Object.values(row)); | ||
const record = listData.getRecords()[0]; | ||
const row = yield list.getRow(rowNumber); | ||
yield (0, headerCompare_steps_1.strictHeaderRowCompare)(listHeaderRow, Object.keys(record)); | ||
const columnIndexes = yield (0, withTimeoutHelpers_1.columnIndexesWithTimeout)(list, listData); | ||
yield (0, notFoundRecords_1.waitForRow)({ | ||
row, | ||
record, | ||
columnIndexes, | ||
onRowNotFound: (details) => { | ||
let result = "Запись не найдена."; | ||
result += (0, notFoundRecords_1.notFoundDetailsMessage)(details); | ||
throw result; | ||
} | ||
}); | ||
}); | ||
@@ -57,0 +70,0 @@ } |
@@ -18,3 +18,3 @@ "use strict"; | ||
const form_steps_1 = require("../form/form.steps"); | ||
const strictListCompare_steps_1 = require("../list/steps/compare/strictListCompare.steps"); | ||
const compareByRowsOrder_1 = require("../list/steps/compare/compareByRowsOrder"); | ||
(0, cucumber_1.Given)("открыто модальное окно {string}.", function (title) { | ||
@@ -149,3 +149,13 @@ return __awaiter(this, void 0, void 0, function* () { | ||
}); | ||
(0, cucumber_1.Then)("в модальном окне есть список:", function (dataTable) { | ||
/** | ||
* Учитывается порядок записей | ||
* Учитывает порядок колонок | ||
* | ||
Пусть в модальном окне есть список: | ||
| | Наименования_поля | Булево_поле | Поле_с_датой | | ||
| [ ] | Значение_1 | [ ] | 29.02.2024 | | ||
| [ ] | Значение_2 | [x] | {текущая дата} | | ||
| [ ] | Значение_3 | [-] | | | ||
*/ | ||
(0, cucumber_1.Then)("в модальном окне есть список:", { timeout: -1 }, function (dataTable) { | ||
return __awaiter(this, void 0, void 0, function* () { | ||
@@ -156,6 +166,16 @@ const list = yield this.getList({ | ||
yield list.isReady(); | ||
yield (0, strictListCompare_steps_1.strictListEquality)(list, (0, tableManager_1.getListData)(dataTable)); | ||
yield (0, compareByRowsOrder_1.compareByRowsOrder)(list, (0, tableManager_1.getListData)(dataTable)); | ||
}); | ||
}); | ||
(0, cucumber_1.Then)("в модальном окне есть список {string}:", function (listTitle, dataTable) { | ||
/** | ||
* Учитывается порядок записей | ||
* Учитывает порядок колонок | ||
* | ||
Пусть в модальном окне есть список: | ||
| | Наименования_поля | Булево_поле | Поле_с_датой | | ||
| [ ] | Значение_1 | [ ] | 29.02.2024 | | ||
| [ ] | Значение_2 | [x] | {текущая дата} | | ||
| [ ] | Значение_3 | [-] | | | ||
*/ | ||
(0, cucumber_1.Then)("в модальном окне есть список {string}:", { timeout: -1 }, function (listTitle, dataTable) { | ||
return __awaiter(this, void 0, void 0, function* () { | ||
@@ -167,3 +187,3 @@ const list = yield this.getList({ | ||
yield list.isReady(); | ||
yield (0, strictListCompare_steps_1.strictListEquality)(list, (0, tableManager_1.getListData)(dataTable)); | ||
yield (0, compareByRowsOrder_1.compareByRowsOrder)(list, (0, tableManager_1.getListData)(dataTable)); | ||
}); | ||
@@ -170,0 +190,0 @@ }); |
@@ -7,3 +7,3 @@ import { Page } from "../page"; | ||
} | ||
export declare type LeftNavPath = string[] | undefined; | ||
export type LeftNavPath = string[] | undefined; | ||
export declare class Runner { | ||
@@ -10,0 +10,0 @@ private page; |
@@ -7,2 +7,3 @@ import { Browser, BrowserContext, Page as CucumberPage, Locator } from "@playwright/test"; | ||
import { TopNav } from "./topNav/topNav"; | ||
import { Dropdown } from "./dropdown/dropdown"; | ||
import { ContainerType } from "../utils/contentManager"; | ||
@@ -16,3 +17,3 @@ import { ContentManager } from "../utils/contentManager"; | ||
import { TagMenu } from "./tag/tag"; | ||
declare type NavigationInokeFunction = () => Promise<void>; | ||
type NavigationInokeFunction = () => Promise<void>; | ||
declare global { | ||
@@ -34,3 +35,3 @@ var m: any; | ||
} | ||
declare type scenarioStateKeys = "gallery.imageData"; | ||
type scenarioStateKeys = "gallery.imageData"; | ||
export declare class Page extends CucumberWorld { | ||
@@ -46,6 +47,5 @@ cucumberPage: CucumberPage; | ||
constructor(options: any); | ||
waitForDownload(): Promise<import("playwright-core").Download>; | ||
waitForDownload(): Promise<import("@playwright/test").Download>; | ||
waitForLoading(): Promise<void>; | ||
private waitPendingRequests; | ||
private waitForLoadingIndicator; | ||
waitForLoadingIndicator(): Promise<void>; | ||
private getActiveContainer; | ||
@@ -73,5 +73,5 @@ getContent(): Content; | ||
get gallery(): import("./form/Field/fieldControls/gallery/gallery").Gallery; | ||
get dropdown(): import("./dropdown/dropdown").Dropdown; | ||
get dropdown(): Dropdown; | ||
previewImage(): Promise<boolean>; | ||
waitNavigationAfterInvoke(navigationInvokeFunction: NavigationInokeFunction): Promise<[import("playwright-core").Response, void]>; | ||
waitNavigationAfterInvoke(navigationInvokeFunction: NavigationInokeFunction): Promise<[import("@playwright/test").Response, void]>; | ||
selectFile(fileName: string, fileChooserOpen: () => Promise<void>): Promise<void>; | ||
@@ -78,0 +78,0 @@ initPage(page: CucumberPage, context: FeatureContext): Promise<void>; |
@@ -50,35 +50,5 @@ "use strict"; | ||
yield this.waitForLoadingIndicator(); | ||
yield this.waitPendingRequests(); | ||
clearTimeout(timeout); | ||
}); | ||
} | ||
waitPendingRequests() { | ||
return __awaiter(this, void 0, void 0, function* () { | ||
const navigationStarted = yield this.cucumberPage.evaluate(() => { | ||
let onNavigate; | ||
let interval; | ||
return new Promise((resolve) => { | ||
onNavigate = () => { | ||
clearInterval(interval); | ||
resolve(true); | ||
}; | ||
globalThis.navigation.addEventListener("navigate", onNavigate); | ||
interval = setInterval(() => { | ||
const pendingRequests = (m === null || m === void 0 ? void 0 : m.pendingRequests) || 0; | ||
if (pendingRequests == 0) | ||
resolve(false); | ||
}, 50); | ||
}).finally(() => { | ||
globalThis.navigation.removeEventListener("navigate", onNavigate); | ||
clearInterval(interval); | ||
}); | ||
}); | ||
if (navigationStarted) { | ||
yield this.cucumberPage.waitForNavigation({ | ||
waitUntil: "networkidle" | ||
}); | ||
yield (0, waitForAppLoad_1.waitForAppLoad)(this.cucumberPage); | ||
} | ||
}); | ||
} | ||
waitForLoadingIndicator() { | ||
@@ -236,3 +206,3 @@ return __awaiter(this, void 0, void 0, function* () { | ||
get dropdown() { | ||
return (0, dropdown_1.getDropdown)(this.zoneBottom); | ||
return new dropdown_1.Dropdown(this.zoneBottom); | ||
} | ||
@@ -239,0 +209,0 @@ previewImage() { |
@@ -15,3 +15,3 @@ "use strict"; | ||
const setup_1 = require("../../setup/setup"); | ||
const dateMatcher_1 = require("../utils/dateMatcher"); | ||
const dateMatcher_1 = require("../utils/date/dateMatcher/dateMatcher"); | ||
const userLogin_1 = require("../utils/userLogin"); | ||
@@ -18,0 +18,0 @@ const snapshots_1 = require("../utils/snapshots/snapshots"); |
@@ -38,4 +38,4 @@ "use strict"; | ||
const field = (0, field_1.getField)(this.form, fieldName); | ||
if (field.isExist()) | ||
return field; | ||
yield field.waitForExist(); | ||
return field; | ||
}); | ||
@@ -42,0 +42,0 @@ } |
@@ -17,2 +17,3 @@ "use strict"; | ||
const list_steps_1 = require("../list/list.steps"); | ||
const setup_1 = require("../../../setup/setup"); | ||
(0, cucumber_1.When)("на форме в меню тегов заполняем поле {string} значением {string}.", function (fieldName, value) { | ||
@@ -56,2 +57,3 @@ return __awaiter(this, void 0, void 0, function* () { | ||
const tag = field.tagMark; | ||
yield field.el.hover(); | ||
yield tag.click(); | ||
@@ -74,4 +76,3 @@ }); | ||
const tagMenu = yield this.getTagMenu(); | ||
const count = yield tagMenu.tagsCount(); | ||
(0, test_1.expect)(count == 0).toBeTruthy(); | ||
yield (0, test_1.expect)(tagMenu.tag).toHaveCount(0); | ||
}); | ||
@@ -124,5 +125,3 @@ }); | ||
const tagMenu = yield this.getTagMenu(); | ||
yield tagMenu.tag.waitFor(); | ||
const tagsCount = yield tagMenu.tagsCount(); | ||
(0, test_1.expect)(tagsCount).toBe(count); | ||
yield (0, test_1.expect)(tagMenu.tag).toHaveCount(count); | ||
}); | ||
@@ -197,10 +196,7 @@ }); | ||
}); | ||
(0, cucumber_1.Then)(/^на форме в меню тегов (-?\d+) тег[ов|а]*\./, function (count) { | ||
(0, cucumber_1.Then)(/^на форме в меню тегов (-?\d+) тег[ов|а]*\./, { timeout: setup_1.config.largeTimeout }, function (count) { | ||
return __awaiter(this, void 0, void 0, function* () { | ||
const form = yield (0, form_steps_1.getForm)(this); | ||
const tagMenu = yield form.getTagMenu(); | ||
if (count > 0) | ||
yield tagMenu.getTag(1).el.waitFor(); | ||
const tagsCount = yield tagMenu.tagsCount(); | ||
(0, test_1.expect)(tagsCount).toBe(count); | ||
yield (0, test_1.expect)(tagMenu.tag).toHaveCount(count); | ||
}); | ||
@@ -207,0 +203,0 @@ }); |
@@ -102,2 +102,3 @@ "use strict"; | ||
}); | ||
const nodeActiveClass = /active/; | ||
function nodeWasOpen(page, nodePath) { | ||
@@ -110,9 +111,9 @@ return __awaiter(this, void 0, void 0, function* () { | ||
let nodeTitle = pathList.takeNext(); | ||
(0, test_1.expect)(yield page.header.appsTitle.textContent()).toBe(nodeTitle); | ||
yield (0, test_1.expect)(page.header.appsTitle).toHaveText(nodeTitle); | ||
if (nodeTitle == ADMIN_NODE_TITLE) { | ||
(0, test_1.expect)(page.header.admin).toHaveClass(/active/); | ||
yield (0, test_1.expect)(page.header.admin).toHaveClass(nodeActiveClass); | ||
} | ||
else { | ||
nodeTitle = pathList.takeNext(); | ||
yield (0, test_1.expect)(page.header.navItem(nodeTitle)).toHaveClass(/active/); | ||
yield (0, test_1.expect)(page.header.navItem(nodeTitle)).toHaveClass(nodeActiveClass); | ||
} | ||
@@ -122,3 +123,3 @@ } | ||
let nodeTitle = pathList.takeNext(); | ||
yield (0, test_1.expect)(page.header.navItem(nodeTitle)).toHaveClass(/active/); | ||
yield (0, test_1.expect)(page.header.navItem(nodeTitle)).toHaveClass(nodeActiveClass); | ||
} | ||
@@ -125,0 +126,0 @@ if (pathList.hasNext()) { |
"use strict"; | ||
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) { | ||
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); } | ||
return new (P || (P = Promise))(function (resolve, reject) { | ||
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } } | ||
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } } | ||
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); } | ||
step((generator = generator.apply(thisArg, _arguments || [])).next()); | ||
}); | ||
}; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
@@ -9,2 +18,3 @@ exports.TopNav = void 0; | ||
apps: "apps-button", | ||
appsTitle: "apps-title", | ||
userZone: "user-zone" | ||
@@ -20,4 +30,4 @@ }); | ||
this.logo = this.logoContainer.locator(".system-logo"); | ||
this.appsTitle = this.el.locator(`.nav a.apps-head-title[code="apps"]`); | ||
this.apps = this.el.locator(`${selectors.userZone} ${selectors.apps}`); | ||
this.appsTitle = this.el.locator(selectors.appsTitle); | ||
this.apps = this.el.locator(`${selectors.navbar} ${selectors.apps}`); | ||
this.admin = this.el.locator(`.navbar-right li[nav="adm"]`); | ||
@@ -30,5 +40,8 @@ this.user = this.el.locator(".navbar-right .user-button"); | ||
hasApps() { | ||
return this.apps.isVisible(); | ||
return __awaiter(this, void 0, void 0, function* () { | ||
yield this.el.waitFor(); | ||
return this.apps.isVisible(); | ||
}); | ||
} | ||
} | ||
exports.TopNav = TopNav; |
import type { IConfiguration } from "@cucumber/cucumber/lib/configuration/types"; | ||
import { DefineStepPattern, IDefineStepOptions, TestStepFunction } from "@cucumber/cucumber/lib/support_code_library_builder/types"; | ||
export declare type ICucumberConfig = Partial<IConfiguration>; | ||
export declare type IConfig = IConfigApp & IConfigBase; | ||
export type ICucumberConfig = Partial<IConfiguration>; | ||
export type IConfig = IConfigApp & IConfigBase; | ||
export interface IConfigApp { | ||
@@ -59,3 +59,3 @@ url: string; | ||
} | ||
export declare type IDebugMode = "disabled" | "browser" | "inspectTool"; | ||
export type IDebugMode = "disabled" | "browser" | "inspectTool"; | ||
export interface IDebugConfig { | ||
@@ -65,2 +65,2 @@ mode?: IDebugMode; | ||
} | ||
export declare type StepDefinition<PageObjectType> = (<WorldType = PageObjectType>(pattern: DefineStepPattern, code: TestStepFunction<WorldType>) => void) & (<WorldType_1 = PageObjectType>(pattern: DefineStepPattern, options: IDefineStepOptions, code: TestStepFunction<WorldType_1>) => void); | ||
export type StepDefinition<PageObjectType> = (<WorldType = PageObjectType>(pattern: DefineStepPattern, code: TestStepFunction<WorldType>) => void) & (<WorldType_1 = PageObjectType>(pattern: DefineStepPattern, options: IDefineStepOptions, code: TestStepFunction<WorldType_1>) => void); |
import { Index } from "./numberAndIndex"; | ||
declare type CallBackForEach<T> = (value: T, index: Index, collection?: T[]) => Promise<void>; | ||
type CallBackForEach<T> = (value: T, index: Index, collection?: T[]) => Promise<void>; | ||
export declare function asyncForEach<T>(elements: T[], cb: CallBackForEach<T>): Promise<void>; | ||
declare type CallBackFindIndex<T> = (value: T, index?: Index, collection?: T[]) => Promise<boolean>; | ||
type CallBackFindIndex<T> = (value: T, index?: Index, collection?: T[]) => Promise<boolean>; | ||
export declare function asyncFindIndex<T>(elements: T[], cb: CallBackFindIndex<T>): Promise<Index>; | ||
declare type CallBackMap<T, R> = (value: T, index?: number, collection?: T[]) => Promise<R>; | ||
type CallBackMap<T, R> = (value: T, index?: number, collection?: T[]) => Promise<R>; | ||
export declare function asyncMap<T, R>(elements: T[], cb: CallBackMap<T, R>): Promise<R[]>; | ||
declare type CallBackFilter<T> = (value: T, index?: number, collection?: T[]) => Promise<boolean>; | ||
type CallBackFilter<T> = (value: T, index?: number, collection?: T[]) => Promise<boolean>; | ||
export declare function asyncFilter<T>(elements: T[], cb: CallBackFilter<T>): Promise<T[]>; | ||
declare type CallBackSome<T> = (value: T, index?: number, collection?: T[]) => Promise<boolean>; | ||
type CallBackSome<T> = (value: T, index?: number, collection?: T[]) => Promise<boolean>; | ||
export declare function asyncSome<T>(elements: T[], cb: CallBackSome<T>): Promise<boolean>; | ||
declare type CallBackReduceRight<T, R> = (accumulator: T | R, value: T, index?: number, collection?: T[]) => Promise<T | R>; | ||
type CallBackReduceRight<T, R> = (accumulator: T | R, value: T, index?: number, collection?: T[]) => Promise<T | R>; | ||
export declare function asyncReduceRight<T, R>(elements: T[], cb: CallBackReduceRight<T, R>, initialValue?: R): Promise<T | R>; | ||
declare type CallBackReduce<T, R> = (accumulator: R, value: T, index?: number, collection?: T[]) => Promise<R>; | ||
type CallBackReduce<T, R> = (accumulator: R, value: T, index?: number, collection?: T[]) => Promise<R>; | ||
export declare function asyncReduce<T, R>(elements: T[], cb: CallBackReduce<T, R>, initialValue?: R): Promise<T | R>; | ||
declare type CallBackEvery<T> = (value: T, index?: number, collection?: T[]) => Promise<boolean>; | ||
type CallBackEvery<T> = (value: T, index?: number, collection?: T[]) => Promise<boolean>; | ||
export declare function asyncEvery<T>(elements: T[], cb: CallBackEvery<T>): Promise<boolean>; | ||
export {}; |
@@ -33,4 +33,4 @@ import { Locator } from "@playwright/test"; | ||
} | ||
export declare type ContainerType = Active["type"]; | ||
export declare type Active = { | ||
export type ContainerType = Active["type"]; | ||
export type Active = { | ||
type: "modal"; | ||
@@ -37,0 +37,0 @@ container: Modal; |
@@ -5,4 +5,5 @@ "use strict"; | ||
const test_1 = require("@playwright/test"); | ||
const dateFormat_1 = require("./dateFormat"); | ||
const dateMatcher_1 = require("./dateMatcher"); | ||
const dateFormat_1 = require("./date/dateFormat"); | ||
const dateMatcher_1 = require("./date/dateMatcher/dateMatcher"); | ||
const isDateAlias_1 = require("./date/isDateAlias"); | ||
function simplify(val) { | ||
@@ -30,3 +31,3 @@ var _a; | ||
val2 = parseIfDateEmptyMask(val2); | ||
if ((0, dateMatcher_1.isAlias)(val1) || (0, dateMatcher_1.isAlias)(val2)) { | ||
if ((0, isDateAlias_1.isDateOrDatimeAlias)(val1) || (0, isDateAlias_1.isDateOrDatimeAlias)(val2)) { | ||
return (0, dateMatcher_1.equalByDateAlias)(val1, val2); | ||
@@ -33,0 +34,0 @@ } |
@@ -28,3 +28,3 @@ "use strict"; | ||
}, timeout); | ||
const run = () => { | ||
const run = (timeout) => { | ||
searchTimeoutId = setTimeout(() => __awaiter(this, void 0, void 0, function* () { | ||
@@ -38,3 +38,3 @@ try { | ||
} | ||
run(); | ||
run(WAIT_FOR_INTERVAL_TIME); | ||
} | ||
@@ -47,7 +47,7 @@ catch (error) { | ||
} | ||
}), WAIT_FOR_INTERVAL_TIME); | ||
}), timeout); | ||
}; | ||
run(); | ||
run(0); | ||
}); | ||
} | ||
exports.customWaitFor = customWaitFor; |
@@ -5,9 +5,11 @@ "use strict"; | ||
function getDateFromAlias(val) { | ||
var _a; | ||
var _a, _b; | ||
const date = new Date(); | ||
const daysCount = (_a = val.match(/[1-9]{1,2}/)) === null || _a === void 0 ? void 0 : _a[0]; | ||
if (daysCount) | ||
date.setDate(date.getDate() + parseFloat(daysCount)); | ||
const sign = (_a = val.match(/[+-]/)) === null || _a === void 0 ? void 0 : _a[0]; | ||
const daysCount = (_b = val.match(/[1-9]{1,2}/)) === null || _b === void 0 ? void 0 : _b[0]; | ||
if (sign && daysCount) { | ||
date.setDate(date.getDate() + parseFloat(`${sign}${daysCount}`)); | ||
} | ||
return date; | ||
} | ||
exports.getDateFromAlias = getDateFromAlias; |
export declare function isDateOrDatimeAlias(val: any): val is DateOrDateTimeAlias; | ||
export declare function isDateAlias(val: any): val is DateOrDateTimeAlias; | ||
export declare function isDateTimeAlias(val: any): val is DateOrDateTimeAlias; | ||
export declare type DateOrDateTimeAlias = string; | ||
export type DateOrDateTimeAlias = string; |
@@ -10,3 +10,3 @@ "use strict"; | ||
var _a; | ||
const dateAliasReg = /^({текущая дата}|{текущая дата \+ [1-9]{1,2} дней})$/; | ||
const dateAliasReg = /^({текущая дата}|{текущая дата [\+\-] [1-9]{1,2} дней})$/; | ||
return typeof val == "string" && !!((_a = val.match(dateAliasReg)) === null || _a === void 0 ? void 0 : _a[0]); | ||
@@ -17,5 +17,5 @@ } | ||
var _a; | ||
const dateAliasReg = /^({текущая дата и время}|{текущая дата \+ [1-9]{1,2} дней и время})$/; | ||
const dateAliasReg = /^({текущая дата и время}|{текущая дата [\+\-] [1-9]{1,2} дней и время})$/; | ||
return typeof val == "string" && !!((_a = val.match(dateAliasReg)) === null || _a === void 0 ? void 0 : _a[0]); | ||
} | ||
exports.isDateTimeAlias = isDateTimeAlias; |
@@ -1,2 +0,2 @@ | ||
declare type AnyObject = { | ||
type AnyObject = { | ||
[k: string]: any; | ||
@@ -3,0 +3,0 @@ }; |
@@ -11,3 +11,3 @@ import { Page } from "../pageObject/page"; | ||
declare const languageManager: LanguageManagerClass; | ||
export declare type LangManager = LanguageManagerClass; | ||
export type LangManager = LanguageManagerClass; | ||
export default languageManager; |
@@ -5,3 +5,3 @@ /** | ||
*/ | ||
export declare type NaturalNumber = number; | ||
export type NaturalNumber = number; | ||
/** | ||
@@ -11,3 +11,3 @@ * Индекс элемента. | ||
*/ | ||
export declare type Index = number; | ||
export type Index = number; | ||
/** | ||
@@ -14,0 +14,0 @@ * Индекс элемента. |
import { DataTable } from "@cucumber/cucumber"; | ||
import { NaturalNumber } from "./numberAndIndex"; | ||
export declare type MdtRecord = Record<string, string>; | ||
export declare type DataRow = string[]; | ||
export type MdtRecord = Record<string, string>; | ||
export type DataRow = string[]; | ||
/** | ||
@@ -6,0 +6,0 @@ * | Значение 1 | Значение 2 | Значение 3 | |
{ | ||
"name": "mdt-e2e-dev", | ||
"version": "31.3.1", | ||
"version": "31.4.0", | ||
"main": "lib/src/api/module", | ||
@@ -5,0 +5,0 @@ "scripts": { |
1042428
583
23069