Last active
May 15, 2021 11:36
-
-
Save aurelienlair/34636e5ef04d7faa9cf06c7b5e67c954 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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