Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Check tooltitp #495

Closed
wants to merge 6 commits into from
Closed
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
27 changes: 26 additions & 1 deletion backend/features/step_definitions/stepdefs.js
Original file line number Diff line number Diff line change
Expand Up @@ -843,7 +843,7 @@ Then('So the checkbox {string} is set to {string} [true OR false]', async functi

Then('So on element {string} the css property {string} is {string}', async function cssIs(element, property, value) {
const world = this;
const identifiers = [`//*[contains(text(),'${element}')]`, `//*[@id='${element}']`, `//*[@*='${element}']`, `//*[contains(@id, '${element}')]`, `${element}`];
const identifiers = [`//*[contains(text(),'${element}')]`, `//*[@id='${element}']`, `//*[@*='${element}']`, `//*[contains(@*, '${element}')]`, `//*[contains(@id, '${element}')]`, `${element}`];
const promises = [];
for (const idString of identifiers) promises.push(driver.wait(until.elementLocated(By.xpath(idString)), searchTimeout, `Timed out after ${searchTimeout} ms`, 100));
await Promise.any(promises)
Expand All @@ -855,7 +855,32 @@ Then('So on element {string} the css property {string} is {string}', async funct
const hex = `#${r}${g}${b}`;
expect(value.toString()).to.equal(hex.toString(), `actual ${hex} does not match ${value}`);
} else expect(value.toString()).to.equal(actual.toString(), `actual ${actual} does not match ${value}`);
}).catch(async (e) => {
await driver.takeScreenshot().then(async (buffer) => {
world.attach(buffer, 'image/png');
});
throw Error(e);
});
await driver.sleep(100 + currentParameters.waitTime);
});

Then('So the element {string} has the tool-tip {string}', async function toolTipIs(element, value) {
const world = this;
const identifiers = [`//*[contains(text(),'${element}')]`, `//*[@id='${element}']`, `\\*[@*='${element} and @role=tooltip]`, `//*[contains(@*, '${element}')]`, `//*[@*='${element}']`, `//*[contains(@id, '${element}')]`, `${element}`];
const promises = [];
for (const idString of identifiers) promises.push(driver.wait(until.elementLocated(By.xpath(idString)), searchTimeout, `Timed out after ${searchTimeout} ms`, 100));
await Promise.any(promises)
.then(async (elem) => {
const actual = await elem.getAttribute('title');
expect(actual).to.equal(value);
}).catch(async (e) => {
await driver.takeScreenshot().then(async (buffer) => {
world.attach(buffer, 'image/png');
});
if (Object.keys(e).length === 0) throw NotFoundError(`The Element ${element} could not be found (check tool-tip).`);
throw Error(e);
});
await driver.sleep(100 + currentParameters.waitTime);
});

// Closes the webdriver (Browser)
Expand Down
13 changes: 12 additions & 1 deletion backend/src/database/stepTypes.js
Original file line number Diff line number Diff line change
Expand Up @@ -449,13 +449,24 @@ function stepDefs() {
stepType: 'then',
type: 'CSS-Value',
pre: 'So on element',
mid: 'the css property',
mid: 'the css property ',
post: 'is',
values: [
'',
'',
''
]
},
{
id: 502,
stepType: 'then',
type: 'Tool-Tip',
pre: 'So the element',
mid: 'has the tool-tip ',
values: [
'',
''
]
}, {
id: 3,
stepType: 'then',
Expand Down
Loading