streamlit
1/**
2* Copyright (c) Streamlit Inc. (2018-2022) Snowflake Inc. (2022-2024)
3*
4* Licensed under the Apache License, Version 2.0 (the "License");
5* you may not use this file except in compliance with the License.
6* You may obtain a copy of the License at
7*
8* http://www.apache.org/licenses/LICENSE-2.0
9*
10* Unless required by applicable law or agreed to in writing, software
11* distributed under the License is distributed on an "AS IS" BASIS,
12* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13* See the License for the specific language governing permissions and
14* limitations under the License.
15*/
16describe("Iframed Streamlit", () => {17before(() => {18cy.visit("cypress/assets/iframed_streamlit.html");19
20cy.get("iframe").should("have.length", 3);21});22
23it("renders an embedded iframe correctly and expands", () => {24cy.get("iframe")25.first()26.iframe(() => {27cy.get(".stSlider").should("have.length", 1);28cy.prepForElementSnapshots();29});30
31cy.get("iframe").first().matchImageSnapshot("embedded_iframe");32
33cy.get("iframe")34.first()35.iframe(() => {36// trigger click in the center of the slider37cy.get('.stSlider [role="slider"]').parent().click();38// Wait for all the elements to be rendered39cy.get(".stMarkdown").should("have.length", 10);40});41
42cy.get("iframe").first().matchImageSnapshot("embedded_iframe_expanded");43});44
45it("renders an unembedded iframe correctly and expands", () => {46cy.get("iframe")47.eq(1)48.iframe(() => {49cy.get(".stSlider").should("have.length", 1);50cy.prepForElementSnapshots();51});52
53cy.get("iframe").eq(1).matchImageSnapshot("unembedded_iframe");54
55cy.get("iframe")56.eq(1)57.iframe(() => {58// trigger click in the center of the slider59cy.get('.stSlider [role="slider"]').parent().click();60// Wait for all the elements to be rendered61cy.get(".stMarkdown").should("have.length", 10);62});63
64cy.get("iframe").eq(1).matchImageSnapshot("unembedded_iframe_expanded");65});66
67it("renders an unembedded iframe with a min height correctly and expands", () => {68cy.get("iframe")69.eq(2)70.iframe(() => {71cy.get(".stSlider").should("have.length", 1);72cy.prepForElementSnapshots();73});74
75cy.get("iframe")76.eq(2)77.matchImageSnapshot("unembedded_iframe_with_min_height");78
79cy.get("iframe")80.eq(2)81.iframe(() => {82// trigger click in the center of the slider83cy.get('.stSlider [role="slider"]').parent().click();84// Wait for all the elements to be rendered85cy.get(".stMarkdown").should("have.length", 10);86});87
88cy.get("iframe")89.eq(2)90.matchImageSnapshot("unembedded_iframe_with_min_height_expanded");91});92});93