streamlit

Форк
0
/
iframe_resizer.spec.js 
92 строки · 2.8 Кб
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
 */
16
describe("Iframed Streamlit", () => {
17
  before(() => {
18
    cy.visit("cypress/assets/iframed_streamlit.html");
19

20
    cy.get("iframe").should("have.length", 3);
21
  });
22

23
  it("renders an embedded iframe correctly and expands", () => {
24
    cy.get("iframe")
25
      .first()
26
      .iframe(() => {
27
        cy.get(".stSlider").should("have.length", 1);
28
        cy.prepForElementSnapshots();
29
      });
30

31
    cy.get("iframe").first().matchImageSnapshot("embedded_iframe");
32

33
    cy.get("iframe")
34
      .first()
35
      .iframe(() => {
36
        // trigger click in the center of the slider
37
        cy.get('.stSlider [role="slider"]').parent().click();
38
        // Wait for all the elements to be rendered
39
        cy.get(".stMarkdown").should("have.length", 10);
40
      });
41

42
    cy.get("iframe").first().matchImageSnapshot("embedded_iframe_expanded");
43
  });
44

45
  it("renders an unembedded iframe correctly and expands", () => {
46
    cy.get("iframe")
47
      .eq(1)
48
      .iframe(() => {
49
        cy.get(".stSlider").should("have.length", 1);
50
        cy.prepForElementSnapshots();
51
      });
52

53
    cy.get("iframe").eq(1).matchImageSnapshot("unembedded_iframe");
54

55
    cy.get("iframe")
56
      .eq(1)
57
      .iframe(() => {
58
        // trigger click in the center of the slider
59
        cy.get('.stSlider [role="slider"]').parent().click();
60
        // Wait for all the elements to be rendered
61
        cy.get(".stMarkdown").should("have.length", 10);
62
      });
63

64
    cy.get("iframe").eq(1).matchImageSnapshot("unembedded_iframe_expanded");
65
  });
66

67
  it("renders an unembedded iframe with a min height correctly and expands", () => {
68
    cy.get("iframe")
69
      .eq(2)
70
      .iframe(() => {
71
        cy.get(".stSlider").should("have.length", 1);
72
        cy.prepForElementSnapshots();
73
      });
74

75
    cy.get("iframe")
76
      .eq(2)
77
      .matchImageSnapshot("unembedded_iframe_with_min_height");
78

79
    cy.get("iframe")
80
      .eq(2)
81
      .iframe(() => {
82
        // trigger click in the center of the slider
83
        cy.get('.stSlider [role="slider"]').parent().click();
84
        // Wait for all the elements to be rendered
85
        cy.get(".stMarkdown").should("have.length", 10);
86
      });
87

88
    cy.get("iframe")
89
      .eq(2)
90
      .matchImageSnapshot("unembedded_iframe_with_min_height_expanded");
91
  });
92
});
93

Использование cookies

Мы используем файлы cookie в соответствии с Политикой конфиденциальности и Политикой использования cookies.

Нажимая кнопку «Принимаю», Вы даете АО «СберТех» согласие на обработку Ваших персональных данных в целях совершенствования нашего веб-сайта и Сервиса GitVerse, а также повышения удобства их использования.

Запретить использование cookies Вы можете самостоятельно в настройках Вашего браузера.