2425-ticket_descriptor_menu #447

Merged
carlosjr merged 11 commits from 2425-ticket_descriptor_menu into dev 2020-11-11 13:45:02 +00:00
4 changed files with 40 additions and 22 deletions
Showing only changes of commit 82c739eab2 - Show all commits

View File

@ -247,7 +247,7 @@ let actions = {
write: async function(selector, text) { write: async function(selector, text) {
let builtSelector = await this.selectorFormater(selector); let builtSelector = await this.selectorFormater(selector);
await this.waitForSelector(selector, {}); await this.waitForSelector(selector);
await this.type(builtSelector, text); await this.type(builtSelector, text);
await this.waitForTextInField(selector, text); await this.waitForTextInField(selector, text);
}, },
@ -340,6 +340,31 @@ let actions = {
}); });
}, },
waitForTextInField: async function(selector, text) {
let builtSelector = await this.selectorFormater(selector);
await this.waitForSelector(builtSelector);
const expectedText = text.toLowerCase();
return new Promise((resolve, reject) => {
let attempts = 0;
const interval = setInterval(async() => {
const currentText = await this.evaluate(selector => {
return document.querySelector(selector).value.toLowerCase();
}, builtSelector);
if (currentText === expectedText || attempts === 40) {
clearInterval(interval);
resolve(currentText);
}
attempts += 1;
}, 100);
}).then(result => {
if (result === '')
return expect(result).toEqual(expectedText);
return expect(result).toContain(expectedText);
});
},
selectorFormater: function(selector) { selectorFormater: function(selector) {
if (selector.includes('vn-textarea')) if (selector.includes('vn-textarea'))
return `${selector} textarea`; return `${selector} textarea`;
@ -350,14 +375,6 @@ let actions = {
return `${selector} input`; return `${selector} input`;
}, },
waitForTextInField: async function(selector, text) {
let builtSelector = await this.selectorFormater(selector);
await this.waitForSelector(builtSelector);
return await this.waitForFunction((selector, text) => {
return document.querySelector(selector).value.toLowerCase().includes(text.toLowerCase());
}, {}, builtSelector, text);
},
waitForInnerText: async function(selector) { waitForInnerText: async function(selector) {
await this.waitForSelector(selector, {}); await this.waitForSelector(selector, {});
await this.waitForFunction(selector => { await this.waitForFunction(selector => {

View File

@ -1,7 +1,7 @@
import selectors from '../../../helpers/selectors.js'; import selectors from '../../../helpers/selectors.js';
import getBrowser from '../../../helpers/puppeteer'; import getBrowser from '../../../helpers/puppeteer';
fdescribe('Ticket List sale path', () => { describe('Ticket List sale path', () => {
let browser; let browser;
let page; let page;

View File

@ -62,6 +62,7 @@ describe('Supplier contact path', () => {
}); });
it(`should check the new contact note was saved correctly`, async() => { it(`should check the new contact note was saved correctly`, async() => {
await page.waitForTextInField(selectors.supplierContact.thirdContactNotes, 'the end to end integration tester');
const result = await page.waitToGetProperty(selectors.supplierContact.thirdContactNotes, 'value'); const result = await page.waitToGetProperty(selectors.supplierContact.thirdContactNotes, 'value');
expect(result).toContain('the end to end integration tester'); expect(result).toContain('the end to end integration tester');

View File

@ -187,7 +187,7 @@ function e2eSingleRun() {
displaySpecDuration: true, displaySpecDuration: true,
}, },
summary: { summary: {
displayStacktrace: 'pretty', displayStacktrace: 'raw',
displayPending: false displayPending: false
}, },
colors: { colors: {
@ -195,17 +195,17 @@ function e2eSingleRun() {
successful: 'brightGreen', successful: 'brightGreen',
failed: 'brightRed' failed: 'brightRed'
}, },
stacktrace: { // stacktrace: {
filter: stacktrace => { // filter: stacktrace => {
const lines = stacktrace.split('\n'); // const lines = stacktrace.split('\n');
const filtered = []; // const filtered = [];
for (let i = 1; i < lines.length; i++) { // for (let i = 1; i < lines.length; i++) {
if (/e2e\/paths/.test(lines[i])) // if (/e2e\/paths/.test(lines[i]))
filtered.push(lines[i]); // filtered.push(lines[i]);
} // }
return filtered.join('\n'); // return filtered.join('\n');
} // }
} // }
}) })
] ]
})); }));