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

fix: seeAttributesOnElements check condition #4029

Merged
merged 6 commits into from
Dec 1, 2023
Merged
Show file tree
Hide file tree
Changes from 3 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 lib/helper/Playwright.js
Original file line number Diff line number Diff line change
Expand Up @@ -2145,7 +2145,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;
});
Expand Down
2 changes: 1 addition & 1 deletion lib/helper/Puppeteer.js
Original file line number Diff line number Diff line change
Expand Up @@ -1815,7 +1815,7 @@ class Puppeteer 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;
});
Expand Down
13 changes: 13 additions & 0 deletions test/helper/webapi.js
Original file line number Diff line number Diff line change
Expand Up @@ -1340,6 +1340,19 @@ module.exports.tests = function () {
}
});

it('should check href with splash', 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();

Expand Down