Skip to content

Instantly share code, notes, and snippets.

@aurelienlair
Last active May 15, 2021 11:36
Show Gist options
  • Save aurelienlair/34636e5ef04d7faa9cf06c7b5e67c954 to your computer and use it in GitHub Desktop.
Save aurelienlair/34636e5ef04d7faa9cf06c7b5e67c954 to your computer and use it in GitHub Desktop.
async lookForUniqueExperiences() {
const findDuplicates = (arr) =>
arr.filter((item, index) => arr.indexOf(item) !== index);
let activitiesTitle = [];
const activitiesElements = await this.mobileBrowser.$$(
"[data-test=attractionPage__catalogCards-box] [data-test=ActivityCard__title] a"
);
const promises = activitiesElements.map(async (element) => {
return await element.getText();
});
activitiesTitle = await Promise.all(promises);
const duplicates = findDuplicates(activitiesTitle);
assert.equal(
duplicates.length,
0,
`Found ${duplicates.length} duplicated experiences\n${duplicates}`
);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment