diff --git a/.github/workflows/ci-e2e.yaml b/.github/workflows/ci-e2e.yaml index fc5ea01c8..7e4eb9641 100644 --- a/.github/workflows/ci-e2e.yaml +++ b/.github/workflows/ci-e2e.yaml @@ -49,19 +49,30 @@ jobs: docker tag $IMAGE_NAME:local $STABLE_IMAGE_NAME:local + run-local-cluster-sh: + name: Install run_local_cluster.sh + runs-on: ${{ needs.start-vm.outputs.label }} + needs: + - start-vm + - e2e-build + steps: + - name: install + run: | + curl https://raw.githubusercontent.com/ytsaurus/ytsaurus/main/yt/docker/local/run_local_cluster.sh > run_local_cluster.sh + chmod a+x run_local_cluster.sh + install run_local_cluster.sh /usr/local/bin + e2e-local: name: E2E for 'Local' runs-on: ${{ needs.start-vm.outputs.label }} needs: - start-vm - e2e-build + - run-local-cluster-sh steps: - name: Run containers for 'Local' run: | - pwd - curl https://raw.githubusercontent.com/ytsaurus/ytsaurus/85b79ee968a7d36258daa705929404ac4bfdc0c4/yt/docker/local/run_local_cluster.sh > run_local_cluster.sh - chmod u+x run_local_cluster.sh - ./run_local_cluster.sh --node-count 2 --ui-skip-pull true --ui-version local --yt-version stable --ui-app-installation e2e + run_local_cluster.sh --node-count 2 --ui-skip-pull true --ui-version local --yt-version stable --ui-app-installation e2e sleep 10 - name: Checkout uses: actions/checkout@v2 @@ -103,14 +114,12 @@ jobs: - start-vm - e2e-build - e2e-local + - run-local-cluster-sh steps: - name: Run containers for 'Local as remote' run: | - pwd - curl https://raw.githubusercontent.com/ytsaurus/ytsaurus/85b79ee968a7d36258daa705929404ac4bfdc0c4/yt/docker/local/run_local_cluster.sh > run_local_cluster.sh - chmod u+x run_local_cluster.sh - ./run_local_cluster.sh --stop - ./run_local_cluster.sh --node-count 2 --ui-skip-pull true --ui-version local --yt-version stable --ui-app-installation e2e --docker-hostname `hostname` --fqdn localhost --ui-network bridge + run_local_cluster.sh --stop + run_local_cluster.sh --node-count 2 --ui-skip-pull true --ui-version local --yt-version stable --ui-app-installation e2e --docker-hostname `hostname` --fqdn localhost --ui-network bridge sleep 10 - name: Checkout uses: actions/checkout@v2 @@ -146,14 +155,12 @@ jobs: - e2e-build - e2e-local - e2e-local-as-remote + - run-local-cluster-sh steps: - name: Run containers for 'Local' run: | - pwd - curl https://raw.githubusercontent.com/ytsaurus/ytsaurus/85b79ee968a7d36258daa705929404ac4bfdc0c4/yt/docker/local/run_local_cluster.sh > run_local_cluster.sh - chmod u+x run_local_cluster.sh - ./run_local_cluster.sh --stop - ./run_local_cluster.sh --node-count 2 --ui-skip-pull true --ui-version local --yt-version stable --ui-app-installation e2e + run_local_cluster.sh --stop + run_local_cluster.sh --node-count 2 --ui-skip-pull true --ui-version local --yt-version stable --ui-app-installation e2e sleep 10 - name: Checkout uses: actions/checkout@v2 diff --git a/packages/ui/scripts/dev.localmode-env.sh b/packages/ui/scripts/dev.localmode-env.sh index 8f1d7d600..b69fc1787 100644 --- a/packages/ui/scripts/dev.localmode-env.sh +++ b/packages/ui/scripts/dev.localmode-env.sh @@ -18,7 +18,7 @@ export PROXY=$proxyHost:$proxyPort curl http://${PROXY}/hosts | head -n 1 | grep '\["' if [ $? -ne 0 -o "${useStop}" = "1" ]; then - srcUrl=https://raw.githubusercontent.com/ytsaurus/ytsaurus/85b79ee968a7d36258daa705929404ac4bfdc0c4/yt/docker/local/run_local_cluster.sh + srcUrl=https://raw.githubusercontent.com/ytsaurus/ytsaurus/main/yt/docker/local/run_local_cluster.sh echo Error: Cannot get list of hosts. Please make sure your proxy is available. echo -e "\nYou can use ${srcUrl} to run your local cluster:" read -p "Do you want to download the file? [yN]: " getAndRun diff --git a/packages/ui/src/server/configs/e2e/local.ts b/packages/ui/src/server/configs/e2e/local.ts index 01dc0fc0d..93514e98e 100644 --- a/packages/ui/src/server/configs/e2e/local.ts +++ b/packages/ui/src/server/configs/e2e/local.ts @@ -47,6 +47,11 @@ const e2eConfig: Partial = { reUseEffectiveAclForPath: '//sys/access_control_object_namespaces[^/+]{0,}', }, + userColumnPresets: { + cluster: 'ui', + dynamicTablePath: '//tmp/userColumnPresets', + }, + defaultUserSettingsOverrides: { ...common.defaultUserSettingsOverrides, ['global::navigation::useSmartSort']: false, diff --git a/packages/ui/src/ui/pages/navigation/content/Table/TableOverview/ColumnSelectorButton.tsx b/packages/ui/src/ui/pages/navigation/content/Table/TableOverview/ColumnSelectorButton.tsx index 98e906646..1b4a07f6f 100644 --- a/packages/ui/src/ui/pages/navigation/content/Table/TableOverview/ColumnSelectorButton.tsx +++ b/packages/ui/src/ui/pages/navigation/content/Table/TableOverview/ColumnSelectorButton.tsx @@ -60,6 +60,7 @@ function ColumnSelectorButton({ view={view} pin={allowUserColumnPresets ? 'round-brick' : 'round-round'} style={showAllColumns ? undefined : actionStyle} + qa="table-columns-button" > Columns diff --git a/packages/ui/src/ui/pages/navigation/content/Table/TableOverview/ColumnsPresetButton.tsx b/packages/ui/src/ui/pages/navigation/content/Table/TableOverview/ColumnsPresetButton.tsx index 69c1f46d2..54550dd45 100644 --- a/packages/ui/src/ui/pages/navigation/content/Table/TableOverview/ColumnsPresetButton.tsx +++ b/packages/ui/src/ui/pages/navigation/content/Table/TableOverview/ColumnsPresetButton.tsx @@ -21,7 +21,12 @@ function SharePresetButton(props: Props) { return ( - diff --git a/packages/ui/tests/init-cluster-e2e.sh b/packages/ui/tests/init-cluster-e2e.sh index 9f11b2bad..a47383a89 100755 --- a/packages/ui/tests/init-cluster-e2e.sh +++ b/packages/ui/tests/init-cluster-e2e.sh @@ -1,9 +1,8 @@ #!/bin/bash +set -xe EXPIRATION_TIMEOUT=${EXPIRATION_TIMEOUT:-3600000} -set -xe - if ! which yt >/dev/null; then echo You have to install YT CLI manually, please 1>&2 exit 1 @@ -14,6 +13,17 @@ if [ -z "${YT_PROXY}" ]; then exit 2 fi +function createAndMountDynamicTable { + path=$1 + schema=$2 + yt create -i --attributes "{dynamic=%true;schema=$schema}" table $path + yt mount-table $path +} + +# userColumnPresets +createAndMountDynamicTable "//tmp/userColumnPresets" "[{name=hash;sort_order=ascending;type=string};{name=columns_json;type=string}]" + + suffix=E=$(mktemp -u XXXXXX) # to lower case E2E_SUFFIX=$(mktemp -u XXXXXX | tr '[:upper:]' '[:lower:]') @@ -132,8 +142,7 @@ createAccountForQuotaEditor e2e-overcommit yt set //sys/accounts/e2e-overcommit-${E2E_SUFFIX}/@allow_children_limit_overcommit %true DYN_TABLE=${E2E_DIR}/dynamic-table -yt create --attributes "{dynamic=%true;schema=[{name=key;sort_order=ascending;type=string};{name=value;type=string};{name=empty;type=any}]}" table ${DYN_TABLE} -yt mount-table ${DYN_TABLE} +createAndMountDynamicTable "$DYN_TABLE" "[{name=key;sort_order=ascending;type=string};{name=value;type=string};{name=empty;type=any}]" ( set +x for ((i = 0; i < 300; i++)); do diff --git a/packages/ui/tests/screenshots/pages/navigation/navigation.table.base.screen.ts b/packages/ui/tests/screenshots/pages/navigation/navigation.table.base.screen.ts index a537bf3a4..cd50a4ff1 100644 --- a/packages/ui/tests/screenshots/pages/navigation/navigation.table.base.screen.ts +++ b/packages/ui/tests/screenshots/pages/navigation/navigation.table.base.screen.ts @@ -86,7 +86,55 @@ test('Navigation: static-table - rowselector', async ({page}) => { await page.click('.navigation-table-overview__input', {force: true}); await page.click('.rc-slider', {force: true, position: {x: 200, y: 0}}); - await page.waitForSelector(':text("key139")'); + await page.getByText('key149').waitFor(); await expect(page).toHaveScreenshot(); }); + +test('Navigation: table - userColumnPresets', async ({page, context}) => { + test.slow(); + + await page.goto(makeClusterUrl(`navigation?path=${E2E_DIR}/static-table`)); + + await tablePage(page).waitForTablContent('.navigation-table', 10); + await tablePage(page).replaceStaticTableMeta(); + + await test.step('select only the "key" column', async () => { + await page.getByTestId('table-columns-button').click(); + await page.getByText('Remove all').click(); + await page.click( + '.column-selector__list-item:nth-child(1) .column-selector__list-item-check', + { + force: true, + }, + ); + await page.mouse.move(0, 0); + await expect(page).toHaveScreenshot(); + await page.click('button :text("Apply")'); + }); + + const shareBtn = page.getByTestId('table-columns-share-button'); + + await test.step('share button should be visible', async () => { + await shareBtn.waitFor(); + + await expect(page).toHaveScreenshot(); + }); + + await test.step('open preset in new tab', async () => { + shareBtn.click(); + + await context.waitForEvent('page', { + predicate: async (page) => { + await tablePage(page).waitForTablContent('.navigation-table', 10); + await tablePage(page).replaceStaticTableMeta(); + + await page.getByText('key0').waitFor(); + + await expect(page).toHaveScreenshot(); + + return true; + }, + }); + }); +}); diff --git a/packages/ui/tests/screenshots/pages/navigation/navigation.table.base.screen.ts-snapshots/Navigation-static-table---rowselector-1-chromium-linux.png b/packages/ui/tests/screenshots/pages/navigation/navigation.table.base.screen.ts-snapshots/Navigation-static-table---rowselector-1-chromium-linux.png index 3e4e9db13..b9c4ae1fa 100644 Binary files a/packages/ui/tests/screenshots/pages/navigation/navigation.table.base.screen.ts-snapshots/Navigation-static-table---rowselector-1-chromium-linux.png and b/packages/ui/tests/screenshots/pages/navigation/navigation.table.base.screen.ts-snapshots/Navigation-static-table---rowselector-1-chromium-linux.png differ diff --git a/packages/ui/tests/screenshots/pages/navigation/navigation.table.base.screen.ts-snapshots/Navigation-table---Content-1-chromium-linux.png b/packages/ui/tests/screenshots/pages/navigation/navigation.table.base.screen.ts-snapshots/Navigation-table---Content-1-chromium-linux.png index fa6256095..365e4e92f 100644 Binary files a/packages/ui/tests/screenshots/pages/navigation/navigation.table.base.screen.ts-snapshots/Navigation-table---Content-1-chromium-linux.png and b/packages/ui/tests/screenshots/pages/navigation/navigation.table.base.screen.ts-snapshots/Navigation-table---Content-1-chromium-linux.png differ diff --git a/packages/ui/tests/screenshots/pages/navigation/navigation.table.base.screen.ts-snapshots/Navigation-table---Content-2-chromium-linux.png b/packages/ui/tests/screenshots/pages/navigation/navigation.table.base.screen.ts-snapshots/Navigation-table---Content-2-chromium-linux.png index a75f1d466..46edeef39 100644 Binary files a/packages/ui/tests/screenshots/pages/navigation/navigation.table.base.screen.ts-snapshots/Navigation-table---Content-2-chromium-linux.png and b/packages/ui/tests/screenshots/pages/navigation/navigation.table.base.screen.ts-snapshots/Navigation-table---Content-2-chromium-linux.png differ diff --git a/packages/ui/tests/screenshots/pages/navigation/navigation.table.base.screen.ts-snapshots/Navigation-table---Content-3-chromium-linux.png b/packages/ui/tests/screenshots/pages/navigation/navigation.table.base.screen.ts-snapshots/Navigation-table---Content-3-chromium-linux.png index 015fb310b..391e39420 100644 Binary files a/packages/ui/tests/screenshots/pages/navigation/navigation.table.base.screen.ts-snapshots/Navigation-table---Content-3-chromium-linux.png and b/packages/ui/tests/screenshots/pages/navigation/navigation.table.base.screen.ts-snapshots/Navigation-table---Content-3-chromium-linux.png differ diff --git a/packages/ui/tests/screenshots/pages/navigation/navigation.table.base.screen.ts-snapshots/Navigation-table---userColumnPresets-1-chromium-linux.png b/packages/ui/tests/screenshots/pages/navigation/navigation.table.base.screen.ts-snapshots/Navigation-table---userColumnPresets-1-chromium-linux.png new file mode 100644 index 000000000..995dbce5f Binary files /dev/null and b/packages/ui/tests/screenshots/pages/navigation/navigation.table.base.screen.ts-snapshots/Navigation-table---userColumnPresets-1-chromium-linux.png differ diff --git a/packages/ui/tests/screenshots/pages/navigation/navigation.table.base.screen.ts-snapshots/Navigation-table---userColumnPresets-2-chromium-linux.png b/packages/ui/tests/screenshots/pages/navigation/navigation.table.base.screen.ts-snapshots/Navigation-table---userColumnPresets-2-chromium-linux.png new file mode 100644 index 000000000..91a78422f Binary files /dev/null and b/packages/ui/tests/screenshots/pages/navigation/navigation.table.base.screen.ts-snapshots/Navigation-table---userColumnPresets-2-chromium-linux.png differ diff --git a/packages/ui/tests/screenshots/pages/navigation/navigation.table.base.screen.ts-snapshots/Navigation-table---userColumnPresets-3-chromium-linux.png b/packages/ui/tests/screenshots/pages/navigation/navigation.table.base.screen.ts-snapshots/Navigation-table---userColumnPresets-3-chromium-linux.png new file mode 100644 index 000000000..fd2146a67 Binary files /dev/null and b/packages/ui/tests/screenshots/pages/navigation/navigation.table.base.screen.ts-snapshots/Navigation-table---userColumnPresets-3-chromium-linux.png differ diff --git a/packages/ui/tests/screenshots/pages/navigation/navigation.table.truncated.base.screen.ts-snapshots/Navigation-truncated-table---Content-1-chromium-linux.png b/packages/ui/tests/screenshots/pages/navigation/navigation.table.truncated.base.screen.ts-snapshots/Navigation-truncated-table---Content-1-chromium-linux.png index 7c3180d2b..1aa8bd6c2 100644 Binary files a/packages/ui/tests/screenshots/pages/navigation/navigation.table.truncated.base.screen.ts-snapshots/Navigation-truncated-table---Content-1-chromium-linux.png and b/packages/ui/tests/screenshots/pages/navigation/navigation.table.truncated.base.screen.ts-snapshots/Navigation-truncated-table---Content-1-chromium-linux.png differ diff --git a/packages/ui/tests/screenshots/pages/navigation/navigation.table.truncated.base.screen.ts-snapshots/Navigation-truncated-table---Content-2-chromium-linux.png b/packages/ui/tests/screenshots/pages/navigation/navigation.table.truncated.base.screen.ts-snapshots/Navigation-truncated-table---Content-2-chromium-linux.png index d1dabfb16..9dc77b07f 100644 Binary files a/packages/ui/tests/screenshots/pages/navigation/navigation.table.truncated.base.screen.ts-snapshots/Navigation-truncated-table---Content-2-chromium-linux.png and b/packages/ui/tests/screenshots/pages/navigation/navigation.table.truncated.base.screen.ts-snapshots/Navigation-truncated-table---Content-2-chromium-linux.png differ diff --git a/packages/ui/tests/screenshots/pages/navigation/navigation.table.truncated.base.screen.ts-snapshots/Navigation-truncated-table---Content-3-chromium-linux.png b/packages/ui/tests/screenshots/pages/navigation/navigation.table.truncated.base.screen.ts-snapshots/Navigation-truncated-table---Content-3-chromium-linux.png index 55c5fa8f4..b04e99457 100644 Binary files a/packages/ui/tests/screenshots/pages/navigation/navigation.table.truncated.base.screen.ts-snapshots/Navigation-truncated-table---Content-3-chromium-linux.png and b/packages/ui/tests/screenshots/pages/navigation/navigation.table.truncated.base.screen.ts-snapshots/Navigation-truncated-table---Content-3-chromium-linux.png differ diff --git a/packages/ui/tests/screenshots/pages/navigation/navigation.table.truncated.base.screen.ts-snapshots/Navigation-truncated-table---Content-4-chromium-linux.png b/packages/ui/tests/screenshots/pages/navigation/navigation.table.truncated.base.screen.ts-snapshots/Navigation-truncated-table---Content-4-chromium-linux.png index 3c12a14af..954f75089 100644 Binary files a/packages/ui/tests/screenshots/pages/navigation/navigation.table.truncated.base.screen.ts-snapshots/Navigation-truncated-table---Content-4-chromium-linux.png and b/packages/ui/tests/screenshots/pages/navigation/navigation.table.truncated.base.screen.ts-snapshots/Navigation-truncated-table---Content-4-chromium-linux.png differ