|
| 1 | +import { ecosystemLinks, resourcesLinks } from "../fixture/homepage.config"; |
| 2 | + |
| 3 | +const viewports = ["iphone-xr", "macbook-16"]; |
| 4 | + |
| 5 | +viewports.forEach((viewport) => { |
| 6 | + context(`Homepage on ${viewport}`, () => { |
| 7 | + beforeEach(() => { |
| 8 | + cy.visit("/"); |
| 9 | + cy.viewport(<Cypress.ViewportPreset>viewport); |
| 10 | + }); |
| 11 | + |
| 12 | + it("should have Explore section dropdown elements", () => { |
| 13 | + if (viewport === "iphone-xr") { |
| 14 | + cy.findByTestId("header-open-menu").click(); |
| 15 | + cy.findByTestId("header-tablet-menu-item-explore").click(); |
| 16 | + } else if (viewport === "macbook-16") { |
| 17 | + cy.findByTestId("header-desktop-dropdown-item-explore").trigger( |
| 18 | + "mouseover" |
| 19 | + ); |
| 20 | + } |
| 21 | + |
| 22 | + cy.findByTestId("header-nav-elem-explore-defiscan-live") |
| 23 | + .should("be.visible") |
| 24 | + .and("have.attr", "href") |
| 25 | + .and("include", "https://defiscan.live/"); |
| 26 | + cy.findByTestId("header-nav-elem-explore-crypto-id") |
| 27 | + .should("be.visible") |
| 28 | + .and("have.attr", "href") |
| 29 | + .and("include", "https://chainz.cryptoid.info/"); |
| 30 | + ecosystemLinks.forEach((ecosystemItem) => { |
| 31 | + cy.findByTestId(`header-nav-elem-explore-${ecosystemItem.headerTestid}`) |
| 32 | + .should("be.visible") |
| 33 | + .and("have.attr", "href") |
| 34 | + .and("include", ecosystemItem.link); |
| 35 | + }); |
| 36 | + }); |
| 37 | + |
| 38 | + // QA-813 - TC2 - Step 2 & 3 |
| 39 | + it("should have Coming soon on Ecosystem and Build sections", () => { |
| 40 | + cy.findByTestId("header-coming-soon-tag-Ecosystem").should( |
| 41 | + "contain", |
| 42 | + "COMING SOON" |
| 43 | + ); |
| 44 | + cy.findByTestId("header-coming-soon-tag-Build").should( |
| 45 | + "contain", |
| 46 | + "COMING SOON" |
| 47 | + ); |
| 48 | + cy.findByTestId("header-coming-soon-tag-Explore").should( |
| 49 | + "not.contain", |
| 50 | + "COMING SOON" |
| 51 | + ); |
| 52 | + cy.findByTestId("header-coming-soon-tag-Community").should( |
| 53 | + "not.contain", |
| 54 | + "COMING SOON" |
| 55 | + ); |
| 56 | + }); |
| 57 | + |
| 58 | + // No TC |
| 59 | + it("should have Get DFI button", () => { |
| 60 | + if (viewport === "iphone-xr") { |
| 61 | + cy.findByTestId("header-open-menu").click(); |
| 62 | + cy.findAllByTestId("header-get-dfi-button").last().click(); |
| 63 | + } else if (viewport === "macbook-16") { |
| 64 | + cy.findAllByTestId("header-get-dfi-button").first().click(); |
| 65 | + } |
| 66 | + cy.url().should("include", "/explore/dfi#get-dfi"); |
| 67 | + cy.findAllByTestId("section-title-purchase-dfi").should("be.visible"); |
| 68 | + }); |
| 69 | + |
| 70 | + // No TC |
| 71 | + it("should have expected Header title and description", () => { |
| 72 | + cy.findByTestId("header-title").should( |
| 73 | + "have.text", |
| 74 | + "Connecting old and new worlds" |
| 75 | + ); |
| 76 | + |
| 77 | + // No TC |
| 78 | + cy.findByTestId("header-desc").should( |
| 79 | + "have.text", |
| 80 | + "A blockchain dedicated to fast, intelligent and transparent decentralized financial services, accessible by everyone." |
| 81 | + ); |
| 82 | + }); |
| 83 | + |
| 84 | + // No TC |
| 85 | + it("should have Start exploring section clickable", () => { |
| 86 | + if (viewport === "iphone-xr") { |
| 87 | + cy.findByTestId("statistic-title-tvl-locked") |
| 88 | + .should("be.visible") |
| 89 | + .and("have.text", "TVL IN USD"); |
| 90 | + } else if (viewport === "macbook-16") { |
| 91 | + cy.findByTestId("start-exploring-button").click({ |
| 92 | + scrollBehavior: false, |
| 93 | + }); |
| 94 | + cy.url().should("include", "/#statistics_display"); |
| 95 | + cy.findByTestId("statistic-title-tvl-locked") |
| 96 | + .should("be.visible") |
| 97 | + .and("have.text", "TOTAL VALUE LOCKED IN USD"); |
| 98 | + } |
| 99 | + |
| 100 | + cy.findByTestId("statistic-title-dfi-minted") |
| 101 | + .should("be.visible") |
| 102 | + .and("have.text", "TOTAL DFI MINTED"); |
| 103 | + cy.findByTestId("statistic-title-masternodes") |
| 104 | + .should("be.visible") |
| 105 | + .and("have.text", "MASTERNODES"); |
| 106 | + }); |
| 107 | + |
| 108 | + // No TC |
| 109 | + it("should have clickable Explore DeFi Meta Chain button", () => { |
| 110 | + cy.findByTestId("secondary-button-explore-dmc") |
| 111 | + .should("be.visible") |
| 112 | + .and("have.attr", "href") |
| 113 | + .and("include", "https://meta.defichain.com"); |
| 114 | + cy.findByTestId("secondary-button-explore-dmc") |
| 115 | + .should("have.attr", "target") |
| 116 | + .and("include", "_blank"); |
| 117 | + }); |
| 118 | + |
| 119 | + // No TC |
| 120 | + it("should have clickable View all articles button", () => { |
| 121 | + cy.findByTestId("secondary-button-view-all-articles") |
| 122 | + .should("be.visible") |
| 123 | + .and("have.attr", "href") |
| 124 | + .and("include", "https://blog.defichain.com"); |
| 125 | + cy.findByTestId("secondary-button-view-all-articles") |
| 126 | + .should("have.attr", "target") |
| 127 | + .and("include", "_blank"); |
| 128 | + }); |
| 129 | + |
| 130 | + // No TC |
| 131 | + it("should have Ecosystem links displayed", () => { |
| 132 | + ecosystemLinks.forEach((ecosystemItem) => { |
| 133 | + cy.findByTestId( |
| 134 | + `ecosystem-link-${ecosystemItem.testid}` |
| 135 | + ).scrollIntoView(); |
| 136 | + cy.findByTestId(`ecosystem-link-${ecosystemItem.testid}`) |
| 137 | + .should("contain", ecosystemItem.title) |
| 138 | + .and("be.visible") |
| 139 | + .and("have.attr", "href") |
| 140 | + .and("include", ecosystemItem.link); |
| 141 | + }); |
| 142 | + }); |
| 143 | + |
| 144 | + // No TC |
| 145 | + it("should have expected Blockchain feature section title and description", () => { |
| 146 | + cy.findByTestId("section-title-non-turing-complete-blockchain").should( |
| 147 | + "be.visible" |
| 148 | + ); |
| 149 | + cy.findByTestId( |
| 150 | + "section-header-Designed,for,Decentralized,Finance" |
| 151 | + ).should("be.visible"); |
| 152 | + cy.findByTestId("section-desc-Designed,for,Decentralized,Finance") |
| 153 | + .should("be.visible") |
| 154 | + .and( |
| 155 | + "have.text", |
| 156 | + "DeFiChain offers comprehensive functionality tailored to the Distributed Ledger Technology (DLT) " + |
| 157 | + "community, with an emphasis on simplicity, speed, and security." |
| 158 | + ); |
| 159 | + }); |
| 160 | + |
| 161 | + // No TC |
| 162 | + it("should have Blockchain features section displayed", () => { |
| 163 | + const textAreas = ["title", "desc"]; |
| 164 | + const features = [ |
| 165 | + "THROUGHPUT", |
| 166 | + "SECURITY", |
| 167 | + "IMMUTABILITY", |
| 168 | + "DEVELOPMENT", |
| 169 | + "VARIETY", |
| 170 | + ]; |
| 171 | + textAreas.forEach((area) => { |
| 172 | + features.forEach((feature) => { |
| 173 | + if (viewport === "iphone-xr" && feature === "DEVELOPMENT") { |
| 174 | + cy.get("ul.blockchain-features-dots").scrollIntoView(); |
| 175 | + cy.get("ul.blockchain-features-dots > li > button") |
| 176 | + .last() |
| 177 | + .click({ scrollBehavior: false }); |
| 178 | + } |
| 179 | + cy.findAllByTestId(`highlights-${feature}-${area}`).should( |
| 180 | + "be.visible" |
| 181 | + ); |
| 182 | + }); |
| 183 | + }); |
| 184 | + }); |
| 185 | + |
| 186 | + // No TC |
| 187 | + it("should have Blog posts with links displayed", () => { |
| 188 | + cy.findAllByTestId("blog-post-container-link") |
| 189 | + .should("be.visible") |
| 190 | + .and("have.attr", "href") |
| 191 | + .and("include", "https://blog.defichain.com/"); |
| 192 | + }); |
| 193 | + |
| 194 | + // No TC |
| 195 | + it("should have Footer Explore links displayed", () => { |
| 196 | + ecosystemLinks.forEach((ecosystemItem) => { |
| 197 | + cy.findByTestId(`footer-${ecosystemItem.footerTestid}`) |
| 198 | + .should("be.visible") |
| 199 | + .should("have.attr", "href", ecosystemItem.link); |
| 200 | + }); |
| 201 | + }); |
| 202 | + |
| 203 | + // No TC |
| 204 | + it("should have Footer Resources links displayed", () => { |
| 205 | + resourcesLinks.forEach((resourcesItem) => { |
| 206 | + cy.findByTestId(`footer-${resourcesItem.footerTestid}`) |
| 207 | + .should("be.visible") |
| 208 | + .should("have.attr", "href", resourcesItem.link); |
| 209 | + }); |
| 210 | + }); |
| 211 | + |
| 212 | + it("should have Footer Social links", () => { |
| 213 | + cy.findAllByTestId("socials-row-github") |
| 214 | + .should("be.visible") |
| 215 | + .should("have.attr", "href", "https://github.com/DeFiCh/ain"); |
| 216 | + cy.findAllByTestId("socials-row-reddit") |
| 217 | + .should("be.visible") |
| 218 | + .should( |
| 219 | + "have.attr", |
| 220 | + "href", |
| 221 | + "https://www.reddit.com/r/defiblockchain/" |
| 222 | + ); |
| 223 | + |
| 224 | + cy.findAllByTestId("socials-row-youtube") |
| 225 | + .should("be.visible") |
| 226 | + .should("have.attr", "href", "https://www.youtube.com/DeFiChain"); |
| 227 | + cy.findAllByTestId("socials-row-telegram") |
| 228 | + .should("be.visible") |
| 229 | + .should("have.attr", "href", "https://t.me/defiblockchain"); |
| 230 | + cy.findAllByTestId("socials-row-twitter") |
| 231 | + .should("be.visible") |
| 232 | + .should("have.attr", "href", "https://twitter.com/defichain"); |
| 233 | + }); |
| 234 | + |
| 235 | + it("should have Privacy policy link", () => { |
| 236 | + if (viewport === "iphone-xr") { |
| 237 | + cy.findAllByTestId("footer-mobile-privacy") |
| 238 | + .should("be.visible") |
| 239 | + .should("have.attr", "href", "/privacy-policy"); |
| 240 | + } else if (viewport === "macbook-16") { |
| 241 | + cy.findAllByTestId("footer-web-privacy") |
| 242 | + .should("be.visible") |
| 243 | + .should("have.attr", "href", "/privacy-policy"); |
| 244 | + } |
| 245 | + }); |
| 246 | + |
| 247 | + it("should have Language dropdown", () => { |
| 248 | + cy.findAllByTestId("site-lang-dropdown").should("be.visible"); |
| 249 | + }); |
| 250 | + }); |
| 251 | +}); |
0 commit comments