freezing-piano-2792
01/13/2023, 9:35 PMfreezing-piano-2792
01/13/2023, 9:36 PMbitter-fountain-36713
01/14/2023, 7:37 PMpowerful-orange-86819
01/15/2023, 9:43 AMgreen-controller-97889
01/16/2023, 1:20 AMjs
cy.log("This page has a section split in two columns");
cy.get("[data-cy='section-two-columns']")
.scrollIntoView()
.should("have.length", 1);
cy.log("Check the left column");
cy.get("[data-cy='section-two-columns']").then((twoCol) => {
cy.wrap(twoCol).find("[data-cy='subheader']").should("have.length", 2);
cy.wrap(twoCol)
.find("[data-cy='subheader']")
.each((subheader) => {
cy.wrap(subheader).invoke("text").should("be.oneOf", titles);
});
cy.wrap(twoCol)
.find("[data-cy='section-content']")
.should("have.length", 1);
cy.log("Check right column");
cy.wrap(twoCol)
.find("[data-cy='big-info']")
.should("have.length", 1)
.contains("234,370");
cy.wrap(twoCol)
.find("[data-cy='section-two-columns-icon']")
.scrollIntoView()
.should("be.visible");
cy.wrap(twoCol)
.find("[data-cy='small-info']")
.should("have.length", 1)
.contains("9% increase over 2018");
cy.wrap(twoCol)
.find("[data-cy='more-details-url']")
.should("have.length", 1)
.contains("See where it happens");
});
});
Is it possible to replace: cy.wrap(twoCol).find("child-element)
and get the element without searching for it using find
?
Can cy.get()
work "block-scoped" ? Meaning can you write it on some way that it will ONLY get elements that are children of another element ?late-planet-4481
01/17/2023, 2:33 PMpurple-afternoon-2408
01/18/2023, 4:04 AMenough-truck-68085
01/18/2023, 5:02 AMpurple-afternoon-2408
01/18/2023, 5:03 AMpurple-yak-62116
01/18/2023, 8:49 PMlate-planet-4481
01/18/2023, 10:14 PMpurple-yak-62116
01/18/2023, 10:17 PMlate-planet-4481
01/18/2023, 10:19 PMpurple-yak-62116
01/18/2023, 10:20 PMlate-planet-4481
01/18/2023, 10:21 PMpurple-yak-62116
01/18/2023, 10:23 PMcold-author-79999
01/19/2023, 5:25 AMbitter-fountain-36713
01/19/2023, 5:35 AM.filter()
https://docs.cypress.io/api/commands/filter#docusaurus_skipToContent_fallbackwhite-mouse-85089
01/19/2023, 8:28 AMdescribe("Page accessibility tests", () => {
beforeEach(() => {
cy.visit("https://www.knowit.no");
cy.contains("button", "Godta alle").click({ force: true });
cy.contains("Meny").click();
cy.injectAxe();
});
it("should open om oss page and run checkally", () => {
// Find and click on "Om oss" list-button
cy.contains("Om oss").click();
// Verfiy that the page has title "Om oss"
cy.get("h1").should("have.text", "Om oss");
cy.checkA11y();
});
it("should open Kunder and run checkally", () => {
// Find and click on "Kunder" list-button
cy.contains("Kunder").click();
// Verfiy that the page has title "Kunder"
cy.get("h1").should("have.text", "Kunder");
cy.checkA11y();
});
it("should open om Tjenester and run checkally", () => {
// Find and click on "Tjenester" list-button
cy.contains("Tjenester").click();
// Find and click on "Tjenester" list-button
cy.contains("Systemløsninger").click();
// Verfiy that the page has title "Tjenester"
cy.get("h1").should("have.text", "Tjenester");
cy.checkA11y();
});
});
cold-author-79999
01/19/2023, 11:56 AMhundreds-rainbow-52802
01/19/2023, 12:37 PMgray-kilobyte-89541
01/19/2023, 1:25 PMcy.filter
by searching for examples at https://cypress.tips/searchcold-author-79999
01/19/2023, 5:30 PMcold-author-79999
01/19/2023, 5:34 PMcold-author-79999
01/19/2023, 5:35 PMcold-author-79999
01/19/2023, 5:40 PMgray-kilobyte-89541
01/19/2023, 5:56 PMcy.filter
https://glebbahmutov.com/cypress-examples/commands/traversal.html#filter What are you trying to validate? Extract column from the table?