Skip to content

Commit

Permalink
test: migrate frequently joined spec to playwright (#17669)
Browse files Browse the repository at this point in the history
* test: migrate frequently joined spec to playwright

* fix test

* fix test
  • Loading branch information
Sachin-chaurasiya authored Sep 3, 2024
1 parent 5eebb89 commit 46e98e1
Show file tree
Hide file tree
Showing 2 changed files with 74 additions and 46 deletions.

This file was deleted.

Original file line number Diff line number Diff line change
@@ -0,0 +1,74 @@
/*
* Copyright 2024 Collate.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
* http://www.apache.org/licenses/LICENSE-2.0
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import { expect, test } from '@playwright/test';
import { redirectToHomePage } from '../../utils/common';
import { visitEntityPage } from '../../utils/entity';

// use the admin user to login
test.use({ storageState: 'playwright/.auth/admin.json' });

test.describe('Frequently Joined', () => {
test.beforeEach(async ({ page }) => {
await redirectToHomePage(page);
await visitEntityPage({
page,
searchTerm: 'sample_data.ecommerce_db.shopify.fact_sale',
dataTestId: 'sample_data-fact_sale',
});
});

test('should display frequently joined columns', async ({ page }) => {
const rowSelector =
'[data-row-key="sample_data.ecommerce_db.shopify.fact_sale.customer_id"]';

await expect(page.locator(rowSelector)).toContainText(
'Frequently Joined Columns:ecommerce_db.shopify.dim_customer.customer_id'
);

await page
.locator(rowSelector)
.getByText('ecommerce_db.shopify.dim_customer.customer_id')
.click();

await expect(page).toHaveURL(
/ecommerce_db\.shopify\.dim_customer\.customer_id/
);
});

test('should display frequently joined table', async ({ page }) => {
// verify the joined tables
await expect(
page.getByRole('link', { name: 'ecommerce_db.dim_customer', exact: true })
).toHaveText('ecommerce_db.dim_customer');

await expect(
page.getByRole('link', { name: 'ecommerce_db.fact_order', exact: true })
).toHaveText('ecommerce_db.fact_order');

// navigate to joined table
await page
.getByRole('link', {
name: 'ecommerce_db.fact_order',
exact: true,
})
.click();

// verify the url
await expect(page).toHaveURL(/ecommerce_db\.shopify\.fact_order/);

// verify the reverse relationship of joined table
await expect(
page.getByRole('link', { name: 'ecommerce_db.fact_sale', exact: true })
).toHaveText('ecommerce_db.fact_sale');
});
});

0 comments on commit 46e98e1

Please sign in to comment.