add more tests

This commit is contained in:
hzrd149 2023-06-09 12:57:13 -04:00
parent 9ea4d431b9
commit 3af800f772
5 changed files with 70 additions and 6 deletions

1
.gitignore vendored
View File

@ -1,2 +1,3 @@
dist
node_modules
cypress/videos

View File

@ -76,4 +76,42 @@ describe("Embeds", () => {
cy.findByTitle(/youtube video player/i).should("have.attr", "src");
});
});
describe("Music", () => {
it("should handle wavlake links", () => {
cy.visit(
"#/n/nevent1qqsve4ud5v8gjds2f2h7exlmjvhqayu4s520pge7frpwe22wezny0pcpp4mhxue69uhkummn9ekx7mqprdmhxue69uhkvet9v3ejumn0wd68ytnzv9hxgtmdv4kk2mxs3z0"
);
cy.findByTitle("Wavlake Embed").should("be.visible");
});
it("should handle spotify links", () => {
cy.visit(
"#/n/nevent1qqsx0lz7m72qzq499exwhnfszvgwea8tv38x9wkv32yhkmwwmhgs7jgprdmhxue69uhkvet9v3ejumn0wd68ytnzv9hxgtmdv4kk25m3sln"
);
cy.findByTitle("Spotify List Embed").should("exist");
cy.visit(
"#/n/nevent1qqsqxkmz49hydf8ppa9k6x6zrcq7m4evhhlye0j3lcnz8hrl2q6np4spz3mhxue69uhhyetvv9ujuerpd46hxtnfdult02qz"
);
cy.findByTitle("Spotify Embed").should("exist");
});
it("should handle apple music links", () => {
cy.visit(
"#/n/nevent1qqs9kqt9d7r4zjpawcyl82x5qsn4hals4wn294dv95knrahs4mggwasprdmhxue69uhkvet9v3ejumn0wd68ytnzv9hxgtmdv4kk2whhzvz"
);
cy.findByTitle("Apple Music Embed").should("exist");
cy.visit(
"#/n/nevent1qqszyrz4uug75j4086kj4f8peg3g0v8g9f04zjxplnpq0uxljtthggqprdmhxue69uhkvet9v3ejumn0wd68ytnzv9hxgtmdv4kk2aeexmq"
);
cy.findByTitle("Apple Music List Embed").should("exist");
});
it("should handle Tidal playlist links", () => {
cy.visit("#/n/nevent1qqsg4d6rvg3te0y7sa0xp8r2rgcrnqyp2jmddzm4ufnmqs36aa2247qpp4mhxue69uhkummn9ekx7mqacwd3t");
cy.findByTitle("Tidal List Embed").should("be.visible");
});
});
});

View File

@ -47,4 +47,22 @@ describe("Login view", () => {
cy.findByRole("button", { name: "Home" }).should("be.visible");
});
it("should redirect after login", () => {
cy.visit(
"#/n/nevent1qqs88gdxv36qsjfwr66k7wxuq9r2tg8rsdcnfkcqdg4sc6vlnsma98qpzpmhxue69uhkummnw3ezuamfdejsz9rhwden5te0wfjkccte9ejxzmt4wvhxjmccew89d"
);
cy.findByRole("link", { name: /login/i }).click();
cy.findByRole("link", { name: /nsec/i }).click();
cy.findByRole("button", { name: /generate/i }).click();
cy.findByRole("combobox", { name: /bootstrap relay/i })
.clear()
.type("wss://nostrue.com");
cy.findByRole("button", { name: /login/i }).click();
// should be redirect to note
cy.contains(/GM, and happy bday to your son/i);
});
});

View File

@ -7,7 +7,8 @@
"start": "vite serve",
"build": "tsc --project tsconfig.json && vite build",
"format": "prettier --ignore-path .prettierignore -w .",
"e2e": "cypress open"
"e2e": "cypress open",
"test": "cypress run --e2e --browser=chrome"
},
"dependencies": {
"@chakra-ui/icons": "^2.0.19",

View File

@ -1,6 +1,3 @@
import { EmbedableContent, embedJSX } from "../../helpers/embeds";
import appSettings from "../../services/app-settings";
// nostr:nevent1qqsve4ud5v8gjds2f2h7exlmjvhqayu4s520pge7frpwe22wezny0pcpp4mhxue69uhkummn9ekx7mqprdmhxue69uhkvet9v3ejumn0wd68ytnzv9hxgtmdv4kk2mxs3z0
export function renderWavlakeUrl(match: URL) {
if (match.hostname !== "wavlake.com") return null;
@ -12,6 +9,7 @@ export function renderWavlakeUrl(match: URL) {
<iframe
loading="lazy"
frameBorder="0"
title="Wavlake Embed"
src={embedUrl.toString()}
style={{ width: "100%", aspectRatio: 576 / 356, maxWidth: 573 }}
></iframe>
@ -32,6 +30,7 @@ export function renderAppleMusicUrl(match: URL) {
<iframe
allow="encrypted-media *; fullscreen *; clipboard-write"
frameBorder="0"
title={isList ? "Apple Music List Embed" : "Apple Music Embed"}
height={isList ? 450 : 175}
style={{ width: "100%", maxWidth: "660px", overflow: "hidden", background: "transparent" }}
src={embedUrl.toString()}
@ -57,7 +56,7 @@ export function renderSpotifyUrl(match: URL) {
style={{ borderRadius: "12px" }}
width="100%"
height={isList ? 400 : 152}
title="Spotify Embed: Beethoven - Fur Elise - Komuz Remix"
title={isList ? "Spotify List Embed" : "Spotify Embed"}
frameBorder="0"
allowFullScreen
allow="autoplay; clipboard-write; encrypted-media; fullscreen; picture-in-picture"
@ -77,5 +76,12 @@ export function renderTidalUrl(match: URL) {
const embedUrl = new URL(`https://embed.tidal.com/${type}s/${id}`);
embedUrl.searchParams.set("disableAnalytics", "true");
return <iframe src={embedUrl.toString()} width="100%" height={isList ? 400 : 96}></iframe>;
return (
<iframe
src={embedUrl.toString()}
width="100%"
height={isList ? 400 : 96}
title={isList ? "Tidal List Embed" : "Tidal Embed"}
></iframe>
);
}