Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion tests/features/common-tools/common-consts.js
Original file line number Diff line number Diff line change
Expand Up @@ -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',
Expand Down
81 changes: 44 additions & 37 deletions tests/features/common-tools/common-tools.js
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand All @@ -62,8 +62,9 @@ module.exports = {
}

return structure
},
generateNumberInputGroup: function (
}

export function generateNumberInputGroup (
root,
incDecBtn = false,
label = false,
Expand Down Expand Up @@ -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

Expand All @@ -108,8 +110,9 @@ module.exports = {
}

return structure
},
generateDropdownGroup: function (
}

export function generateDropdownGroup (
root,
open_button = false,
options = false,
Expand All @@ -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]' : ''
Expand All @@ -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: {
Expand All @@ -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')
Expand All @@ -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':
Expand All @@ -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}`)
}
}
2 changes: 1 addition & 1 deletion tests/features/common-tools/utils.js
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
26 changes: 13 additions & 13 deletions tests/features/common/actions/action-menu.action.js
Original file line number Diff line number Diff line change
Expand Up @@ -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 => {
Expand All @@ -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){
Expand All @@ -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')
Expand All @@ -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')
Expand All @@ -79,6 +82,3 @@ const action = {
}
}
}
}

module.exports = action
Loading