diff --git a/lib/helper/Playwright.js b/lib/helper/Playwright.js index 4e51901df..067a84e03 100644 --- a/lib/helper/Playwright.js +++ b/lib/helper/Playwright.js @@ -2154,7 +2154,7 @@ class Playwright extends Helper { let chunked = chunkArray(attrs, values.length); chunked = chunked.filter((val) => { for (let i = 0; i < val.length; ++i) { - if (val[i] !== values[i]) return false; + if (!val[i].includes(values[i])) return false; } return true; }); diff --git a/lib/helper/Puppeteer.js b/lib/helper/Puppeteer.js index b3f6f05e5..13c97b431 100644 --- a/lib/helper/Puppeteer.js +++ b/lib/helper/Puppeteer.js @@ -1817,9 +1817,9 @@ class Puppeteer extends Helper { let chunked = chunkArray(attrs, values.length); chunked = chunked.filter((val) => { for (let i = 0; i < val.length; ++i) { - const _acutal = Number.isNaN(val[i]) || (typeof values[i]) === 'string' ? val[i] : Number.parseInt(val[i], 10); + const _actual = Number.isNaN(val[i]) || (typeof values[i]) === 'string' ? val[i] : Number.parseInt(values[i], 10); const _expected = Number.isNaN(values[i]) || (typeof values[i]) === 'string' ? values[i] : Number.parseInt(values[i], 10); - if (_acutal !== _expected) return false; + if (!_actual.includes(_expected)) return false; } return true; }); diff --git a/test/helper/webapi.js b/test/helper/webapi.js index eb4d6b7b1..3c9ea7b1c 100644 --- a/test/helper/webapi.js +++ b/test/helper/webapi.js @@ -1340,6 +1340,19 @@ module.exports.tests = function () { } }); + it('should check href with slash', async function () { + if (isHelper('TestCafe') || isHelper('WebDriver')) this.skip(); + + try { + await I.amOnPage('https://github.com/codeceptjs/CodeceptJS/'); + await I.seeAttributesOnElements({ css: 'a[href="/team"]' }, { + href: '/team', + }); + } catch (e) { + e.message.should.include('all elements (a[href="/team"]) to have attributes {"href":"/team"}'); + } + }); + it('should check attributes values for several elements', async function () { if (isHelper('TestCafe')) this.skip();