cold-van-45410
09/19/2022, 8:01 AMcurved-morning-53652
09/19/2022, 8:54 AMfast-motherboard-28167
09/19/2022, 10:34 AMhappy-dinner-13480
09/19/2022, 2:03 PMtable
with a variable number of tr
elements. Each tr
is clickable and when clicked a modal opens (always the same modal for each tr
). In the modal a toggle has to be set:
typescript
it('Set payment methods', () => {
cy.el('tablePaymentMethods')
.children()
.each(($el, index) => {
cy.intercept({
method: 'PATCH',
url: `${Cypress.env('API_URL')}/api/v1/company/*/paymentMethod/*?cache_buster=*`,
}).as('paymentMethod');
cy.wrap($el).click();
cy.el('toggleActive').click();
cy.el('btnEditPaymentMethod').click();
cy.wait('@paymentMethod').then((data: any) => {
expect(data.response.body.data.active).to.eq(true);
});
});
});
The problem with this test is that Cypress executes them at the same time, showing me the error:
> is being covered by another element
I can use force: true
to still click on the toggle but I would much rather wait with clicking on the second tr
when the cy.wait()
has gotten a response (meaning the first modal is closed).acceptable-hamburger-48790
09/19/2022, 2:22 PMhappy-dinner-13480
09/19/2022, 2:36 PMgifted-bear-34349
09/19/2022, 4:06 PMcy.contains('Some text).should('exist')
checks to see if the text we want is displaying on the page. I refactored it to look like this:
before(() => {
cy.fixture("users.json").then(() => {
cy.login(Cypress.env("username"), Cypress.env("password"));
cy.intercept({
method: 'GET',
url: apiUrl
}).as('body');
cy.visitApp("/help?lang=eng");
});
});
it("fsy_help_page : Smoke Test", function () {
cy.get("h1").contains("Help").should("exist");
cy.wait('@body').then((intercept) => {
let pageText = intercept.response.body.body;
//removes all the html tags present in text
let cleanPageText = pageText.replaceAll(/<(.+?)>/g, "").replaceAll(/ | /g, " ").split("\n").filter(entry => entry.trim() != '');
cleanPageText.forEach(paragraph => {
cy.contains(paragraph).should('exist');
});
});
cy.get('main').within((body) => {
if (body.find('a').length > 0) {
cy.get('a').each(($el) => {
cy.wrap($el).should("have.attr", "href");
})
}
});
});
I was wondering if there is a functional difference between the two approachesbitter-fountain-36713
09/19/2022, 4:07 PMfresh-nail-30646
09/19/2022, 7:47 PMcy.task()
to query a Postgres db? The example for MySQL in documentation is great, but can't find something that works with Postgres.cold-van-45410
09/20/2022, 5:50 AMworried-shampoo-96177
09/20/2022, 5:57 AMworried-shampoo-96177
09/20/2022, 5:58 AMgray-kilobyte-89541
09/20/2022, 10:41 AMmysterious-belgium-25713
09/20/2022, 1:52 PMmicroscopic-fish-5767
09/20/2022, 2:27 PMmysterious-belgium-25713
09/20/2022, 2:49 PMmicroscopic-fish-5767
09/20/2022, 3:36 PMmicroscopic-fish-5767
09/20/2022, 3:37 PMmicroscopic-fish-5767
09/20/2022, 3:38 PMmicroscopic-fish-5767
09/20/2022, 3:40 PMmysterious-belgium-25713
09/20/2022, 3:42 PMmammoth-knife-96508
09/20/2022, 3:50 PMgray-kilobyte-89541
09/20/2022, 4:23 PMlimited-barista-33480
09/20/2022, 4:28 PMbitter-fountain-36713
09/20/2022, 4:45 PMaws-iot-device-sdk
packagequaint-yacht-91780
09/20/2022, 4:50 PMlimited-barista-33480
09/20/2022, 4:51 PMpolite-lunch-8069
09/20/2022, 5:08 PMpolite-lunch-8069
09/20/2022, 5:10 PMbitter-fountain-36713
09/20/2022, 5:33 PM