mysterious-belgium-25713
10/31/2022, 3:59 PMacceptable-fall-11897
10/31/2022, 7:21 PMhandsome-army-58690
10/31/2022, 7:46 PMmysterious-belgium-25713
10/31/2022, 8:01 PMstale-optician-85950
10/31/2022, 8:14 PM--key
value in your CLI, and I don't see it being passed as an env var in that image.chilly-queen-22182
10/31/2022, 9:05 PMstale-optician-85950
10/31/2022, 9:36 PMquaint-kilobyte-18208
11/01/2022, 11:16 AMred-bird-50588
11/01/2022, 12:26 PMstale-optician-85950
11/01/2022, 12:47 PMred-bird-50588
11/01/2022, 12:50 PMstale-optician-85950
11/01/2022, 12:54 PMinvoke
incorrectly here, it might not be a text, maybe a .invoke('val')
. You'll need to check your html again to be sure.red-bird-50588
11/01/2022, 12:58 PMmelodic-energy-94905
11/01/2022, 1:40 PMgray-kilobyte-89541
11/01/2022, 1:43 PMwhile
loop is not going to work, since it will always be empty until max stack size is exhausted Cypress recurse plugin is your best betcrooked-yak-38149
11/01/2022, 4:15 PM[data-automation-id=tagging-image-<number>]
eg I may expect [data-automation-id=tagging-image-1]
, [data-automation-id=tagging-image-3]
and ``[data-automation-id=tagging-image-5]` to exist, and I want to assert that no other [data-automation-id=tagging-image-<number>]
elements exist.
The elements which should be present are in an array - how could I write the below code so that the .not()
commands are built up from the array? (The 3 lines after the -->
comment)
const assertTaggingPageContainsImages = (selectedImages) => {
for (var i=0; i < selectedImages.length; i++){
//cy.log(`Checking for existence of tagging-image-${selectedImages[i]}`)
// Check that this image exists
cy.getTestTag(`tagging-image-${selectedImages[i]}`)
.should('exist');
}
// ToDo: Assert that no other tagging-image- elements exist, other than the ones that should
cy
// Get list of all tagging-image elements
.get(`[data-automation-id^="tagging-image-"]`)
// Filter out ones that we SHOULD see
// --> How do I re-write the below commands to dynamically build depending on the number of elements in the array?
.not(`[data-automation-id=tagging-image-${selectedImages[0]}]`)
.not(`[data-automation-id=tagging-image-${selectedImages[1]}]`)
.not(`[data-automation-id=tagging-image-${selectedImages[2]}]`)
// Assert that no others exist
.should("not.exist");
}
crooked-yak-38149
11/01/2022, 4:27 PMcy
.get(`[data-automation-id^="tagging-image-"]`)
.should("have.length", selectedImages.length);
crooked-yak-38149
11/01/2022, 4:28 PMbillowy-librarian-83114
11/01/2022, 5:02 PMhandsome-army-58690
11/01/2022, 5:22 PM:contains(${element.displayName})
).should('have.length', 1)
});crooked-yak-38149
11/01/2022, 5:27 PMcy.getByDataTest('document-list')
? Is that just implying a custom command that expands to cy.get('[data-automation-id=document-list]')
?handsome-army-58690
11/01/2022, 5:28 PMcrooked-yak-38149
11/01/2022, 5:29 PMcrooked-yak-38149
11/01/2022, 5:32 PM[<automation tag>=<value>]
and one that does [<automation tag>^=<value>]
- just wondered if there was maybe a more elegant / standardized waycold-eye-66538
11/01/2022, 6:48 PMquaint-kilobyte-18208
11/02/2022, 6:30 AMclever-salesmen-46486
11/02/2022, 12:00 PMclever-salesmen-46486
11/02/2022, 12:04 PMred-honey-44438
11/02/2022, 12:09 PM