Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

test(screenshots): add test for userColumnPresets #822

Merged
merged 1 commit into from
Oct 21, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
35 changes: 21 additions & 14 deletions .github/workflows/ci-e2e.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion packages/ui/scripts/dev.localmode-env.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
5 changes: 5 additions & 0 deletions packages/ui/src/server/configs/e2e/local.ts
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,11 @@ const e2eConfig: Partial<AppConfig> = {
reUseEffectiveAclForPath: '//sys/access_control_object_namespaces[^/+]{0,}',
},

userColumnPresets: {
cluster: 'ui',
dynamicTablePath: '//tmp/userColumnPresets',
},

defaultUserSettingsOverrides: {
...common.defaultUserSettingsOverrides,
['global::navigation::useSmartSort']: false,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,7 @@ function ColumnSelectorButton({
view={view}
pin={allowUserColumnPresets ? 'round-brick' : 'round-round'}
style={showAllColumns ? undefined : actionStyle}
qa="table-columns-button"
>
<Icon awesome="filter" face="solid" />
Columns
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,12 @@ function SharePresetButton(props: Props) {

return (
<Tooltip content={'Share current set of columns for the table'}>
<Button {...props} pin={'clear-round'} onClick={handleClick}>
<Button
{...props}
pin={'clear-round'}
onClick={handleClick}
qa="table-columns-share-button"
>
<Icon awesome={'share'} />
</Button>
</Tooltip>
Expand Down
17 changes: 13 additions & 4 deletions packages/ui/tests/init-cluster-e2e.sh
Original file line number Diff line number Diff line change
@@ -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
Expand All @@ -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:]')
Expand Down Expand Up @@ -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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
},
});
});
});
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading