diff --git a/tests/features/common-tools/common-consts.js b/tests/features/common-tools/common-consts.js index 9bb10f8560..ca180a98be 100644 --- a/tests/features/common-tools/common-consts.js +++ b/tests/features/common-tools/common-consts.js @@ -17,7 +17,7 @@ illegal under applicable law, and the grant of the foregoing license under the Apache 2.0 license is conditioned upon your compliance with such restriction. */ -module.exports = { +export default { Project: { Create_New_Options: [ 'Batch run', diff --git a/tests/features/common-tools/common-tools.js b/tests/features/common-tools/common-tools.js index 4383c2891f..7346e0f43d 100644 --- a/tests/features/common-tools/common-tools.js +++ b/tests/features/common-tools/common-tools.js @@ -28,19 +28,19 @@ import { deleteAPISchedule } from '../common/actions/api.actions' -module.exports = { - locatorBuilder: function (strings, ...keys) { - return function (...values) { - const dict = values[values.length - 1] || {} - const result = [strings[0]] - keys.forEach(function (key, i) { - const value = Number.isInteger(key) ? values[key] : dict[key] - result.push(value, strings[i + 1]) - }) - return result.join('') - } - }, - generateInputGroup: function ( +export function locatorBuilder(strings, ...keys) { + return function (...values) { + const dict = values[values.length - 1] || {} + const result = [strings[0]] + keys.forEach(function (key, i) { + const value = Number.isInteger(key) ? values[key] : dict[key] + result.push(value, strings[i + 1]) + }) + return result.join('') + } +} + +export function generateInputGroup ( root, label = false, hint = false, @@ -62,8 +62,9 @@ module.exports = { } return structure - }, - generateNumberInputGroup: function ( + } + +export function generateNumberInputGroup ( root, incDecBtn = false, label = false, @@ -91,8 +92,9 @@ module.exports = { } return structure - }, - generateLabelGroup: function (root, label = false, hintButton = false, hint = false) { + } + +export function generateLabelGroup (root, label = false, hintButton = false, hint = false) { const structure = { elements: {} } structure.root = root @@ -108,8 +110,9 @@ module.exports = { } return structure - }, - generateDropdownGroup: function ( + } + +export function generateDropdownGroup ( root, open_button = false, options = false, @@ -129,8 +132,9 @@ module.exports = { structure.optionsInRoot = options_in_root return structure - }, - generateCheckboxGroup: function (root, checkbox, name, icon) { + } + +export function generateCheckboxGroup (root, checkbox, name, icon) { const structure = { root, elements: {} } structure.elements.checkbox = checkbox ? 'svg[class]' : '' @@ -140,8 +144,9 @@ module.exports = { structure.elements.icon = icon ? 'svg:not([class])' : '' return structure - }, - generateTextAreaGroup: function (root, counter = '.form-field__counter') { + } + +export function generateTextAreaGroup (root, counter = '.form-field__counter') { return { root, elements: { @@ -152,8 +157,9 @@ module.exports = { counter } } - }, - parseString: function (string) { + } + +export function parseString (string) { const rulesArray = string.split('\n') const lengthRule = getLength(rulesArray) const validCharactersRule = getRule(rulesArray, 'valid characters') @@ -172,8 +178,9 @@ module.exports = { notStartWith, notConsecutiveCharacters ) - }, - clearBackendAfterTest: function (driver, items) { + } + +export function clearBackendAfterTest (driver, items) { items.forEach(item => { switch (item.type) { case 'project': @@ -194,15 +201,15 @@ module.exports = { return null } }) - }, - setRequestsFailureCondition: async shouldFail => { - try { - const response = await axios.post('http://localhost:30000/set-failure-condition', { - shouldFail - }) - console.log(response.data) - } catch (error) { - console.error(`Error setting failure condition: ${error}`) - } + } + +export async function setRequestsFailureCondition(shouldFail) { + try { + const response = await axios.post('http://localhost:30000/set-failure-condition', { + shouldFail + }) + console.log(response.data) + } catch (error) { + console.error(`Error setting failure condition: ${error}`) } } diff --git a/tests/features/common-tools/utils.js b/tests/features/common-tools/utils.js index 8f8dfb88c1..53b3aeeaf4 100644 --- a/tests/features/common-tools/utils.js +++ b/tests/features/common-tools/utils.js @@ -17,7 +17,7 @@ illegal under applicable law, and the grant of the foregoing license under the Apache 2.0 license is conditioned upon your compliance with such restriction. */ -const RandExp = require('randexp') +import RandExp from 'randexp' // const rules = `• Valid characters: A-Z, a-z, 0-9, -, _, .\n // • Must begin and end with: A-Z, a-z, 0-9\n diff --git a/tests/features/common/actions/action-menu.action.js b/tests/features/common/actions/action-menu.action.js index 92d5320159..a3356dcb0c 100644 --- a/tests/features/common/actions/action-menu.action.js +++ b/tests/features/common/actions/action-menu.action.js @@ -26,14 +26,14 @@ async function getOptionValues(driver, options) { }) } -const action = { - openActionMenu: async function(driver, actionMenu) { +export const openActionMenu = async (driver, actionMenu) => { const element = await driver.findElement(actionMenu.open_button) if (element) { element.click() } - }, - selectOptionInActionMenu: async function(driver, actionMenu, option) { + } + +export const selectOptionInActionMenu = async (driver, actionMenu, option) => { const elements = await driver.findElements(actionMenu.options) for (const element of elements) { element.getText().then(txt => { @@ -42,8 +42,9 @@ const action = { } }) } - }, - checkActionMenuOptions: async function(driver, actionMenu, values) { + } + +export const checkActionMenuOptions = async (driver, actionMenu, values) => { const options = await getOptionValues(driver, actionMenu.options) if (options.length === values.length){ @@ -54,8 +55,9 @@ const action = { expect(options.length).equal(values.length, `Actual options in action menu [${options}] don't match with expected values [${values}]`) } - }, - verifyOptionInActionMenuEnabled: async function(driver, actionMenu, option){ + } + +export const verifyOptionInActionMenuEnabled = async (driver, actionMenu, option) => { const elements = await driver.findElements(actionMenu.options) for (const element of elements) { const attributes = await element.getAttribute('class') @@ -66,8 +68,9 @@ const action = { expect(flag).to.equal(false) } } - }, - verifyOptionInActionMenuDisabled: async function(driver, actionMenu, option){ + } + +export const verifyOptionInActionMenuDisabled = async (driver, actionMenu, option) => { const elements = await driver.findElements(actionMenu.options) for (const element of elements) { const attributes = await element.getAttribute('class') @@ -79,6 +82,3 @@ const action = { } } } -} - -module.exports = action diff --git a/tests/features/common/actions/api.actions.js b/tests/features/common/actions/api.actions.js index db7914c241..1769c01669 100644 --- a/tests/features/common/actions/api.actions.js +++ b/tests/features/common/actions/api.actions.js @@ -53,13 +53,12 @@ const newJobTemplate = { } } -const action = { - deleteAPIMLProject: async function( +export const deleteAPIMLProject = async ( driver, mlProjectName, expectedStatusCode, deleteNonEmpty = false - ) { + ) => { await driver.sleep(1000) await mainHttpClient .delete( @@ -75,7 +74,7 @@ const action = { }) .catch(error => { if (error.response?.status === 412) { - action.deleteAPIMLProject( + deleteAPIMLProject( driver, mlProjectName, expectedStatusCode, @@ -83,12 +82,13 @@ const action = { ) } }) - }, - deleteAPIFeatureSet: async function( + } + +export const deleteAPIFeatureSet = async ( projectName, featureSetName, expectedStatusCode - ) { + ) => { await mainHttpClient .delete( `${REACT_APP_MLRUN_API_URL}/projects/${projectName}/feature-sets/${featureSetName}` @@ -96,12 +96,13 @@ const action = { .then(res => { expect(res.status).equal(expectedStatusCode) }) - }, - deleteAPIFeatureVector: async function( + } + +export const deleteAPIFeatureVector = async ( projectName, featureVectorName, expectedStatusCode - ) { + ) => { await mainHttpClient .delete( `${REACT_APP_MLRUN_API_URL}/projects/${projectName}/feature-vectors/${featureVectorName}` @@ -109,12 +110,13 @@ const action = { .then(res => { expect(res.status).equal(expectedStatusCode) }) - }, - deleteAPIFunction: async function( + } + +export const deleteAPIFunction = async ( projectName, functionName, expectedStatusCode - ) { + ) => { await mainHttpClient .delete( `${REACT_APP_MLRUN_API_URL_V2}/projects/${projectName}/functions/${functionName}` @@ -122,12 +124,13 @@ const action = { .then(res => { expect(res.status).equal(expectedStatusCode) }) - }, - deleteAPISchedule: async function( + } + +export const deleteAPISchedule = async ( projectName, scheduleName, expectedStatusCode - ) { + ) => { await mainHttpClient .delete( `${REACT_APP_MLRUN_API_URL}/projects/${projectName}/schedules/${scheduleName}` @@ -135,12 +138,13 @@ const action = { .then(res => { expect(res.status).equal(expectedStatusCode) }) - }, - deleteAPIArtifact: async function( + } + +export const deleteAPIArtifact = async ( projectName, artifactName, expectedStatusCode - ) { + ) => { await mainHttpClient .delete( `${REACT_APP_MLRUN_API_URL}/artifacts?project=${projectName}&name=${artifactName}` @@ -148,8 +152,9 @@ const action = { .then(res => { expect(res.status).equal(expectedStatusCode) }) - }, - createAPIMLProject: async function(mlProjectName, expectedStatusCode) { + } + +export const createAPIMLProject = async (mlProjectName, expectedStatusCode) => { const project_data = { metadata: { name: mlProjectName @@ -164,13 +169,13 @@ const action = { .then(res => { expect(res.status).equal(expectedStatusCode) }) - }, + } - createAPISchedule: async function( +export const createAPISchedule = async ( mlProjectName, mlScheduleName, expectedStatusCode - ) { + ) => { const data = newJobTemplate data.task.metadata.name = mlScheduleName data.task.metadata.project = mlProjectName @@ -180,14 +185,15 @@ const action = { .then(res => { expect(res.status).equal(expectedStatusCode) }) - }, - createAPIFunction: async function( + } + +export const createAPIFunction = async ( mlProjectName, mlFunctionKind, mlFunctionTag, mlFunctionName, expectedStatusCode - ) { + ) => { const data = { kind: mlFunctionKind, metadata: { @@ -216,12 +222,13 @@ const action = { .then(res => { expect(res.status).equal(expectedStatusCode) }) - }, - createAPIFeatureSet: async function( + } + +export const createAPIFeatureSet = async ( mlProjectName, mlFeatureSetName, expectedStatusCode - ) { + ) => { const data = { kind: 'FeatureSet', metadata: { @@ -244,12 +251,13 @@ const action = { .then(res => { expect(res.status).equal(expectedStatusCode) }) - }, - createAPIFeatureVector: async function( + } + +export const createAPIFeatureVector = async ( mlProjectName, mlFeatureVectorName, expectedStatusCode - ) { + ) => { const data = { kind: 'FeatureVector', metadata: { @@ -270,19 +278,16 @@ const action = { .then(res => { expect(res.status).equal(expectedStatusCode) }) - }, - createAPIArtifact: async function( + } + +export const createAPIArtifact = async ( mlProjectName, mlArtifactName, mlArtifactTag, mlArtifactType, expectedStatusCode - ) { + ) => { const uid = uuidv4() - //TODO: description ML-4583 - // const data = { - // description: '', - // } const data = { kind: mlArtifactType === 'file' ? '' : mlArtifactType, @@ -332,14 +337,10 @@ const action = { .then(res => { expect(res.status).equal(expectedStatusCode) }) - }, - getProjects: () => { - return mainHttpClient - .get(`${REACT_APP_MLRUN_API_URL}/projects`) - .then(res => { - return res.data.projects - }) } -} -module.exports = action +export const getProjects = async () => { + const res = await mainHttpClient.get(`${REACT_APP_MLRUN_API_URL}/projects`) + + return res.data.projects + } diff --git a/tests/features/common/actions/checkbox.action.js b/tests/features/common/actions/checkbox.action.js index aceab8a507..35346dfe55 100644 --- a/tests/features/common/actions/checkbox.action.js +++ b/tests/features/common/actions/checkbox.action.js @@ -19,41 +19,42 @@ such restriction. */ import { expect } from 'chai' -const action = { - isCheckboxChecked: async function(driver, checkbox) { +export const isCheckboxChecked = async (driver, checkbox) => { const checkboxElement = await driver.findElement(checkbox['checkbox']) const classes = await checkboxElement.getAttribute('class') expect(classes.includes('unchecked')).equal(false) - }, - isCheckboxUnchecked: async function(driver, checkbox) { + } + +export const isCheckboxUnchecked = async (driver, checkbox) => { const checkboxElement = await driver.findElement(checkbox['checkbox']) const classes = await checkboxElement.getAttribute('class') expect(classes.includes('unchecked')).equal(true) - }, - checkCheckbox: async function(driver, checkbox) { + } + +export const checkCheckbox = async (driver, checkbox) => { const checkboxElement = await driver.findElement(checkbox['checkbox']) const classes = await checkboxElement.getAttribute('class') if (classes.includes('unchecked')) { await checkboxElement.click() } - }, - uncheckCheckbox: async function(driver, checkbox) { + } + +export const uncheckCheckbox = async (driver, checkbox) => { const checkboxElement = await driver.findElement(checkbox['checkbox']) const classes = await checkboxElement.getAttribute('class') if (!classes.includes('unchecked')) { await checkboxElement.click() } - }, - verifyCheckboxEnabled: async function(driver, component) { + } + +export const verifyCheckboxEnabled = async (driver, component) => { const element = await driver.findElement(component) const flag = await element.getAttribute('class') expect(flag).equal('checkbox') - }, - verifyCheckboxDisabled: async function(driver, component) { + } + +export const verifyCheckboxDisabled = async (driver, component) => { const element = await driver.findElement(component) const flag = await element.getAttribute('class') expect(flag).equal('checkbox checkbox_disabled') } -} - -module.exports = action diff --git a/tests/features/common/actions/common.action.js b/tests/features/common/actions/common.action.js index a9b2dd96d8..b076d146f8 100644 --- a/tests/features/common/actions/common.action.js +++ b/tests/features/common/actions/common.action.js @@ -21,16 +21,10 @@ import { timeout } from '../../../config' import { until } from 'selenium-webdriver' import { expect } from 'chai' import { access, constants } from 'fs' -const path = require('path') -const os = require('os') +import path from 'path' +import os from 'os' -async function scrollToWebElement(driver, element) { - await driver.executeScript('arguments[0].scrollIntoView()', element) - await driver.sleep(250) -} - -const action = { - generatePath: async function(file, downloadsFolder){ +export const generatePath = async (file, downloadsFolder) => { const homeDirectory = os.homedir() // Define the path to the Downloads folder @@ -38,41 +32,50 @@ const action = { // Specify the full path to the file return path.join(downloadsFolderPath, file) - }, - determineFileAccess: async function(finalPath, file){ + } + +export const determineFileAccess = async (finalPath, file) => { access(finalPath, constants.F_OK, (err) => { const result = err ? `${file} doesn't exist` : true expect(result).equal(true) }) - }, - navigateToPage: async function(driver, baseURL) { + } + +export const navigateToPage = async (driver, baseURL) => { await driver.get(baseURL) await driver.sleep(1000) - }, - navigateForward: async function(driver) { + } + +export const navigateForward = async (driver) => { await driver.navigate().forward() - }, - navigateBack: async function(driver) { + } + +export const navigateBack = async (driver) => { await driver.navigate().back() - }, - refreshPage: async function(driver) { + } + +export const refreshPage = async (driver) => { await driver.navigate().refresh() - }, - waitPageLoad: async function(driver, loader) { + } + +export const waitPageLoad = async (driver, loader) => { await driver.wait(async function(driver) { const found = await driver.findElements(loader) return found.length === 0 }) - }, - waiteUntilComponent: async function(driver, component) { + } + +export const waiteUntilComponent = async (driver, component) => { await driver.wait(until.elementLocated(component), timeout) - }, - clickOnComponent: async function(driver, component) { + } + +export const clickOnComponent = async (driver, component) => { const element = await driver.findElement(component) await driver.sleep(250) await element.click() - }, - clickNearComponent: async function(driver, component) { + } + +export const clickNearComponent = async (driver, component) => { const element = await driver.findElement(component) const coordinates = await element.getRect() const actions = driver.actions({ async: true }) @@ -80,8 +83,9 @@ const action = { .move({ x: parseInt(coordinates.x) + 1, y: parseInt(coordinates.y) + 1 }) .click() .perform() - }, - hoverComponent: async function(driver, component, scroll = true) { + } + +export const hoverComponent = async (driver, component, scroll = true) => { const baseComponent = component.root ? component.root : component const element = await driver.findElement(baseComponent) if (scroll) { @@ -93,66 +97,78 @@ const action = { .move({ x: parseInt(coordinates.x), y: parseInt(coordinates.y) }) .perform() await driver.sleep(250) - }, - verifyClassDisabled: async function (driver, component) { + } + +export const verifyClassDisabled = async (driver, component) => { const inputField = await driver.findElement(component) const attributes = await inputField.getAttribute('class') const flag = attributes.includes('form-field__wrapper-disabled') expect(flag).equal(true) - }, - verifyElementDisabled: async function(driver, component) { + } + +export const verifyElementDisabled = async (driver, component) => { const element = await driver.findElement(component) const flag = await element.getAttribute('disabled') expect(flag).equal('true') - }, - verifyElementEnabled: async function(driver, component) { + } + +export const verifyElementEnabled = async (driver, component) => { const element = await driver.findElement(component) const flag = await element.getAttribute('disabled') expect(flag).equal(null) - }, - verifyElementActive: async function(driver, component) { + } + +export const verifyElementActive = async (driver, component) => { const element = await driver.findElement(component) const flag = await element.getAttribute('class') expect(flag.includes('active')).equal(true) - }, - verifyElementNotActive: async function(driver, component) { + } + +export const verifyElementNotActive = async (driver, component) => { const element = await driver.findElement(component) const flag = await element.getAttribute('class') expect(flag.includes('false')).equal(true) - }, - componentIsPresent: async function(driver, component) { + } + +export const componentIsPresent = async (driver, component) => { const _component = component.root ?? component const elements = await driver.findElements(_component) expect(elements.length).above(0) - }, - componentIsNotPresent: async function(driver, component) { + } + +export const componentIsNotPresent = async (driver, component) => { const _component = component.root ?? component const elements = await driver.findElements(_component) expect(elements.length).equal(0) - }, - componentIsVisible: async function(driver, component) { + } + +export const componentIsVisible = async (driver, component) => { const _component = component.root ?? component const element = await driver.findElement(_component) const displayed = await element.isDisplayed() expect(displayed).equal(true) - }, - componentIsNotVisible: async function(driver, component) { + } + +export const componentIsNotVisible = async (driver, component) => { const _component = component.root ?? component const element = await driver.findElement(_component) await driver.sleep(250) const displayed = await element.isDisplayed() expect(displayed).equal(false) - }, - typeIntoInputField: async function(driver, component, value) { + } + +export const typeIntoInputField = async (driver, component, value) => { const element = await driver.findElement(component) return element.sendKeys(value) - }, - verifyTypedText: async function(driver, component, value) { + } + +export const verifyTypedText = async (driver, component, value) => { const element = await driver.findElement(component) const txt = await element.getAttribute('value') expect(txt).equal(value) - }, - verifyText: async function(driver, component, value) { + } + +export const verifyText = async (driver, component, value) => { const element = await driver.findElement(component) const txt = await element.getText('value') const arr = txt.split() @@ -168,94 +184,106 @@ const action = { `should be expected "${value}" but actual value "${txt}"` ) } - }, - verifyTextRegExp: async function(driver, component, regexp) { + } + +export const verifyTextRegExp = async (driver, component, regexp) => { const element = await driver.findElement(component) const txt = await element.getText('value') expect(true).equal(regexp.test(txt)) - }, - isComponentContainsAttributeValue: async function( + } + +export const isComponentContainsAttributeValue = async ( driver, component, attribute, value - ) { + ) => { const element = await driver.findElement(component) return (await element.getAttribute(attribute)) === value - }, - isComponentContainsClass: async function( + } + +export const isComponentContainsClass = async ( driver, component, className - ) { + ) => { const element = await driver.findElement(component) const classes = await element.getAttribute('class') expect(classes.includes(className)).equal(true) - }, - verifyComponentContainsAttributeValue: async function( + } + +export const verifyComponentContainsAttributeValue = async ( driver, component, attribute, value - ) { + ) => { const element = await driver.findElement(component) const attributes = await element.getAttribute(attribute) expect(attributes.includes(value)).equal( true, `Attribute "${value}" does not present in "${attribute}" values list "${attributes}"` ) - }, - verifyComponentNotContainsAttributeValue: async function( + } + +export const verifyComponentNotContainsAttributeValue = async ( driver, component, attribute, value - ) { + ) => { const element = await driver.findElement(component) const attributes = await element.getAttribute(attribute) expect(attributes.includes(value)).equal( false, `Attribute "${value}" does present in "${attribute}" values list "${attributes}"` ) - }, - collapseAccordionSection: async function(driver, collapseComponent) { + } + +export const collapseAccordionSection = async (driver, collapseComponent) => { const element = await driver.findElement(collapseComponent) const attributes = await element.getAttribute('class') const flag = attributes.includes('open') if (flag) { await element.click() } - }, - expandAccordionSection: async function(driver, collapseComponent) { + } + +export const expandAccordionSection = async (driver, collapseComponent) => { const element = await driver.findElement(collapseComponent) const attributes = await element.getAttribute('class') const flag = attributes.includes('open') if (!flag) { await element.click() } - }, - isAccordionSectionExpanded: async function(driver, collapseComponent) { + } + +export const isAccordionSectionExpanded = async (driver, collapseComponent) => { const element = await driver.findElement(collapseComponent) const attributes = await element.getAttribute('class') const flag = attributes.includes('open') expect(flag).equal(true) - }, - isAccordionSectionCollapsed: async function(driver, collapseComponent) { + } + +export const isAccordionSectionCollapsed = async (driver, collapseComponent) => { const element = await driver.findElement(collapseComponent) const attributes = await element.getAttribute('class') const flag = attributes.includes('open') expect(flag).equal(false) - }, - getElementText: async function(driver, component) { + } + +export const getElementText = async (driver, component) => { const element = await driver.findElement(component) return await element.getText('value') - }, - scrollToElement: async function(driver, component) { + } + +export const scrollToElement = async (driver, component) => { const element = await driver.findElement(component) await driver.executeScript('arguments[0].scrollIntoView()', element) await driver.sleep(250) - }, - checkComponentHintTextWithHover:async function (driver, component, hintComponent, text) { + } + +export const checkComponentHintTextWithHover = async (driver, component, hintComponent, text) => { const hintButton = await driver.findElement(component) const coordinates = await hintButton.getRect() const actions = driver.actions({ async: true }) @@ -267,13 +295,14 @@ const action = { const hintText = await hint.getText() expect(hintText).equal(text) - }, - putToTestContextElementValue: async function(driver, testContext, element, pageValue) { - const pageElement = await driver.findElement(element) + } +export const putToTestContextElementValue = async (driver, testContext, element, pageValue) => { + const pageElement = await driver.findElement(element) testContext[pageValue] = await pageElement.getText() - }, - scrollToWebElement -} - -module.exports = action + } + +export const scrollToWebElement = async (driver, element) => { + await driver.executeScript('arguments[0].scrollIntoView()', element) + await driver.sleep(250) + } diff --git a/tests/features/common/actions/date-picker.action.js b/tests/features/common/actions/date-picker.action.js index d589cbc741..5b0e75d5ed 100644 --- a/tests/features/common/actions/date-picker.action.js +++ b/tests/features/common/actions/date-picker.action.js @@ -87,8 +87,7 @@ async function setPickerTime(driver, dateTimePicker, datetimePoint) { await timeInput.sendKeys(timeString) } -const action = { - verifyTimeFilterBand: async function(driver, dropdown, diff) { +export const verifyTimeFilterBand = async (driver, dropdown, diff) => { const selectedBand = await driver.findElement(dropdown.open_button) const datetimePointsText = await selectedBand.getAttribute('value') const datetimePoints = datetimePointsText.split('-') @@ -102,13 +101,14 @@ const action = { result = datetimeDiff - diff === 0 } expect(result).to.equal(true) - }, - pickUpCustomDatetimeRange: async function( + } + +export const pickUpCustomDatetimeRange = async ( driver, datetimePicker, fromDatetime, toDatetime - ) { + ) => { await selectMonthYear(driver, datetimePicker.fromDatePicker, fromDatetime) await selectCalendarDay(driver, datetimePicker.fromDatePicker, fromDatetime) await setPickerTime(driver, datetimePicker.fromDatePicker, fromDatetime) @@ -116,11 +116,10 @@ const action = { await selectMonthYear(driver, datetimePicker.toDatePicker, toDatetime) await selectCalendarDay(driver, datetimePicker.toDatePicker, toDatetime) await setPickerTime(driver, datetimePicker.toDatePicker, toDatetime) - }, - applyDatetimePickerRange: async function(driver, datetimePicker) { + } + +export const applyDatetimePickerRange = async (driver, datetimePicker) => { const applyButton = await driver.findElement(datetimePicker.applyButton) await applyButton.click() } -} - -module.exports = action + \ No newline at end of file diff --git a/tests/features/common/actions/dropdown.action.js b/tests/features/common/actions/dropdown.action.js index 3b3c36a2ee..5fadbb95a8 100644 --- a/tests/features/common/actions/dropdown.action.js +++ b/tests/features/common/actions/dropdown.action.js @@ -21,15 +21,13 @@ import { expect } from 'chai' import { differenceWith, isEqual } from 'lodash' import { clickNearComponent, scrollToWebElement } from './common.action' -async function getOptionValues(driver, options) { - return await driver.findElements(options).then(function(elements) { +export const getOptionValues = async (driver, options) => { + return await driver.findElements(options).then(function(elements) { return Promise.all(elements.map(element => element.getText())) - }) -} + }) + } -const action = { - getOptionValues: getOptionValues, - openDropdown: async function(driver, dropdown, scroll = true) { +export const openDropdown = async (driver, dropdown, scroll = true) => { const element = await driver.findElement(dropdown.open_button) if (scroll) { await scrollToWebElement(driver, element) @@ -38,13 +36,15 @@ const action = { await element.click() } await driver.sleep(1500) - }, - collapseDropdown: async function(driver, dropdown) { + } + +export const collapseDropdown = async (driver, dropdown) => { // const element = await driver.findElement(dropdown.root) await clickNearComponent(dropdown.root) await driver.sleep(100) - }, - selectOptionInDropdown: async function(driver, dropdown, option) { + } + +export const selectOptionInDropdown = async (driver, dropdown, option) => { const selectedElement = await driver.findElement(dropdown.open_button) const selectedText = await selectedElement.getText() if (selectedText !== option) { @@ -62,8 +62,9 @@ const action = { selectedElement.click() await driver.sleep(500) } - }, - selectOptionInDropdownWithoutCheck: async function(driver, dropdown, option) { + } + +export const selectOptionInDropdownWithoutCheck = async (driver, dropdown, option) => { const elements = await driver.findElements(dropdown.options) for (const element of elements) { const txt = await element.getText() @@ -73,23 +74,27 @@ const action = { break } } - }, - checkDropdownSelectedOption: async function(driver, dropdown, option) { + } + +export const checkDropdownSelectedOption = async (driver, dropdown, option) => { const element = await driver.findElement(dropdown.open_button) const txt = await element.getText() expect(txt).equal(option) - }, - checkDropdownSelectedOptionWithAttribute: async function(driver, dropdown, option) { + } + +export const checkDropdownSelectedOptionWithAttribute = async (driver, dropdown, option) => { const element = await driver.findElement(dropdown.open_button) const attributeTxt = await element.getAttribute('value') expect(attributeTxt).equal(option) - }, - checkDropdownOptions: async function(driver, dropdown, values) { + } + +export const checkDropdownOptions = async (driver, dropdown, values) => { const options = await getOptionValues(driver, dropdown.options) const diff = differenceWith(options, values, isEqual) expect(diff.length).equal(0, `Options difference: "${diff}"`) - }, - checkDropdownContainsOptions: async function(driver, dropdown, values) { + } + +export const checkDropdownContainsOptions = async (driver, dropdown, values) => { const options = await getOptionValues(driver, dropdown.options) let notPresent = [] for (let option of values) { @@ -108,6 +113,3 @@ const action = { '\n' ) } -} - -module.exports = action diff --git a/tests/features/common/actions/graph.action.js b/tests/features/common/actions/graph.action.js index 9312e01b7f..f544320c4f 100644 --- a/tests/features/common/actions/graph.action.js +++ b/tests/features/common/actions/graph.action.js @@ -39,8 +39,7 @@ function diffMapper(array0, array1, deviation) { return tmpDiff } -const action = { - checkNodesConnectionsNPandas: async function(driver, graphComponent) { +export const checkNodesConnectionsNPandas = async (driver, graphComponent) => { const nodesGeometry = await getNamedRowsGeometry( driver, graphComponent.nodesTable @@ -133,6 +132,3 @@ const action = { expect(numjs.sum(endMarks.slice([i]))).equal(true, 'Arrow not ended') } } -} - -module.exports = action diff --git a/tests/features/common/actions/input-group.action.js b/tests/features/common/actions/input-group.action.js index 6ac71c701b..47d6266b30 100644 --- a/tests/features/common/actions/input-group.action.js +++ b/tests/features/common/actions/input-group.action.js @@ -21,37 +21,44 @@ import { expect } from 'chai' import { Key } from 'selenium-webdriver' import { parseString } from '../../common-tools/common-tools' -async function verifyInputInvalid(driver, inputGroup) { - const inputField = await driver.findElement(inputGroup.inputField) +async function verifyFormInputInvalid(driver, inputGroup) { + const inputField = await driver.findElement(inputGroup.root) + await driver.sleep(500) const flag = await inputField.getAttribute('class') - await driver.sleep(500) - expect(flag.includes('invalid')).equal(true) + expect(flag.includes('form-field__wrapper-invalid')).equal(true) } -async function verifyFormInputInvalid(driver, inputGroup) { +async function verifyFormInputValid(driver, inputGroup) { const inputField = await driver.findElement(inputGroup.root) - await driver.sleep(500) const flag = await inputField.getAttribute('class') - expect(flag.includes('form-field__wrapper-invalid')).equal(true) + expect(flag.includes('form-field__wrapper-invalid')).equal(false) } -async function verifyInputValid(driver, inputGroup) { +async function getInputPlaceholder(driver, inputGroup) { + const inputField = await driver.findElement(inputGroup.inputField) + + return inputField.getAttribute('placeholder') +} + + +export const verifyInputInvalid = async (driver, inputGroup) => { const inputField = await driver.findElement(inputGroup.inputField) const flag = await inputField.getAttribute('class') - expect(flag.includes('invalid')).equal(false) + await driver.sleep(500) + expect(flag.includes('invalid')).equal(true) } -async function verifyFormInputValid(driver, inputGroup) { - const inputField = await driver.findElement(inputGroup.root) +export const verifyInputValid = async (driver, inputGroup) => { + const inputField = await driver.findElement(inputGroup.inputField) const flag = await inputField.getAttribute('class') - expect(flag.includes('form-field__wrapper-invalid')).equal(false) + expect(flag.includes('invalid')).equal(false) } -async function clearManually(inputField) { +export const clearManually = async (inputField) => { const existValue = await inputField.getAttribute('value') for (let i = 0; i <= existValue.length; i++) { @@ -59,47 +66,33 @@ async function clearManually(inputField) { } } -async function getInputValue(driver, inputGroup) { +export const getInputValue = async (driver, inputGroup) => { const inputField = await driver.findElement(inputGroup.inputField) return inputField.getAttribute('value') } -async function getInputPlaceholder(driver, inputGroup) { - const inputField = await driver.findElement(inputGroup.inputField) - - return inputField.getAttribute('placeholder') -} - -async function getInputValueWithoutInputgroup(driver, input) { +export const getInputValueWithoutInputgroup = async (driver, input) => { const inputField = await driver.findElement(input) return inputField.getAttribute('value') } -async function typeValue(driver, inputGroup, value) { +export const typeValue = async (driver, inputGroup, value) => { const inputField = await driver.findElement(inputGroup.inputField) await clearManually(inputField) return inputField.sendKeys(value) } -async function typeValueWithoutInputgroup(driver, input, value) { +export const typeValueWithoutInputgroup = async (driver, input, value) => { const inputField = await driver.findElement(input) await clearManually(inputField) return inputField.sendKeys(value) } -const action = { - clearManually, - getInputValue, - getInputValueWithoutInputgroup, - typeValue, - typeValueWithoutInputgroup, - verifyInputValid, - verifyInputInvalid, - checkHintText: async function (driver, inputGroup, hintComponent, text) { +export const checkHintText = async (driver, inputGroup, hintComponent, text) => { const hintButton = await driver.findElement(inputGroup.hintButton) await hintButton.click() await driver.sleep(250) @@ -107,8 +100,9 @@ const action = { const hintText = await hint.getText() expect(hintText).equal(text) - }, - checkHintTextWithHover:async function (driver, inputGroup, hintComponent, text) { + } + +export const checkHintTextWithHover = async (driver, inputGroup, hintComponent, text) => { const hintButton = await driver.findElement(inputGroup.hintButton) const coordinates = await hintButton.getRect() const actions = driver.actions({ async: true }) @@ -120,15 +114,16 @@ const action = { const hintText = await hint.getText() expect(hintText).equal(text) - }, - checkInputAccordingHintText: async function ( + } + +export const checkInputAccordingHintText = async ( driver, attach, inputGroup, hintComponent, isForm = false, isLabel = false - ) { + ) => { if (!isLabel){ const hintButton = await driver.findElement(inputGroup.hintButton) @@ -168,8 +163,9 @@ const action = { await clearManually(input) } - }, - checkWarningHintText: async function (driver, inputGroup, hintComponent, text) { + } + +export const checkWarningHintText = async (driver, inputGroup, hintComponent, text) => { const hintButton = await driver.findElement(inputGroup.warningHint) await driver.sleep(250) await hintButton.click() @@ -179,8 +175,9 @@ const action = { const hintText = await hint.getText() expect(hintText).equal(text) - }, - checkWarningHintTextWithHover: async function (driver, inputGroup, hintComponent, text) { + } + +export const checkWarningHintTextWithHover = async (driver, inputGroup, hintComponent, text) => { const hintButton = await driver.findElement(inputGroup.warningHint) await driver.sleep(250) const coordinates = await hintButton.getRect() @@ -194,56 +191,65 @@ const action = { const hintText = await hint.getText() expect(hintText).equal(text) - }, - checkWarningText: async function (driver, hintComponent, text) { + } + +export const checkWarningText = async (driver, hintComponent, text) => { const hint = await driver.findElement(hintComponent) await driver.sleep(250) const hintText = await hint.getText() expect(hintText).equal(text) - }, - verifyTypedValue: async function (driver, inputGroup, value) { + } + +export const verifyTypedValue = async (driver, inputGroup, value) => { const txt = await getInputValue(driver, inputGroup) expect(txt).equal(value) - }, - verifyPlaceholder: async function (driver, inputGroup, value) { + } + +export const verifyPlaceholder = async (driver, inputGroup, value) => { const txt = await getInputPlaceholder(driver, inputGroup) expect(txt).equal(value) - }, - verifyTypedValueWithoutInputgroup: async function (driver, input, value) { + } + +export const verifyTypedValueWithoutInputgroup = async (driver, input, value) => { const txt = await getInputValueWithoutInputgroup(driver, input) expect(txt).equal(value) - }, - verifyInputDisabled: async function (driver, inputGroup) { + } + +export const verifyInputDisabled = async (driver, inputGroup) => { const inputField = await driver.findElement(inputGroup.inputField) const flag = await inputField.getAttribute('disabled') expect(flag).equal('true') - }, - verifyInputClassDisabled: async function (driver, inputGroup) { + } + +export const verifyInputClassDisabled = async (driver, inputGroup) => { const inputField = await driver.findElement(inputGroup.root) const attributes = await inputField.getAttribute('class') const flag = attributes.includes('form-field__wrapper-disabled') expect(flag).equal(true) - }, - verifyInputClassEnabled: async function (driver, inputGroup) { + } + +export const verifyInputClassEnabled = async (driver, inputGroup) => { const inputField = await driver.findElement(inputGroup.inputField) const attributes = await inputField.getAttribute('class') const flag = attributes.includes('form-field__wrapper-disabled') expect(flag).equal(false) - }, - verifyInputEnabled: async function (driver, inputGroup) { + } + +export const verifyInputEnabled = async (driver, inputGroup) => { const inputField = await driver.findElement(inputGroup.inputField) const flag = await inputField.getAttribute('disabled') expect(flag).equal(null) - }, - verifyTextAreaCounter: async function (driver, textAreaGroup) { + } + +export const verifyTextAreaCounter = async (driver, textAreaGroup) => { const textAreaField = await driver.findElement(textAreaGroup.inputField) const textAreaText = await textAreaField.getText() const textAreaCounter = await driver.findElement(textAreaGroup.counter) @@ -252,6 +258,3 @@ const action = { expect(+counterValue.split(' ')[0]).equal(maxLength - textAreaText.length) } -} - -module.exports = action diff --git a/tests/features/common/actions/input-with-autocomplete.action.js b/tests/features/common/actions/input-with-autocomplete.action.js index c3be98a834..5a20fe1318 100644 --- a/tests/features/common/actions/input-with-autocomplete.action.js +++ b/tests/features/common/actions/input-with-autocomplete.action.js @@ -20,38 +20,37 @@ such restriction. import { expect } from 'chai' import { Key } from 'selenium-webdriver' -async function clearManually(inputField) { +export const clearManually = async (inputField) => { const existValue = await inputField.getAttribute('value') for (let i = 0; i <= existValue.length; i++) { await inputField.sendKeys(Key.BACK_SPACE, Key.DELETE) } } -async function getOptionValues(driver, options) { +export const getOptionValues = async (driver, options) => { return await driver.findElements(options).then(function(elements) { return Promise.all(elements.map(element => element.getText())) }) } -const action = { - clearManually, - getOptionValues: getOptionValues, - typeSearchableValue: async function(driver, inputGroup, value) { +export const typeSearchableValue = async (driver, inputGroup, value) => { const inputField = await driver.findElement(inputGroup.inputField) await clearManually(inputField) return await inputField.sendKeys(value) - }, - verifyTypedValue: async function(driver, inputGroup, value) { + } + +export const verifyTypedValue = async (driver, inputGroup, value) => { const inputField = await driver.findElement(inputGroup.inputField) const txt = await inputField.getAttribute('value') expect(txt).equal(value) - }, - isContainsSubstringInSuggestedOptions: async function( + } + +export const isContainsSubstringInSuggestedOptions = async ( driver, inputGroup, value, caseSensitive = false - ) { + ) => { let arr = await getOptionValues(driver, inputGroup.options) let tmpValue = value @@ -66,6 +65,3 @@ const action = { `Searcheble string "${tmpValue}" do not find in all values of: [${arr}]` ) } -} - -module.exports = action diff --git a/tests/features/common/actions/number-input-group.action.js b/tests/features/common/actions/number-input-group.action.js index 507ea3fa13..dbd61be189 100644 --- a/tests/features/common/actions/number-input-group.action.js +++ b/tests/features/common/actions/number-input-group.action.js @@ -17,21 +17,18 @@ illegal under applicable law, and the grant of the foregoing license under the Apache 2.0 license is conditioned upon your compliance with such restriction. */ -const action = { - incrementValue: async function(driver, inputGroup, value) { +export const incrementValue = async (driver, inputGroup, value) => { const inc_btn = await driver.findElement(inputGroup.inc_btn) for (let i = 0; i < value; i++) { await inc_btn.click() await driver.sleep(100) } - }, - decrementValue: async function(driver, inputGroup, value) { + } + +export const decrementValue = async (driver, inputGroup, value) => { const dec_btn = await driver.findElement(inputGroup.dec_btn) for (let i = 0; i < value; i++) { await dec_btn.click() await driver.sleep(100) } } -} - -module.exports = action diff --git a/tests/features/common/actions/radio-button.action.js b/tests/features/common/actions/radio-button.action.js index c7e7a67db1..fd78b55738 100644 --- a/tests/features/common/actions/radio-button.action.js +++ b/tests/features/common/actions/radio-button.action.js @@ -19,18 +19,19 @@ such restriction. */ import { expect } from 'chai' -const action = { - isRadioButtonSelected: async function(driver, radiobutton) { +export const isRadioButtonSelected = async (driver, radiobutton) => { const element = await driver.findElement(radiobutton['radiobutton']) const selected = await element.isSelected() expect(selected).equal(true) - }, - isRadioButtonUnselected: async function(driver, radiobutton) { + } + +export const isRadioButtonUnselected = async (driver, radiobutton) => { const element = await driver.findElement(radiobutton['radiobutton']) const selected = await element.isSelected() expect(selected).equal(false) - }, - selectRadiobutton: async function(driver, radiobutton) { + } + +export const selectRadiobutton = async (driver, radiobutton) => { const element = await driver.findElement(radiobutton['radiobutton']) const elementName = await driver.findElement(radiobutton['name']) const selected = await element.isSelected() @@ -38,6 +39,3 @@ const action = { await elementName.click() } } -} - -module.exports = action diff --git a/tests/features/common/actions/tab-selector.action.js b/tests/features/common/actions/tab-selector.action.js index fbeeaad2b1..01b55dda85 100644 --- a/tests/features/common/actions/tab-selector.action.js +++ b/tests/features/common/actions/tab-selector.action.js @@ -19,8 +19,7 @@ such restriction. */ import { expect } from 'chai' -const action = { - isTabActive: async function(driver, component, indx) { +export const isTabActive = async (driver, component, indx) => { const element1 = await driver.findElement(component.rowRoot(indx)) const element2 = await driver.findElement( component.tableFields['key'](indx) @@ -34,8 +33,9 @@ const action = { attributes2.includes('tabs-slider__tab_active')|| attributes2.includes('content-menu__tab_active') expect(flag).equal(true) - }, - isRowActive: async function(driver, component, indx) { + } + +export const isRowActive = async (driver, component, indx) => { const element = await driver.findElement(component.rowRoot(indx)) const attributes = await element.getAttribute('class') const flag = attributes.includes('row_active') @@ -46,6 +46,3 @@ const action = { expect(flag).equal(false) } } -} - -module.exports = action diff --git a/tests/features/common/actions/table.action.js b/tests/features/common/actions/table.action.js index 508ddb11cd..05d0003159 100644 --- a/tests/features/common/actions/table.action.js +++ b/tests/features/common/actions/table.action.js @@ -25,28 +25,27 @@ import { selectOptionInDropdownWithoutCheck } from './dropdown.action' import { getElementText, hoverComponent } from './common.action' - import { DataFrame } from 'pandas-js' -async function getColumnValues(driver, table, columnName) { +async function getColumnValuesAttribute(driver, table, columnName) { return await driver .findElements(table.tableColumns[columnName]) .then(function(elements) { - return Promise.all(elements.map(element => element.getText())) + return Promise.all(elements.map(element => element.getAttribute('value'))) }) } -async function getColumnValuesAttribute(driver, table, columnName) { +export const getColumnValues = async (driver, table, columnName) => { return await driver .findElements(table.tableColumns[columnName]) .then(function(elements) { - return Promise.all(elements.map(element => element.getAttribute('value'))) + return Promise.all(elements.map(element => element.getText())) }) } -async function getTableRows(driver, table) { +export const getTableRows = async (driver, table) => { const arr = await driver .findElements(table.tableColumns[table.tableCulumnNames[0]]) .then(function(elements) { @@ -56,23 +55,22 @@ async function getTableRows(driver, table) { return await arr.length } -const action = { - getColumnValues: getColumnValues, - getTableRows: getTableRows, - isContainsValueInColumn: async function(driver, table, columnName, value) { +export const isContainsValueInColumn = async (driver, table, columnName, value) => { const arr = await getColumnValues(driver, table, columnName) expect(arr.includes(value)).equal(true, `Column values [${arr}] is not equal with "${value}" `) - }, - isNotContainsValueInColumn: async function(driver, table, columnName, value) { + } + +export const isNotContainsValueInColumn = async (driver, table, columnName, value) => { const arr = await getColumnValues(driver, table, columnName) expect(arr.includes(value)).equal(false) - }, - isContainsSubstringInColumnCells: async function( + } + +export const isContainsSubstringInColumnCells = async ( driver, table, columnName, value - ) { + ) => { const arr = await getColumnValues(driver, table, columnName) const subString = value.replace('=', '\n:\n') expect(arr.length > 0).equal(true) @@ -80,39 +78,42 @@ const action = { true, `Value "${subString}" does not includes in all values: [${arr}]` ) - }, - isContainsSubstringInColumnAttributeCells: async function( + } + +export const isContainsSubstringInColumnAttributeCells = async ( driver, table, columnName, value - ) { + ) => { const arr = await getColumnValuesAttribute(driver, table, columnName) expect(arr.length > 0).equal(true) expect(arr.every(item => item.includes(value))).equal( true, `Value "${value}" does not includes in all values: [${arr}]` ) - }, - isContainsSubstringInColumnAttributeListCells: async function( + } + +export const isContainsSubstringInColumnAttributeListCells = async ( driver, table, columnName, value - ) { + ) => { const arr = await getColumnValuesAttribute(driver, table, columnName) expect(arr.length > 0).to.equal(true) expect(arr.every(item => value.includes(item))).to.equal( true, `Value "${value}" does not includes in all values: [${arr}]` ) - }, - isContainsSubstringInColumnDropdownCells: async function( + } + +export const isContainsSubstringInColumnDropdownCells = async ( driver, table, column, value - ) { + ) => { const subString = value.replace('=', '\n:\n') const rows = await getTableRows(driver, table) let flag = true @@ -135,14 +136,15 @@ const action = { } expect(flag).equal(true) - }, - isContainsSubstringInColumnDropdownCellsOverlay: async function( + } + +export const isContainsSubstringInColumnDropdownCellsOverlay = async ( driver, table, overlay, column, value - ) { + ) => { const subString = value.replace('=', '\n:\n') const rows = await getTableRows(driver, table) let flag = true @@ -165,13 +167,14 @@ const action = { } expect(flag).equal(true) - }, - isContainsSubstringInColumnTooltipCells: async function( + } + +export const isContainsSubstringInColumnTooltipCells = async ( driver, table, column, value - ) { + ) => { const rows = await getTableRows(driver, table) expect(rows).not.equal(0) @@ -189,14 +192,15 @@ const action = { } expect(arr.some(item => item.includes(value))).equal(true) - }, - isDatetimeCelsValueInRange: async function( + } + +export const isDatetimeCelsValueInRange = async ( driver, table, columnName, fromDateTime, toDateTime - ) { + ) => { const arr = await getColumnValues(driver, table, columnName) const minDate = new Date(fromDateTime) @@ -216,13 +220,14 @@ const action = { true, `values "${arr}" is not in range: (${fromDateTime}..${toDateTime})` ) - }, - findRowIndexesByColumnValue: async function( + } + +export const findRowIndexesByColumnValue = async ( driver, table, columnName, value - ) { + ) => { const arr = await getColumnValues(driver, table, columnName) const indexes = [] @@ -232,13 +237,14 @@ const action = { } } return indexes - }, - findRowIndexesByColumnValueExpand: async function( + } + +export const findRowIndexesByColumnValueExpand = async ( driver, table, columnName, value - ) { + ) => { const columnValues = await getColumnValues(driver, table, columnName) return columnValues.reduce((acc, currentValue, index) => { @@ -248,13 +254,14 @@ const action = { return acc }, []) - }, - findRowIndexesByColumnValueAttribute: async function( + } + +export const findRowIndexesByColumnValueAttribute = async ( driver, table, columnName, value - ) { + ) => { const arr = await getColumnValuesAttribute(driver, table, columnName) const indexes = [] @@ -264,13 +271,14 @@ const action = { } } return indexes - }, - findRowIndexesByColumnTooltipsValue: async function( + } + +export const findRowIndexesByColumnTooltipsValue = async ( driver, table, columnName, value - ) { + ) => { const indexes = [] const rowsNumber = await getTableRows(driver, table) for (let row = rowsNumber; row >= 1; row--) { @@ -298,8 +306,9 @@ const action = { } return indexes.reverse() - }, - openActionMenuByIndex: async function(driver, table, index) { + } + +export const openActionMenuByIndex = async (driver, table, index) => { const elements = await driver.findElements( table.tableFields['action_menu'](index) ) @@ -314,16 +323,18 @@ const action = { return table.tableFields['action_menu'](index) } } - }, - getCellByIndexColumn: async function(driver, table, index, column) { + } + +export const getCellByIndexColumn = async (driver, table, index, column) => { return await table.tableFields[column](index) - }, - isTableColumnSorted: async function( + } + +export const isTableColumnSorted = async ( driver, table, columnName, order = 'asc' - ) { + ) => { const columnArray = await getColumnValues(driver, table, columnName) let sortedArr = [] if (order === 'asc') { @@ -334,8 +345,9 @@ const action = { } expect(sortedArr).equal(columnArray) - }, - checkTableColumnValues: async function(driver, table, columnName, values) { + } + +export const checkTableColumnValues = async (driver, table, columnName, values) => { const arr = await getColumnValues(driver, table, columnName) if (arr.length === 0) { throw new Error('Array is empty, nothing to compare') @@ -352,8 +364,9 @@ const action = { } return true - }, - getAllCellsWithAttribute: async function(driver, table, attribute) { + } + +export const getAllCellsWithAttribute = async (driver, table, attribute) => { const result = [] for (const column of table.tableCulumnNames) { @@ -376,8 +389,9 @@ const action = { } return result - }, - getRowsGeometry: async function(driver, table) { + } + +export const getRowsGeometry = async (driver, table) => { const rowsNumber = await getTableRows(driver, table) const result = [] @@ -389,8 +403,9 @@ const action = { } return result - }, - getFieldsGeometry: async function(driver, table, column, attribute) { + } + +export const getFieldsGeometry = async (driver, table, column, attribute) => { const rowsNumber = await getTableRows(driver, table) const result = [] @@ -401,8 +416,9 @@ const action = { } return result - }, - getNamedRowsGeometry: async function(driver, table, name = 'name') { + } + +export const getNamedRowsGeometry = async (driver, table, name = 'name') => { const rowsNumber = await getTableRows(driver, table) const result = [] @@ -418,8 +434,9 @@ const action = { } return new DataFrame(result) - }, - getNamedFieldsGeometry: async function(driver, table, column) { + } + +export const getNamedFieldsGeometry = async (driver, table, column) => { const rowsNumber = await getTableRows(driver, table) const result = [] @@ -430,15 +447,16 @@ const action = { } return new DataFrame(result) - }, - putToTestContextCellParameters: async function( + } + +export const putToTestContextCellParameters = async ( driver, testContext, table, index, column, attribute - ) { + ) => { const cellElement = await driver.findElement( table.tableFields[column](index) ) @@ -447,8 +465,9 @@ const action = { if (attribute) { testContext[attribute] = await cellElement.getAttribute(attribute) } - }, - checkCellHintText: async function (driver, table, hintComponent, hintValue, index) { + } + +export const checkCellHintText = async (driver, table, hintComponent, hintValue, index) => { await hoverComponent(driver, table.tableFields['hintButton'](index)) await driver.sleep(250) const hint = await driver.findElement(hintComponent) @@ -456,6 +475,3 @@ const action = { expect(text).equal(hintValue) } -} - -module.exports = action diff --git a/tests/features/common/components/action-menu.component.js b/tests/features/common/components/action-menu.component.js index 216c03f3e2..5ee76e95f5 100644 --- a/tests/features/common/components/action-menu.component.js +++ b/tests/features/common/components/action-menu.component.js @@ -19,7 +19,7 @@ such restriction. */ import { By } from 'selenium-webdriver' -module.exports = function(menuStructure) { +export default function(menuStructure) { return { root: By.css(menuStructure.root), open_button: By.css( diff --git a/tests/features/common/components/breadcrumbs.component.js b/tests/features/common/components/breadcrumbs.component.js index 744c5354f0..7eb022d2a2 100644 --- a/tests/features/common/components/breadcrumbs.component.js +++ b/tests/features/common/components/breadcrumbs.component.js @@ -17,10 +17,10 @@ illegal under applicable law, and the grant of the foregoing license under the Apache 2.0 license is conditioned upon your compliance with such restriction. */ -const { By } = require('selenium-webdriver') -const inputWithAutocomplete = require('./input-with-autocomplete.component') +import { By } from 'selenium-webdriver' +import inputWithAutocomplete from './input-with-autocomplete.component' -module.exports = { +export default { root: By.css('nav.breadcrumbs'), projectsPageLabel: By.css('.breadcrumbs__item:nth-of-type(1)'), projectLabel: By.css('.breadcrumbs__item:nth-of-type(3)'), diff --git a/tests/features/common/components/checkbox.component.js b/tests/features/common/components/checkbox.component.js index 1bea023501..f0b45fa00f 100644 --- a/tests/features/common/components/checkbox.component.js +++ b/tests/features/common/components/checkbox.component.js @@ -19,7 +19,7 @@ such restriction. */ import { By } from 'selenium-webdriver' -module.exports = function(checkboxStructure) { +export default function(checkboxStructure) { const element = {} element.root = By.css(checkboxStructure.root) element.checkbox = By.css( diff --git a/tests/features/common/components/combo-box.component.js b/tests/features/common/components/combo-box.component.js index 746398fc69..b05f7e2df7 100644 --- a/tests/features/common/components/combo-box.component.js +++ b/tests/features/common/components/combo-box.component.js @@ -21,7 +21,7 @@ import { By } from 'selenium-webdriver' import dropdownComponent from './dropdown.component' import { generateDropdownGroup } from '../../common-tools/common-tools' -module.exports = function(comboBoxRoot, newClassLocator = false) { +export default function(comboBoxRoot, newClassLocator = false) { const element = {} element.root = By.css(comboBoxRoot) diff --git a/tests/features/common/components/date-picker.component.js b/tests/features/common/components/date-picker.component.js index 90ca9a3cb0..cda827ef7c 100644 --- a/tests/features/common/components/date-picker.component.js +++ b/tests/features/common/components/date-picker.component.js @@ -22,7 +22,7 @@ import { locatorBuilder } from '../../common-tools/common-tools' import { cloneDeep } from 'lodash' -module.exports = function(datepickerStructure) { +export default function(datepickerStructure) { const datepickerRoot = locatorBuilder`${0} ${1}` const options = locatorBuilder`${0} ${1}` diff --git a/tests/features/common/components/dropdown.component.js b/tests/features/common/components/dropdown.component.js index 1864a47adb..a74a1741b8 100644 --- a/tests/features/common/components/dropdown.component.js +++ b/tests/features/common/components/dropdown.component.js @@ -20,7 +20,7 @@ such restriction. import { By } from 'selenium-webdriver' import { locatorBuilder } from '../../common-tools/common-tools' -module.exports = function(dropdownStructure) { +export default function(dropdownStructure) { const root = dropdownStructure.optionsInRoot ? dropdownStructure.root : '#overlay_container' diff --git a/tests/features/common/components/graph.component.js b/tests/features/common/components/graph.component.js index 1feff94192..909961591f 100644 --- a/tests/features/common/components/graph.component.js +++ b/tests/features/common/components/graph.component.js @@ -20,7 +20,7 @@ such restriction. import { By } from 'selenium-webdriver' import { locatorBuilder } from '../../common-tools/common-tools' -module.exports = function(graphStructure) { +export default function(graphStructure) { const options = locatorBuilder`${0} ${1}` const nodesTable = { ...graphStructure.elements.workflowGraphNodesTable.structure diff --git a/tests/features/common/components/input-group.component.js b/tests/features/common/components/input-group.component.js index c724f16a16..9b80bf555e 100644 --- a/tests/features/common/components/input-group.component.js +++ b/tests/features/common/components/input-group.component.js @@ -19,7 +19,7 @@ such restriction. */ import { By } from 'selenium-webdriver' -module.exports = function(inputStructure) { +export default function(inputStructure) { const element = {} element.root = By.css(inputStructure.root) element.inputField = By.css( diff --git a/tests/features/common/components/input-with-autocomplete.component.js b/tests/features/common/components/input-with-autocomplete.component.js index 776c6e7700..ec9493438a 100644 --- a/tests/features/common/components/input-with-autocomplete.component.js +++ b/tests/features/common/components/input-with-autocomplete.component.js @@ -20,7 +20,7 @@ such restriction. import { By } from 'selenium-webdriver' import { locatorBuilder } from '../../common-tools/common-tools' -module.exports = function(inputStructure) { +export default function(inputStructure) { const options = locatorBuilder`${0} ${1} ${2}` const option = locatorBuilder`${0} ${1}:nth-of-type(${2}) ${3}` diff --git a/tests/features/common/components/label.component.js b/tests/features/common/components/label.component.js index 69073805a7..816900ab25 100644 --- a/tests/features/common/components/label.component.js +++ b/tests/features/common/components/label.component.js @@ -19,7 +19,7 @@ such restriction. */ import { By } from 'selenium-webdriver' -module.exports = function(labelStructure) { +export default function(labelStructure) { const element = {} element.root = By.css(labelStructure.root) element.label = By.css( diff --git a/tests/features/common/components/number-input-group.component.js b/tests/features/common/components/number-input-group.component.js index 7a5b4d311d..87323aabc0 100644 --- a/tests/features/common/components/number-input-group.component.js +++ b/tests/features/common/components/number-input-group.component.js @@ -19,7 +19,7 @@ such restriction. */ import { By } from 'selenium-webdriver' -module.exports = function(inputStructure) { +export default function(inputStructure) { const element = {} element.root = By.css(inputStructure.root) element.inputField = By.css( diff --git a/tests/features/common/components/radio-button.component.js b/tests/features/common/components/radio-button.component.js index a3c41a3e3f..235c02bd50 100644 --- a/tests/features/common/components/radio-button.component.js +++ b/tests/features/common/components/radio-button.component.js @@ -19,7 +19,7 @@ such restriction. */ import { By } from 'selenium-webdriver' -module.exports = function(radiobuttonStructure) { +export default function(radiobuttonStructure) { const element = {} element.root = By.css(radiobuttonStructure.root) element.radiobutton = By.css( diff --git a/tests/features/common/components/single-date-picker.component.js b/tests/features/common/components/single-date-picker.component.js index 3174abab4e..4571711dba 100644 --- a/tests/features/common/components/single-date-picker.component.js +++ b/tests/features/common/components/single-date-picker.component.js @@ -22,7 +22,7 @@ import { locatorBuilder } from '../../common-tools/common-tools' import { cloneDeep } from 'lodash' -module.exports = function(datepickerStructure) { +export default function(datepickerStructure) { const datepickerRoot = locatorBuilder`${0} ${1}` const options = locatorBuilder`${0} ${1}` diff --git a/tests/features/common/components/table.component.js b/tests/features/common/components/table.component.js index 50f99e85be..ec99f2905a 100644 --- a/tests/features/common/components/table.component.js +++ b/tests/features/common/components/table.component.js @@ -51,7 +51,7 @@ import { locatorBuilder } from '../../common-tools/common-tools' * } * @returns - js object which allow access to table describle page components */ -module.exports = function(tableStructure) { +export default function(tableStructure) { const table = tableStructure const sortersBuilder = locatorBuilder`${0} ${1} ${2}` const columnBuilder = locatorBuilder`${0} ${1} ${2} ${3}` diff --git a/tests/features/common/components/text-area.component.js b/tests/features/common/components/text-area.component.js index 297e604589..c3f78737ec 100644 --- a/tests/features/common/components/text-area.component.js +++ b/tests/features/common/components/text-area.component.js @@ -19,7 +19,7 @@ such restriction. */ import { By } from 'selenium-webdriver' -module.exports = function (textAreaStructure) { +export default (textAreaStructure) => { const element = {} element.root = By.css(textAreaStructure.root) element.inputField = By.css(`${textAreaStructure.root} ${textAreaStructure.elements.input}`) diff --git a/tests/features/common/page-objects.js b/tests/features/common/page-objects.js index 2692cc7549..110e36557c 100644 --- a/tests/features/common/page-objects.js +++ b/tests/features/common/page-objects.js @@ -35,7 +35,7 @@ import documents from './page-objects/documents.po' import alerts from './page-objects/alerts.po' import monitoringApp from './page-objects/monitoring-app.po' -module.exports = { +export default { Add_To_Feature_Vector_Popup: interactivePopup['addToFeatureVectorPopup'], Add_To_Feature_Vector_Tab: featureStore['addToFeatureVector'], Add_Tag_Popup: interactivePopup['addTagPopup'], diff --git a/tests/features/common/page-objects/alerts-monitoring.po.js b/tests/features/common/page-objects/alerts-monitoring.po.js index 8be7b6a0f2..0c8a08444c 100644 --- a/tests/features/common/page-objects/alerts-monitoring.po.js +++ b/tests/features/common/page-objects/alerts-monitoring.po.js @@ -169,7 +169,7 @@ const dateTimePickerCalendars = { const commonErrorMessage = By.css('[data-testid="no-data"] h3') -module.exports = { +export default { alertsMonitoring: { Table_FilterBy_Button: By.css('[data-testid="filter-menu-btn-tooltip-wrapper"]'), Refresh_Button: By.css('[data-testid="refresh"] [data-testid="refresh-tooltip-wrapper"]'), diff --git a/tests/features/common/page-objects/alerts.po.js b/tests/features/common/page-objects/alerts.po.js index f8b4f24fd7..4b277d6360 100644 --- a/tests/features/common/page-objects/alerts.po.js +++ b/tests/features/common/page-objects/alerts.po.js @@ -169,7 +169,7 @@ const dateTimePickerCalendars = { const commonErrorMessage = By.css('[data-testid="no-data"] h3') -module.exports = { +export default { alerts: { Table_FilterBy_Button: By.css('[data-testid="filter-menu-btn-tooltip-wrapper"]'), Refresh_Button: By.css('[data-testid="refresh"] [data-testid="refresh-tooltip-wrapper"]'), diff --git a/tests/features/common/page-objects/commonPagesHeader.po.js b/tests/features/common/page-objects/commonPagesHeader.po.js index 55b8480907..3a4c3b0aef 100644 --- a/tests/features/common/page-objects/commonPagesHeader.po.js +++ b/tests/features/common/page-objects/commonPagesHeader.po.js @@ -35,7 +35,7 @@ const generalInfoQuickLinks = { } } -module.exports = { +export default { loader: By.css('.loader-wrapper .loader'), See_On_Github: By.css('header.header a[alt="MLRUN on Gihub"]'), See_On_Slack: By.css('header.header a[alt="MLRUN on Slack"]'), diff --git a/tests/features/common/page-objects/documents.po.js b/tests/features/common/page-objects/documents.po.js index d618689ec4..675ce44021 100644 --- a/tests/features/common/page-objects/documents.po.js +++ b/tests/features/common/page-objects/documents.po.js @@ -83,7 +83,7 @@ const documentsTable = { } } -module.exports = { +export default { documents: { Table_Name_Filter_Input: inputGroup( generateInputGroup( diff --git a/tests/features/common/page-objects/feature-store.po.js b/tests/features/common/page-objects/feature-store.po.js index 74cc647f39..d4f6cd9b7f 100644 --- a/tests/features/common/page-objects/feature-store.po.js +++ b/tests/features/common/page-objects/feature-store.po.js @@ -378,7 +378,7 @@ const commonTableTreeFilterDropdown = dropdownComponent( ) ) -module.exports = { +export default { featureSetsTab: { Table_FilterBy_Button: tableFilterByButton, Table_Refresh_Button: tableRefreshButton, diff --git a/tests/features/common/page-objects/files.po.js b/tests/features/common/page-objects/files.po.js index 149f1a2ec8..41fdbe3693 100644 --- a/tests/features/common/page-objects/files.po.js +++ b/tests/features/common/page-objects/files.po.js @@ -94,7 +94,7 @@ const filesTable = { } } -module.exports = { +export default { filesTab: { Table_Name_Filter_Input: inputGroup( generateInputGroup( diff --git a/tests/features/common/page-objects/info-pane.po.js b/tests/features/common/page-objects/info-pane.po.js index c6e55c9d42..3fa4609baf 100644 --- a/tests/features/common/page-objects/info-pane.po.js +++ b/tests/features/common/page-objects/info-pane.po.js @@ -589,7 +589,7 @@ const commonVersionTagInput = inputGroup( const commonVersionTagInputFullView = By.css('.table__item_big .details-item__input-wrapper input') const commonLabelsApplyButton = By.css('.item-info__details-wrapper .details-item .details-item__data-chips .details-item__apply-btn-wrapper') -module.exports = { +export default { featureSetsInfoPane: { Header: header, Updated: updated, diff --git a/tests/features/common/page-objects/interactive-popup.po.js b/tests/features/common/page-objects/interactive-popup.po.js index 213a3bc0cd..3e38b435fc 100644 --- a/tests/features/common/page-objects/interactive-popup.po.js +++ b/tests/features/common/page-objects/interactive-popup.po.js @@ -37,8 +37,7 @@ import { generateCheckboxGroup } from '../../common-tools/common-tools' import inputWithAutocomplete from '../components/input-with-autocomplete.component' - -const { By } = require('selenium-webdriver') +import { By } from 'selenium-webdriver' const memberOverviewLabelsTable = { root: '.settings__members', @@ -717,7 +716,7 @@ const infoPaneOverviewSourcesHeaders = { } } -module.exports = { +export default { createNewProject: { Title: commonTitle, Name_Input: inputGroup( diff --git a/tests/features/common/page-objects/jobs-and-workflows.po.js b/tests/features/common/page-objects/jobs-and-workflows.po.js index d0e8ce1207..422496f6df 100644 --- a/tests/features/common/page-objects/jobs-and-workflows.po.js +++ b/tests/features/common/page-objects/jobs-and-workflows.po.js @@ -460,7 +460,7 @@ const commonCustomRangeFilter = dropdownComponent( ) ) -module.exports = { +export default { JobsMonitorTab: { Jobs_Tab_Selector: jobsTabSelector, Date_Picker_Filter_Dropdown: commonDatePickerFilter, diff --git a/tests/features/common/page-objects/jobs-monitoring.po.js b/tests/features/common/page-objects/jobs-monitoring.po.js index 014aed9ab5..4d7a6b2731 100644 --- a/tests/features/common/page-objects/jobs-monitoring.po.js +++ b/tests/features/common/page-objects/jobs-monitoring.po.js @@ -278,7 +278,7 @@ const dateTimePickerCalendars = { const commonRefreshButton = By.css('[data-testid="refresh"]') const commonErrorMessage = By.css('[data-testid="no-data"] h3') -module.exports = { +export default { crossJobsMonitorTab: { Cross_Jobs_Tab_Selector: commonTable(tabSelector), Table_FilterBy_Button: By.css('[data-testid="filter-menu-btn-tooltip-wrapper"]'), diff --git a/tests/features/common/page-objects/ml-functions.po.js b/tests/features/common/page-objects/ml-functions.po.js index 11cdd7a382..edba565146 100644 --- a/tests/features/common/page-objects/ml-functions.po.js +++ b/tests/features/common/page-objects/ml-functions.po.js @@ -86,7 +86,7 @@ const functionsTable = { } } -module.exports = { +export default { mlFunctions: { Table_Name_Filter_Input: inputGroup( generateInputGroup( diff --git a/tests/features/common/page-objects/models.po.js b/tests/features/common/page-objects/models.po.js index c20bd21112..d298177acd 100644 --- a/tests/features/common/page-objects/models.po.js +++ b/tests/features/common/page-objects/models.po.js @@ -257,7 +257,7 @@ const tableNameFilterInput = inputGroup( ) ) -module.exports = { +export default { modelsTab: { Delete_Artifact_Popup: By.css('[data-testid="pop-up-dialog"]'), Models_Tab_Selector: commonTable(tabSelector), diff --git a/tests/features/common/page-objects/monitoring-app.po.js b/tests/features/common/page-objects/monitoring-app.po.js index bf8e83658d..87391e4e96 100644 --- a/tests/features/common/page-objects/monitoring-app.po.js +++ b/tests/features/common/page-objects/monitoring-app.po.js @@ -113,7 +113,7 @@ const dateTimePickerCalendars = { } // datepicker end -module.exports = { +export default { monitoringApp: { Refresh_Button: By.css('[data-testid="refresh"] [data-testid="refresh-tooltip-wrapper"]'), Date_Picker_Filter_Dropdown: commonDatePickerFilter, diff --git a/tests/features/common/page-objects/project-settings.po.js b/tests/features/common/page-objects/project-settings.po.js index 31c68c8bab..87fb7ade51 100644 --- a/tests/features/common/page-objects/project-settings.po.js +++ b/tests/features/common/page-objects/project-settings.po.js @@ -123,7 +123,7 @@ const secretsTable = { } } -module.exports = { +export default { generalTab: { Project_Settings_Tab_Selector: commonTable(tabSelector), Source_URL_Input: inputGroup( diff --git a/tests/features/common/page-objects/project.po.js b/tests/features/common/page-objects/project.po.js index 22cab8706f..8c91a06d9b 100644 --- a/tests/features/common/page-objects/project.po.js +++ b/tests/features/common/page-objects/project.po.js @@ -47,7 +47,7 @@ const actionMenuStructure = { } const projectDashboardRealtimeFunctionsTable = { - root: '.main-info__statistics-section .d-flex:nth-of-type(2) .project-data-card .project-data-card__table', + root: '.main-info__statistics-section .d-flex:nth-of-type(2) .project-data-card', header: { root: '.project-data-card__table-header', sorters: { @@ -56,19 +56,19 @@ const projectDashboardRealtimeFunctionsTable = { } }, body: { - root: '.project-data-card__table-body', + root: '.section-table__table-body', row: { - root: '.project-data-card__table-row', + root: '.section-table__table-row', fields: { - name: '.project-data-card__table-cell:nth-of-type(1) .data-ellipsis', - status: '.project-data-card__table-cell:nth-of-type(2) .data-ellipsis' + name: '.table-cell_big .data-ellipsis', + status: '.status-cell .data-ellipsis' } } } } const projectJobsAndWorkflows = { - root: '.main-info__statistics-section:nth-of-type(4) .project-data-card:nth-of-type(1)', + root: '.main-info__statistics-section:nth-of-type(4) .d-flex:nth-of-type(1) .project-data-card', header: { root: '.project-data-card__table-header', sorters: { @@ -80,16 +80,16 @@ const projectJobsAndWorkflows = { } }, body: { - root: '.project-data-card__table-body', + root: '.section-table__table-body', row: { - root: '.project-data-card__table-row', + root: '.section-table__table-row', fields: { - name: '.project-data-card__table-cell:nth-of-type(1) .link', - type: '.project-data-card__table-cell:nth-of-type(2) .data-ellipsis', - status: '.project-data-card__table-cell:nth-of-type(2) .data-ellipsis', + name: '.table-cell_big:nth-of-type(1) .data-ellipsis', + type: '.table-cell_small .data-ellipsis', + status: '.status-cell .data-ellipsis', started_at: - '.project-data-card__table-cell:nth-of-type(2) .data-ellipsis', - duration: '.project-data-card__table-cell:nth-of-type(2) .data-ellipsis' + '.table-cell_big:nth-of-type(4) .data-ellipsis', + duration: '.table-cell_medium:nth-of-type(5) .data-ellipsis' } } } @@ -282,7 +282,7 @@ const shardLagsTable = { } } -module.exports = { +export default { project: { Create_New: createNewObject, Refresh_Button: By.css('.main-info__toolbar [data-testid="refresh"]'), @@ -304,13 +304,17 @@ module.exports = { Artifacts_Stats_Title: By.css('.main-info__statistics-section_left .stats-card:nth-of-type(3) .stats-card__row:nth-of-type(1) .stats-card__title span'), Artifacts_Stats_Tip: By.css('.stats-card:nth-of-type(3) .stats-card__row:nth-of-type(1) [data-testid="tip"]'), Artifacts_Stats_Counter: By.css('.stats-card:nth-of-type(3) .stats-card__row:nth-of-type(2) [data-testid="monitoring-Artifacts"] .stats__counter'), - ConsumerGroups_Stats_Title: By.css('.main-info__statistics-section_right .stats-card:nth-of-type(1) .stats-card__row:nth-of-type(1) .stats-card__title span'), - ConsumerGroups_Stats_Counter: By.css('.stats-card:nth-of-type(1) .stats-card__row:nth-of-type(2) [data-testid="monitoring-Consumer groups"] .stats__counter'), - Alerts_Stats_Title: By.css('.main-info__statistics-section_right .stats-card:nth-of-type(2) .stats-card__row:nth-of-type(1) .stats-card__title span'), - Alerts_Stats_Total_Number: By.css('.main-info__statistics-section_right .stats-card:nth-of-type(2) [data-testid="alerts_total_counter"] .stats__counter'), - Alerts_Stats_Endpoint_Number: By.css('.main-info__statistics-section_right .stats-card:nth-of-type(2) [data-testid="alerts_endpoint_counter"] .stats__counter'), - Alerts_Stats_Jobs_Number: By.css('.main-info__statistics-section_right .stats-card:nth-of-type(2) [data-testid="alerts_jobs_counter"] .stats__counter'), - Alerts_Stats_Application_Number: By.css('.main-info__statistics-section_right .stats-card:nth-of-type(2) [data-testid="alerts_application_counter stats__counter-large"] .stats__counter'), + ConsumerGroups_Stats_Title: By.css('.main-info__statistics-section:nth-of-type(4) .d-flex:nth-of-type(2) .project-data-card__header .project-data-card__statistics-item:nth-of-type(4) .project-data-card__statistics-label'), + ConsumerGroups_Stats_Counter: By.css('.main-info__statistics-section:nth-of-type(4) .d-flex:nth-of-type(2) .project-data-card__header .project-data-card__statistics-item:nth-of-type(4) .project-data-card__statistics-value'), + Alerts_Stats_Title: By.css('.main-info__statistics-section_right .stats-card__title span'), + Alerts_Stats_Total_Title: By.css('.main-info__statistics-section_right [data-testid="alerts_total_counter"] span'), + Alerts_Stats_Total_Number: By.css('.main-info__statistics-section_right [data-testid="alerts_total_counter"] .stats__counter'), + Alerts_Stats_Endpoint_Number: By.css('.main-info__statistics-section_right [data-testid="alerts_endpoint_counter"] .stats__counter'), + Alerts_Stats_Endpoint_Title: By.css('.main-info__statistics-section_right [data-testid="alerts_endpoint_counter"] .stats__subtitle'), + Alerts_Stats_Jobs_Number: By.css('.main-info__statistics-section_right [data-testid="alerts_jobs_counter"] .stats__counter'), + Alerts_Stats_Jobs_Title: By.css('.main-info__statistics-section_right [data-testid="alerts_jobs_counter"] .stats__subtitle'), + Alerts_Stats_Application_Number: By.css('.main-info__statistics-section_right [data-testid="alerts_application_counter stats__counter-large"] .stats__counter'), + Alerts_Stats_Application_Title: By.css('.main-info__statistics-section_right [data-testid="alerts_application_counter stats__counter-large"] .stats__subtitle'), Jobs_Info_Card_Statistics: commonTable(generalInfoJobsCardStat), Real_Time_Functions_Card_Statistics: commonTable( generalInfoRealTimeFunctionsCardStat diff --git a/tests/features/common/page-objects/projects.po.js b/tests/features/common/page-objects/projects.po.js index 7e261373ac..7f780fc86b 100644 --- a/tests/features/common/page-objects/projects.po.js +++ b/tests/features/common/page-objects/projects.po.js @@ -101,7 +101,7 @@ const ProjectsTableSelector = { } } -module.exports = { +export default { Retrieving_Projects_Message: By.css('[data-testid=no-data]'), No_Archived_Projects_Message: By.css('.no-filtered-data'), New_Project_Button: By.css( @@ -115,7 +115,7 @@ module.exports = { '.projects__wrapper .projects-content-header .projects-content-header-item [data-testid="active"]' ), Archive_Projects_Button: By.css( - '.projects__wrapper .projects-content-header .projects-content-header-item [data-testid=archived] a' + '.projects__wrapper .projects-content-header .projects-content-header-item [data-testid=archived]' ), Projects_Sorter: By.css('.projects-content-header-item .sort .split-btn__button:nth-of-type(1)'), Projects_Sort_Dropdown: dropdownComponent( @@ -274,7 +274,7 @@ module.exports = { '.stats-card:nth-of-type(4) [data-testid="alerts_application_counter stats__counter-large"] .stats__counter' ), Total_Application_Counter_Title: By.css( - '.stats-card:nth-of-type(4) [data-testid="alerts_application_counter"] .stats__subtitle' + '.stats-card:nth-of-type(4) [data-testid="alerts_application_counter stats__counter-large"] .stats__subtitle' ), Total_Alerts_Title: By.css( '.stats-card:nth-of-type(4) .stats-card__col > div > div > span' diff --git a/tests/features/common/page-objects/side-panel.po.js b/tests/features/common/page-objects/side-panel.po.js index 5205c1b429..37f485fbf8 100644 --- a/tests/features/common/page-objects/side-panel.po.js +++ b/tests/features/common/page-objects/side-panel.po.js @@ -36,7 +36,7 @@ import { generateCheckboxGroup, generateTextAreaGroup } from '../../common-tools/common-tools' -const { By } = require('selenium-webdriver') +import { By } from 'selenium-webdriver' const actionMenuStructure = { root: '.table__cell-actions', @@ -734,7 +734,7 @@ const commonAccessKeyInput = inputGroup( ) ) -module.exports = { +export default { newFeatureSet: { Cross_Close_Button: commonCrossCloseButton, Feature_Set_Name_Input: inputGroup( diff --git a/tests/features/datasets.feature b/tests/features/datasets.feature index 1527a07436..d1e932e1e1 100644 --- a/tests/features/datasets.feature +++ b/tests/features/datasets.feature @@ -157,6 +157,7 @@ Feature: Datasets Page Then click on "show_all_versions" option on "Datasets" wizard in "Datasets_Table" table with "test-dataset" value in "name" column with scroll "false" And wait load page When click on cell with row index 1 in "uid" column in "Datasets_Table" table on "Datasets" wizard + And wait load page Then check "v1" value in "tag" column in "Overview_Table" table on "Datasets_Info_Pane" wizard Then click on "Edit_btn_table_view" element on "Datasets_Info_Pane" wizard And wait load page diff --git a/tests/features/jobsAndWorkflows.feature b/tests/features/jobsAndWorkflows.feature index 30ead4cb8a..4e78b93ea3 100644 --- a/tests/features/jobsAndWorkflows.feature +++ b/tests/features/jobsAndWorkflows.feature @@ -209,6 +209,7 @@ Feature: Jobs and workflows Then verify "Jobs_Monitor_Table" element visibility on "Jobs_Monitor_Tab" wizard When pick up "Custom range" from "10/01/2021 00:00" to "11/30/2021 00:00" in "Date_Time_Picker" via "Date_Picker_Filter_Dropdown" on "Jobs_Monitor_Tab" wizard And wait load page + And wait load page Then verify from "10/01/2021 00:00" to "11/30/2021 00:00" filter band in "Custom_Range_Filter_Dropdown" filter dropdown on "Jobs_Monitor_Tab" wizard And wait load page Then verify "Jobs_Monitor_Table" element visibility on "Jobs_Monitor_Tab" wizard @@ -226,13 +227,18 @@ Feature: Jobs and workflows And hover "MLRun_Logo" component on "commonPagesHeader" wizard And wait load page When pick up "Custom range" from "03/31/2014 10:30" to "03/21/2015 19:15" in "Date_Time_Picker" via "Date_Picker_Filter_Dropdown" on "Jobs_Monitor_Tab" wizard + And wait load page Then verify from "03/31/2014 10:30" to "03/21/2015 19:15" filter band in "Custom_Range_Filter_Dropdown" filter dropdown on "Jobs_Monitor_Tab" wizard When pick up "Custom range" from "03/31/2044 10:30" to "03/21/2015 19:15" in "Date_Time_Picker" via "Date_Picker_Filter_Dropdown" on "Jobs_Monitor_Tab" wizard + And wait load page Then verify error message in "Date_Time_Picker" on "Jobs_Monitor_Tab" wizard with value "Date_Time_Picker"."Error_Message" Then click on "Table_Refresh_Button" element on "Jobs_Monitor_Tab" wizard When pick up "Custom range" from "03/31/2030 10:30" to "03/31/2030 10:31" in "Date_Time_Picker" via "Date_Picker_Filter_Dropdown" on "Jobs_Monitor_Tab" wizard + And wait load page Then verify from "03/31/2030 10:30" to "03/31/2030 10:31" filter band in "Custom_Range_Filter_Dropdown" filter dropdown on "Jobs_Monitor_Tab" wizard When pick up "Custom range" from "03/31/2025 10:31" to "03/21/2025 10:30" in "Date_Time_Picker" via "Date_Picker_Filter_Dropdown" on "Jobs_Monitor_Tab" wizard + And wait load page + And wait load page Then verify error message in "Date_Time_Picker" on "Jobs_Monitor_Tab" wizard with value "Date_Time_Picker"."Error_Message" @MLJW @@ -1192,6 +1198,8 @@ Feature: Jobs and workflows And wait load page Then verify "Monitor Jobs" tab is active in "Jobs_Tab_Selector" on "Jobs_Monitor_Tab" wizard When pick up "Custom range" from "09/01/2021 18:00" to "09/03/2021 18:00" in "Date_Time_Picker" via "Date_Picker_Filter_Dropdown" on "Jobs_Monitor_Tab" wizard + And wait load page + And wait load page Then click on "Table_FilterBy_Button" element on "Jobs_Monitor_Tab" wizard Then select "Error" option in "Status_Filter_Dropdown" filter dropdown on "FilterBy_Popup" wizard Then click on "Title" element on "FilterBy_Popup" wizard @@ -1207,6 +1215,7 @@ Feature: Jobs and workflows And wait load page Then verify options in action menu on "Jobs_Monitor_Tab" wizard in "Jobs_Monitor_Table" table with "Running" value in "status" column should contains "Jobs_And_Workflows"."Running_Job_Action_Menu_Options" When pick up "Custom range" from "08/28/2021 18:00" to "09/01/2021 18:00" in "Date_Time_Picker" via "Date_Picker_Filter_Dropdown" on "Jobs_Monitor_Tab" wizard + And wait load page Then click on "Table_FilterBy_Button" element on "Jobs_Monitor_Tab" wizard Then select "Running" option in "Status_Filter_Dropdown" filter dropdown on "FilterBy_Popup" wizard Then click on "Title" element on "FilterBy_Popup" wizard @@ -1642,7 +1651,7 @@ Feature: Jobs and workflows And wait load page Then verify redirection from "projects/default/jobs/monitor-jobs/aggregate-test/864f4da42773494eb94dce1c8834feb6/resultsINVALID?dates=anyTime&savedParams=P2JlUGFnZT0xJmZlUGFnZT0xJmRhdGVzPWFueVRpbWU%3D&bePage=1&fePage=1" to "projects/default/jobs/monitor-jobs/aggregate-test/864f4da42773494eb94dce1c8834feb6/overview?dates=anyTime&savedParams=P2JlUGFnZT0xJmZlUGFnZT0xJmRhdGVzPWFueVRpbWU%3D&bePage=1&fePage=1" And wait load page - Then verify redirection from "projects/default/jobs/monitor-jobs/aggregate-test/INVALID/overview?dates=anyTime&savedParams=P2JlUGFnZT0xJmZlUGFnZT0xJmRhdGVzPWFueVRpbWU%3D&bePage=1&fePage=1" to "projects/default/jobs/monitor-jobs/aggregate-test/INVALID/overview?dates=anyTime&savedParams=P2JlUGFnZT0xJmZlUGFnZT0xJmRhdGVzPWFueVRpbWU%3D&bePage=1&fePage=1" + Then verify redirection from "projects/default/jobs/monitor-jobs/aggregate-test/INVALID/overview?dates=anyTime&savedParams=P2JlUGFnZT0xJmZlUGFnZT0xJmRhdGVzPWFueVRpbWU%3D&bePage=1&fePage=1" to "projects/default/jobs/monitor-jobs/aggregate-test?dates=anyTime&savedParams=P2JlUGFnZT0xJmZlUGFnZT0xJmRhdGVzPWFueVRpbWU%3D&bePage=1&fePage=1" And wait load page Then verify if "Notification_Popup" popup dialog appears Then verify "Notification_Pop_Up" element visibility on "Notification_Popup" wizard @@ -2116,6 +2125,7 @@ Feature: Jobs and workflows Then select "Hub" tab in "Function_Selection_Tabs" on "Modal_Wizard_Form" wizard And wait load page And click on row root with value "auto-trainer" in "name" column in "Functions_Table" table on "Modal_Wizard_Form" wizard + And wait load page Then "Function_Title" element on "Modal_Wizard_Form" should contains "auto-trainer" value Then verify "Next_Button" element on "Modal_Wizard_Form" wizard is enabled And click on "Step_4_Button" element on "commonPagesHeader" wizard @@ -2794,6 +2804,7 @@ Feature: Jobs and workflows And wait load page Then "Notification_Pop_Up" element on "Notification_Popup" should contains "Job erann-test (...e19ea57) was aborted" value And wait load page + And wait load page Then verify "Notification_Pop_Up_Cross_Close_Button" element visibility on "Notification_Popup" wizard Then click on "Notification_Pop_Up_Cross_Close_Button" element on "Notification_Popup" wizard Then verify "Table_Refresh_Button" element visibility on "Jobs_Monitor_Tab" wizard diff --git a/tests/features/projectMonitoring.feature b/tests/features/projectMonitoring.feature index 5ccba9ae2a..91afe20084 100644 --- a/tests/features/projectMonitoring.feature +++ b/tests/features/projectMonitoring.feature @@ -29,11 +29,21 @@ Feature: Project Monitoring Page Then verify "Artifacts_Stats_Tip" element on "Project" wizard should display hover hint "Label_Hint"."Artifacts_Stats_Tip" Then verify "Artifacts_Stats_Counter" element visibility on "Project" wizard Then verify "Alerts_Stats_Title" element visibility on "Project" wizard + Then "Alerts_Stats_Title" element on "Project" should contains "Alerts" value + Then verify "Alerts_Stats_Total_Title" element visibility on "Project" wizard + Then "Alerts_Stats_Total_Title" element on "Project" should contains "Total" value Then verify "Alerts_Stats_Total_Number" element visibility on "Project" wizard + Then verify "Alerts_Stats_Endpoint_Title" element visibility on "Project" wizard + Then "Alerts_Stats_Endpoint_Title" element on "Project" should contains "Endpoint" value Then verify "Alerts_Stats_Endpoint_Number" element visibility on "Project" wizard + Then verify "Alerts_Stats_Jobs_Title" element visibility on "Project" wizard + Then "Alerts_Stats_Jobs_Title" element on "Project" should contains "Jobs" value Then verify "Alerts_Stats_Jobs_Number" element visibility on "Project" wizard + Then verify "Alerts_Stats_Application_Title" element visibility on "Project" wizard + Then "Alerts_Stats_Application_Title" element on "Project" should contains "Application" value Then verify "Alerts_Stats_Application_Number" element visibility on "Project" wizard Then verify "ConsumerGroups_Stats_Title" element visibility on "Project" wizard + Then "ConsumerGroups_Stats_Title" element on "Project" should contains "Consumer groups" value Then verify "ConsumerGroups_Stats_Counter" element visibility on "Project" wizard Then verify "Jobs_Info_Card_Statistics" element visibility on "Project" wizard Then verify "Real_Time_Functions_Card_Statistics" element visibility on "Project" wizard @@ -64,7 +74,6 @@ Feature: Project Monitoring Page Then verify "Documents_Button" element visibility on "commonPagesHeader" wizard Then verify "Artifacts_Button" element visibility on "commonPagesHeader" wizard Then verify "Models_Button" element visibility on "commonPagesHeader" wizard - Then verify "Monitoring_App_Button" element visibility on "commonPagesHeader" wizard Then verify "Jobs_And_Workflows_Button" element visibility on "commonPagesHeader" wizard Then verify "ML_Functions_Button" element visibility on "commonPagesHeader" wizard Then verify "Real_Time_Functions_Button" element visibility on "commonPagesHeader" wizard @@ -90,8 +99,6 @@ Feature: Project Monitoring Page Then verify "Artifacts_Icon" element visibility on "commonPagesHeader" wizard Then verify "Models_Button" element invisibility on "commonPagesHeader" wizard Then verify "Models_Icon" element visibility on "commonPagesHeader" wizard - Then verify "Monitoring_App_Button" element invisibility on "commonPagesHeader" wizard - Then verify "Monitoring_App_Icon" element visibility on "commonPagesHeader" wizard Then verify "Jobs_And_Workflows_Button" element invisibility on "commonPagesHeader" wizard Then verify "Jobs_And_Workflows_Icon" element visibility on "commonPagesHeader" wizard Then verify "ML_Functions_Button" element invisibility on "commonPagesHeader" wizard @@ -150,6 +157,8 @@ Feature: Project Monitoring Page When turn on demo mode with query params "false" And wait load page And wait load page + Then verify "Monitoring_App_Button" element visibility on "commonPagesHeader" wizard + Then verify "Monitoring_App_Icon" element visibility on "commonPagesHeader" wizard Then verify "LLM_Prompts_Button" element visibility on "commonPagesHeader" wizard Then verify "LLM_Prompts_Icon" element visibility on "commonPagesHeader" wizard @@ -798,6 +807,7 @@ Feature: Project Monitoring Page And wait load page Then click on "ConsumerGroups_Stats_Counter" element on "Project" wizard And wait load page + And wait load page Then "Title" element on "Consumer_Groups" should contains "Consumer groups (v3io stream)" value Then "Description" element on "Consumer_Groups" should contains "This report displays the project's consumer groups for Iguazio v3io streams" value Then verify "Arrow_Back" element visibility on "Consumer_Groups" wizard @@ -805,6 +815,7 @@ Feature: Project Monitoring Page Then verify "Consumer_Groups_Table" element visibility on "Consumer_Groups" wizard Then click on "Arrow_Back" element on "Consumer_Groups" wizard And wait load page + And wait load page Then verify breadcrumbs "project" label should be equal "default" value Then verify "Create_New" element visibility on "Project" wizard Then verify "Refresh_Button" element visibility on "Project" wizard @@ -824,6 +835,7 @@ Feature: Project Monitoring Page And wait load page Then click on "ConsumerGroups_Stats_Counter" element on "Project" wizard And wait load page + And wait load page Then verify "Search_Input" element visibility on "Consumer_Groups" wizard Then verify "Consumer_Groups_Table" element visibility on "Consumer_Groups" wizard Then type value "C" to "Search_Input" field on "Consumer_Groups" wizard @@ -849,6 +861,7 @@ Feature: Project Monitoring Page And wait load page Then click on "ConsumerGroups_Stats_Counter" element on "Project" wizard And wait load page + And wait load page And save to context "consumer_group_name" column and "href" attribute on 1 row from "Consumer_Groups_Table" table on "Consumer_Groups" wizard And click on cell with row index 1 in "consumer_group_name" column in "Consumer_Groups_Table" table on "Consumer_Groups" wizard And wait load page diff --git a/tests/features/projectsPage.feature b/tests/features/projectsPage.feature index 663a6bd9a3..753ea893a9 100644 --- a/tests/features/projectsPage.feature +++ b/tests/features/projectsPage.feature @@ -5,7 +5,6 @@ Feature: Projects Page @MLPr @passive @smoke - #TODO: last two steps are unstable on small screen extensions because scroll change the screen coordinates, it needs another solution Scenario: MLPr001 - Check all mandatory components Given open url And wait load page @@ -252,10 +251,14 @@ Feature: Projects Page Then check "automation-test-name7" value in "name" column in "Projects_Table" table on "Projects" wizard Then select "Unarchive" option in action menu on "Projects" wizard in "Projects_Table" table at row with "automation-test-name7" value in "name" column And wait load page + Then select "Unarchive" option in action menu on "Projects" wizard in "Projects_Table" table at row with "hedi-proj" value in "name" column And wait load page Then "No_Archived_Projects_Message" element on "Projects" should contains "No archived projects." value Then click on "Active_Projects_Button" element on "Projects" wizard Then check "automation-test-name7" value in "name" column in "Projects_Table" table on "Projects" wizard + And wait load page + Then check "hedi-proj" value in "name" column in "Projects_Table" table on "Projects" wizard + And wait load page @MLPr @passive diff --git a/tests/features/step-definitions/steps.js b/tests/features/step-definitions/steps.js index fd47318b1d..4ba1c93160 100644 --- a/tests/features/step-definitions/steps.js +++ b/tests/features/step-definitions/steps.js @@ -821,14 +821,14 @@ When( pageObjects[wizardName][dropdownName], optionValue ) - await this.driver.sleep(200) + await this.driver.sleep(1000) await pickUpCustomDatetimeRange( this.driver, pageObjects[wizardName][datetimePicker], fromDatetime, toDatetime ) - await this.driver.sleep(200) + await this.driver.sleep(1000) await applyDatetimePickerRange( this.driver, pageObjects[wizardName][datetimePicker] diff --git a/tests/features/support/world.js b/tests/features/support/world.js index 75a0fbad11..af6f2827db 100644 --- a/tests/features/support/world.js +++ b/tests/features/support/world.js @@ -23,8 +23,8 @@ import firefox from 'selenium-webdriver/firefox' import { setWorldConstructor, setDefaultTimeout } from '@cucumber/cucumber' import { timeout, browser, headless, screen_size } from '../../config' -require('chromedriver') -require('geckodriver') +import 'chromedriver' +import 'geckodriver' class World { constructor({ attach, log, parameters }) {