From 2c83fcec928ed79a2b9ebc704f8b434fcccc69e0 Mon Sep 17 00:00:00 2001 From: Martha Cryan Date: Mon, 11 Mar 2024 13:55:55 -0500 Subject: [PATCH 01/19] Attempt to make tests less flaky --- tests/streamlit_ui_tests/taskpanes/file_import.spec.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tests/streamlit_ui_tests/taskpanes/file_import.spec.ts b/tests/streamlit_ui_tests/taskpanes/file_import.spec.ts index 9bf8222e0..c74a8a499 100644 --- a/tests/streamlit_ui_tests/taskpanes/file_import.spec.ts +++ b/tests/streamlit_ui_tests/taskpanes/file_import.spec.ts @@ -18,9 +18,9 @@ test.describe('File Import Taskpane', () => { await expect(mito.getByText('test.csv')).toBeVisible(); }); - test('Test import CSV File with double click', async ({ page }) => { + test.only('Test import CSV File with double click', async ({ page }) => { const mito = await getMitoFrame(page); - await mito.getByRole('button', { name: 'Import Files' }).click(); + await mito.locator('button', { hasText: 'Import Files' }).click(); await mito.getByText('test.csv').dblclick(); await expect(mito.getByTitle('Column1')).toBeVisible(); }); From 3da37dd0fcab86c128bd8f5f6e4f369eb4a15c6b Mon Sep 17 00:00:00 2001 From: Martha Cryan Date: Mon, 11 Mar 2024 13:57:47 -0500 Subject: [PATCH 02/19] remove only --- tests/streamlit_ui_tests/taskpanes/file_import.spec.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/streamlit_ui_tests/taskpanes/file_import.spec.ts b/tests/streamlit_ui_tests/taskpanes/file_import.spec.ts index c74a8a499..a56770c87 100644 --- a/tests/streamlit_ui_tests/taskpanes/file_import.spec.ts +++ b/tests/streamlit_ui_tests/taskpanes/file_import.spec.ts @@ -18,7 +18,7 @@ test.describe('File Import Taskpane', () => { await expect(mito.getByText('test.csv')).toBeVisible(); }); - test.only('Test import CSV File with double click', async ({ page }) => { + test('Test import CSV File with double click', async ({ page }) => { const mito = await getMitoFrame(page); await mito.locator('button', { hasText: 'Import Files' }).click(); await mito.getByText('test.csv').dblclick(); From b1bd8f63ecd1c6c558817ad23d2cde8d6eb4a985 Mon Sep 17 00:00:00 2001 From: Martha Cryan Date: Mon, 11 Mar 2024 14:15:27 -0500 Subject: [PATCH 03/19] Try awaiting before clicking button --- tests/streamlit_ui_tests/taskpanes/file_import.spec.ts | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/tests/streamlit_ui_tests/taskpanes/file_import.spec.ts b/tests/streamlit_ui_tests/taskpanes/file_import.spec.ts index a56770c87..5ce292a35 100644 --- a/tests/streamlit_ui_tests/taskpanes/file_import.spec.ts +++ b/tests/streamlit_ui_tests/taskpanes/file_import.spec.ts @@ -1,6 +1,6 @@ import { expect, test } from '@playwright/test'; -import { checkColumnCellsHaveExpectedValues, checkOpenTaskpane, clickButtonAndAwaitResponse, clickTab, getMitoFrame, getMitoFrameWithTestCSV } from '../utils'; +import { awaitResponse, checkColumnCellsHaveExpectedValues, checkOpenTaskpane, clickButtonAndAwaitResponse, clickTab, getMitoFrame, getMitoFrameWithTestCSV } from '../utils'; const openImportTaskpaneAndSelectData = async (mito: any, file: string) => { await mito.locator('.mito-toolbar-button', { hasText: 'Import' }).click(); @@ -12,14 +12,15 @@ test.describe('File Import Taskpane', () => { test('Test import CSV file', async ({ page }) => { const mito = await getMitoFrameWithTestCSV(page); - await clickTab(page, mito, 'Data'); + await awaitResponse(page); - await clickButtonAndAwaitResponse(page, mito, 'Import Files'); + await mito.locator('button', { hasText: 'Import Files' }).click(); await expect(mito.getByText('test.csv')).toBeVisible(); }); test('Test import CSV File with double click', async ({ page }) => { const mito = await getMitoFrame(page); + await awaitResponse(page); await mito.locator('button', { hasText: 'Import Files' }).click(); await mito.getByText('test.csv').dblclick(); await expect(mito.getByTitle('Column1')).toBeVisible(); From 752ad95cf17d1f8d1aa499af5cef88d0afbfc3c6 Mon Sep 17 00:00:00 2001 From: Martha Cryan Date: Mon, 11 Mar 2024 14:26:37 -0500 Subject: [PATCH 04/19] Remove duplicate test --- .../taskpanes/file_import.spec.ts | 13 +------------ 1 file changed, 1 insertion(+), 12 deletions(-) diff --git a/tests/streamlit_ui_tests/taskpanes/file_import.spec.ts b/tests/streamlit_ui_tests/taskpanes/file_import.spec.ts index 5ce292a35..d5e5c3fd6 100644 --- a/tests/streamlit_ui_tests/taskpanes/file_import.spec.ts +++ b/tests/streamlit_ui_tests/taskpanes/file_import.spec.ts @@ -9,20 +9,9 @@ const openImportTaskpaneAndSelectData = async (mito: any, file: string) => { } test.describe('File Import Taskpane', () => { - - test('Test import CSV file', async ({ page }) => { - const mito = await getMitoFrameWithTestCSV(page); - await awaitResponse(page); - - await mito.locator('button', { hasText: 'Import Files' }).click(); - await expect(mito.getByText('test.csv')).toBeVisible(); - }); - test('Test import CSV File with double click', async ({ page }) => { const mito = await getMitoFrame(page); - await awaitResponse(page); - await mito.locator('button', { hasText: 'Import Files' }).click(); - await mito.getByText('test.csv').dblclick(); + await openImportTaskpaneAndSelectData(mito, 'test.csv') await expect(mito.getByTitle('Column1')).toBeVisible(); }); From 4d9ee2d35f4c146bfeb2a1a83ba75e115f640830 Mon Sep 17 00:00:00 2001 From: Martha Cryan Date: Mon, 11 Mar 2024 14:38:17 -0500 Subject: [PATCH 05/19] Move to use toolbar instead of import files button --- tests/streamlit_ui_tests/taskpanes/file_import.spec.ts | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/tests/streamlit_ui_tests/taskpanes/file_import.spec.ts b/tests/streamlit_ui_tests/taskpanes/file_import.spec.ts index d5e5c3fd6..38c0513bf 100644 --- a/tests/streamlit_ui_tests/taskpanes/file_import.spec.ts +++ b/tests/streamlit_ui_tests/taskpanes/file_import.spec.ts @@ -136,7 +136,8 @@ test.describe('File Import Taskpane', () => { const mito = await getMitoFrame(page); // Open the configure taskpane for the csv with special delimiters - await mito.getByText('Import Files').click(); + await mito.locator('.mito-toolbar-button', { hasText: 'Import' }).click(); + await mito.locator('.mito-dropdown-item', { hasText: 'Import Files' }).click(); await mito.getByText('semicolon-delimiter.csv').click(); await mito.getByText('Configure').click(); From 4a6177097299f61b6a2e7d233c27bc0f101bbbf2 Mon Sep 17 00:00:00 2001 From: Martha Cryan Date: Mon, 11 Mar 2024 15:48:56 -0500 Subject: [PATCH 06/19] Try waiting for mito frame to load to fix webkit --- tests/streamlit_ui_tests/utils.ts | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/tests/streamlit_ui_tests/utils.ts b/tests/streamlit_ui_tests/utils.ts index c823094a2..e2ab0dcf6 100644 --- a/tests/streamlit_ui_tests/utils.ts +++ b/tests/streamlit_ui_tests/utils.ts @@ -4,7 +4,9 @@ import { FormulaType } from './types'; export const getMitoFrame = async (page: Page): Promise => { await page.goto('http://localhost:8555/'); - return page.frameLocator('iframe[title="mitosheet\\.streamlit\\.v1\\.spreadsheet\\.my_component"]'); + const mito = page.frameLocator('iframe[title="mitosheet\\.streamlit\\.v1\\.spreadsheet\\.my_component"]'); + await expect(mito.locator('.mito-toolbar-button-enabled', { hasText: 'Import' })).toBeVisible(); + return mito; }; export const importCSV = async (page: Page, mito: FrameLocator, filename: string): Promise => { From 1232f231a6319d65c05afbab57a45e697ed74e91 Mon Sep 17 00:00:00 2001 From: Martha Cryan Date: Mon, 11 Mar 2024 15:49:48 -0500 Subject: [PATCH 07/19] Add awaitResponse --- tests/streamlit_ui_tests/utils.ts | 1 + 1 file changed, 1 insertion(+) diff --git a/tests/streamlit_ui_tests/utils.ts b/tests/streamlit_ui_tests/utils.ts index e2ab0dcf6..b0b27c91a 100644 --- a/tests/streamlit_ui_tests/utils.ts +++ b/tests/streamlit_ui_tests/utils.ts @@ -6,6 +6,7 @@ export const getMitoFrame = async (page: Page): Promise => { await page.goto('http://localhost:8555/'); const mito = page.frameLocator('iframe[title="mitosheet\\.streamlit\\.v1\\.spreadsheet\\.my_component"]'); await expect(mito.locator('.mito-toolbar-button-enabled', { hasText: 'Import' })).toBeVisible(); + await awaitResponse(page); return mito; }; From dae03744bb52ac5c5c368770f15fa35a6d0fb809 Mon Sep 17 00:00:00 2001 From: Martha Cryan Date: Mon, 11 Mar 2024 16:03:33 -0500 Subject: [PATCH 08/19] Revert "Add awaitResponse" This reverts commit 1232f231a6319d65c05afbab57a45e697ed74e91. --- tests/streamlit_ui_tests/utils.ts | 1 - 1 file changed, 1 deletion(-) diff --git a/tests/streamlit_ui_tests/utils.ts b/tests/streamlit_ui_tests/utils.ts index b0b27c91a..e2ab0dcf6 100644 --- a/tests/streamlit_ui_tests/utils.ts +++ b/tests/streamlit_ui_tests/utils.ts @@ -6,7 +6,6 @@ export const getMitoFrame = async (page: Page): Promise => { await page.goto('http://localhost:8555/'); const mito = page.frameLocator('iframe[title="mitosheet\\.streamlit\\.v1\\.spreadsheet\\.my_component"]'); await expect(mito.locator('.mito-toolbar-button-enabled', { hasText: 'Import' })).toBeVisible(); - await awaitResponse(page); return mito; }; From 5a782b0cfe790cfe3f80e24c578565b74a055550 Mon Sep 17 00:00:00 2001 From: Martha Cryan Date: Mon, 11 Mar 2024 16:03:40 -0500 Subject: [PATCH 09/19] Revert "Try waiting for mito frame to load to fix webkit" This reverts commit 4a6177097299f61b6a2e7d233c27bc0f101bbbf2. --- tests/streamlit_ui_tests/utils.ts | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/tests/streamlit_ui_tests/utils.ts b/tests/streamlit_ui_tests/utils.ts index e2ab0dcf6..c823094a2 100644 --- a/tests/streamlit_ui_tests/utils.ts +++ b/tests/streamlit_ui_tests/utils.ts @@ -4,9 +4,7 @@ import { FormulaType } from './types'; export const getMitoFrame = async (page: Page): Promise => { await page.goto('http://localhost:8555/'); - const mito = page.frameLocator('iframe[title="mitosheet\\.streamlit\\.v1\\.spreadsheet\\.my_component"]'); - await expect(mito.locator('.mito-toolbar-button-enabled', { hasText: 'Import' })).toBeVisible(); - return mito; + return page.frameLocator('iframe[title="mitosheet\\.streamlit\\.v1\\.spreadsheet\\.my_component"]'); }; export const importCSV = async (page: Page, mito: FrameLocator, filename: string): Promise => { From f8fbc90a7f70d84a52be27dfdd83567f422854e6 Mon Sep 17 00:00:00 2001 From: Martha Cryan Date: Mon, 11 Mar 2024 16:51:18 -0500 Subject: [PATCH 10/19] Wait for enabled import button to be visible --- tests/streamlit_ui_tests/utils.ts | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/tests/streamlit_ui_tests/utils.ts b/tests/streamlit_ui_tests/utils.ts index c823094a2..c9f528daa 100644 --- a/tests/streamlit_ui_tests/utils.ts +++ b/tests/streamlit_ui_tests/utils.ts @@ -4,7 +4,9 @@ import { FormulaType } from './types'; export const getMitoFrame = async (page: Page): Promise => { await page.goto('http://localhost:8555/'); - return page.frameLocator('iframe[title="mitosheet\\.streamlit\\.v1\\.spreadsheet\\.my_component"]'); + const mito = page.frameLocator('iframe[title="mitosheet\\.streamlit\\.v1\\.spreadsheet\\.my_component"]'); + await expect(mito.locator('.mito-toolbar-button-container-enabled', { hasText: 'Import' })).toBeVisible(); + return mito; }; export const importCSV = async (page: Page, mito: FrameLocator, filename: string): Promise => { From c67be778025321ae031261c2aba651ac3be21979 Mon Sep 17 00:00:00 2001 From: Martha Cryan Date: Mon, 11 Mar 2024 16:52:28 -0500 Subject: [PATCH 11/19] Wait for enabled import button to be visible --- tests/streamlit_ui_tests/utils.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/streamlit_ui_tests/utils.ts b/tests/streamlit_ui_tests/utils.ts index c9f528daa..923c6f0cf 100644 --- a/tests/streamlit_ui_tests/utils.ts +++ b/tests/streamlit_ui_tests/utils.ts @@ -5,7 +5,7 @@ import { FormulaType } from './types'; export const getMitoFrame = async (page: Page): Promise => { await page.goto('http://localhost:8555/'); const mito = page.frameLocator('iframe[title="mitosheet\\.streamlit\\.v1\\.spreadsheet\\.my_component"]'); - await expect(mito.locator('.mito-toolbar-button-container-enabled', { hasText: 'Import' })).toBeVisible(); + await expect(mito.locator('.text-button:not(.text-button-disabled)', { hasText: 'Import Files' })).toBeVisible(); return mito; }; From 6fee91141410141546078bf3bce30ebff36e7c3f Mon Sep 17 00:00:00 2001 From: Nate Rush Date: Mon, 11 Mar 2024 15:46:36 -0700 Subject: [PATCH 12/19] mitosheet: add default height as --mito-height not set properly sometime --- mitosheet/css/mito.css | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/mitosheet/css/mito.css b/mitosheet/css/mito.css index 1b01062fa..476353667 100644 --- a/mitosheet/css/mito.css +++ b/mitosheet/css/mito.css @@ -61,7 +61,7 @@ } .mito-container { - height: var(--mito-height); + height: var(--mito-height, 538px); /* Default height */ display: flex; flex-direction: column; From b1ce2c81faf4d58a45f8f24883c84a2f61ff5d7f Mon Sep 17 00:00:00 2001 From: Martha Cryan Date: Mon, 11 Mar 2024 18:25:29 -0500 Subject: [PATCH 13/19] Set height of spreadsheet app manually --- tests/streamlit_test.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/streamlit_test.py b/tests/streamlit_test.py index 6f00da028..a1f907d26 100644 --- a/tests/streamlit_test.py +++ b/tests/streamlit_test.py @@ -4,5 +4,5 @@ st.set_page_config(layout="wide") -dfs, code = spreadsheet(import_folder='data') +dfs, code = spreadsheet(import_folder='data', height='1000px') st.code(code) \ No newline at end of file From dc0a6ac63221c937e3e56940c92d5ba1c3d346fc Mon Sep 17 00:00:00 2001 From: Martha Cryan Date: Mon, 11 Mar 2024 18:37:24 -0500 Subject: [PATCH 14/19] try smaller height --- tests/streamlit_test.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/streamlit_test.py b/tests/streamlit_test.py index a1f907d26..675debef7 100644 --- a/tests/streamlit_test.py +++ b/tests/streamlit_test.py @@ -4,5 +4,5 @@ st.set_page_config(layout="wide") -dfs, code = spreadsheet(import_folder='data', height='1000px') +dfs, code = spreadsheet(import_folder='data', height='520px') st.code(code) \ No newline at end of file From 0ca7ae485b5e70993d1cc334dd4136db619f49af Mon Sep 17 00:00:00 2001 From: Martha Cryan Date: Mon, 11 Mar 2024 19:05:36 -0500 Subject: [PATCH 15/19] try using the newest version of mac --- .github/workflows/test-mitosheet-frontend.yml | 4 ++-- tests/streamlit_test.py | 8 ++++++-- 2 files changed, 8 insertions(+), 4 deletions(-) diff --git a/.github/workflows/test-mitosheet-frontend.yml b/.github/workflows/test-mitosheet-frontend.yml index e4632c91c..2a81a18ee 100644 --- a/.github/workflows/test-mitosheet-frontend.yml +++ b/.github/workflows/test-mitosheet-frontend.yml @@ -119,7 +119,7 @@ jobs: timeout-minutes: 60 strategy: matrix: - os: ['ubuntu-latest', 'macos-latest', 'windows-latest'] + os: ['ubuntu-latest', 'macos-13', 'windows-latest'] python-version: ['3.10'] project: - test-name: 'chromium' @@ -137,7 +137,7 @@ jobs: - os: 'windows-latest' project: test-name: webkit - - os: 'macos-latest' + - os: 'macos-13' project: test-name: 'Microsoft Edge' - os: 'ubuntu-latest' diff --git a/tests/streamlit_test.py b/tests/streamlit_test.py index 675debef7..19c097cc8 100644 --- a/tests/streamlit_test.py +++ b/tests/streamlit_test.py @@ -1,8 +1,12 @@ from mitosheet.streamlit.v1 import spreadsheet import streamlit as st +import pandas as pd st.set_page_config(layout="wide") +file = st.file_uploader("Upload a file", type=["csv", "xlsx"]) +if file is not None: + df = pd.read_csv(file) -dfs, code = spreadsheet(import_folder='data', height='520px') -st.code(code) \ No newline at end of file + dfs, code = spreadsheet(df, import_folder='data') + st.code(code) \ No newline at end of file From 4059d826cc8ba97d9abc4bbaee76dae87db1af7a Mon Sep 17 00:00:00 2001 From: Martha Cryan Date: Mon, 11 Mar 2024 19:30:24 -0500 Subject: [PATCH 16/19] Reset test --- tests/streamlit_test.py | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/tests/streamlit_test.py b/tests/streamlit_test.py index 19c097cc8..6f00da028 100644 --- a/tests/streamlit_test.py +++ b/tests/streamlit_test.py @@ -1,12 +1,8 @@ from mitosheet.streamlit.v1 import spreadsheet import streamlit as st -import pandas as pd st.set_page_config(layout="wide") -file = st.file_uploader("Upload a file", type=["csv", "xlsx"]) -if file is not None: - df = pd.read_csv(file) - dfs, code = spreadsheet(df, import_folder='data') - st.code(code) \ No newline at end of file +dfs, code = spreadsheet(import_folder='data') +st.code(code) \ No newline at end of file From e62e8a4e0b60025b1b2aae80a7323f9a68d26cfe Mon Sep 17 00:00:00 2001 From: Nate Rush Date: Tue, 12 Mar 2024 12:01:54 -0700 Subject: [PATCH 17/19] mitosheet: pin streamlit version --- mitosheet/setup.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/mitosheet/setup.py b/mitosheet/setup.py index f4615e687..980fdf5b2 100644 --- a/mitosheet/setup.py +++ b/mitosheet/setup.py @@ -138,7 +138,7 @@ def get_data_files_from_data_files_spec( "setuptools==56.0.0" ], 'streamlit': [ - 'streamlit>=1.24', + 'streamlit>=1.24,<1.32', ], 'optional_feature_dependencies': [ # According to this documentation (https://github.com/snowflakedb/snowflake-connector-python), From 98426878ef369b294a54c7d1841423283b2839f0 Mon Sep 17 00:00:00 2001 From: Nate Rush Date: Tue, 12 Mar 2024 12:31:27 -0700 Subject: [PATCH 18/19] tests: update streamlit requirements --- tests/extra-requirements.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/extra-requirements.txt b/tests/extra-requirements.txt index 2005e8358..9575fb38b 100644 --- a/tests/extra-requirements.txt +++ b/tests/extra-requirements.txt @@ -1,2 +1,2 @@ -streamlit +streamlit<1.32 dash \ No newline at end of file From aad4400b4512083e5404550963d877bdecb2d1ca Mon Sep 17 00:00:00 2001 From: Nate Rush Date: Tue, 12 Mar 2024 12:34:05 -0700 Subject: [PATCH 19/19] tests: update tests to run on macos latest --- .github/workflows/test-mitosheet-frontend.yml | 4 ++-- tests/streamlit_ui_tests/taskpanes/file_import.spec.ts | 9 +++++++++ 2 files changed, 11 insertions(+), 2 deletions(-) diff --git a/.github/workflows/test-mitosheet-frontend.yml b/.github/workflows/test-mitosheet-frontend.yml index 2a81a18ee..e4632c91c 100644 --- a/.github/workflows/test-mitosheet-frontend.yml +++ b/.github/workflows/test-mitosheet-frontend.yml @@ -119,7 +119,7 @@ jobs: timeout-minutes: 60 strategy: matrix: - os: ['ubuntu-latest', 'macos-13', 'windows-latest'] + os: ['ubuntu-latest', 'macos-latest', 'windows-latest'] python-version: ['3.10'] project: - test-name: 'chromium' @@ -137,7 +137,7 @@ jobs: - os: 'windows-latest' project: test-name: webkit - - os: 'macos-13' + - os: 'macos-latest' project: test-name: 'Microsoft Edge' - os: 'ubuntu-latest' diff --git a/tests/streamlit_ui_tests/taskpanes/file_import.spec.ts b/tests/streamlit_ui_tests/taskpanes/file_import.spec.ts index 38c0513bf..9bc9cccee 100644 --- a/tests/streamlit_ui_tests/taskpanes/file_import.spec.ts +++ b/tests/streamlit_ui_tests/taskpanes/file_import.spec.ts @@ -9,6 +9,15 @@ const openImportTaskpaneAndSelectData = async (mito: any, file: string) => { } test.describe('File Import Taskpane', () => { + + test('Test import CSV file', async ({ page }) => { + const mito = await getMitoFrameWithTestCSV(page); + await clickTab(page, mito, 'Data'); + + await clickButtonAndAwaitResponse(page, mito, 'Import Files'); + await expect(mito.getByText('test.csv')).toBeVisible(); + }); + test('Test import CSV File with double click', async ({ page }) => { const mito = await getMitoFrame(page); await openImportTaskpaneAndSelectData(mito, 'test.csv')