mirror of
https://github.com/open-metadata/OpenMetadata.git
synced 2025-12-24 14:08:45 +00:00
fix(test): flaky login spec (#23359)
* fix(test): flaky login spec * fix ingestion bot spec
This commit is contained in:
parent
b97185b0a2
commit
d5ca346270
@ -10,7 +10,7 @@
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
import { expect, Page, test as base } from '@playwright/test';
|
||||
import { test as base, expect, Page } from '@playwright/test';
|
||||
import { SidebarItem } from '../../constant/sidebar';
|
||||
import { Domain } from '../../support/domain/Domain';
|
||||
import { AdminClass } from '../../support/user/AdminClass';
|
||||
@ -109,6 +109,9 @@ test.describe('Ingestion Bot ', () => {
|
||||
await redirectToHomePage(page);
|
||||
await sidebarClick(page, SidebarItem.DOMAIN);
|
||||
await page.waitForLoadState('networkidle');
|
||||
await page.waitForSelector('[data-testid="loader"]', {
|
||||
state: 'detached',
|
||||
});
|
||||
await selectDomain(page, domain1.data);
|
||||
await addAssetsToDomain(page, domain1, domainAsset1);
|
||||
|
||||
@ -116,6 +119,9 @@ test.describe('Ingestion Bot ', () => {
|
||||
await redirectToHomePage(page);
|
||||
await sidebarClick(page, SidebarItem.DOMAIN);
|
||||
await page.waitForLoadState('networkidle');
|
||||
await page.waitForSelector('[data-testid="loader"]', {
|
||||
state: 'detached',
|
||||
});
|
||||
await selectDomain(page, domain2.data);
|
||||
await addAssetsToDomain(page, domain2, domainAsset2);
|
||||
});
|
||||
@ -159,6 +165,9 @@ test.describe('Ingestion Bot ', () => {
|
||||
await redirectToHomePage(page);
|
||||
await sidebarClick(page, SidebarItem.DOMAIN);
|
||||
await page.waitForLoadState('networkidle');
|
||||
await page.waitForSelector('[data-testid="loader"]', {
|
||||
state: 'detached',
|
||||
});
|
||||
await selectDomain(page, domain1.data);
|
||||
await addServicesToDomain(page, domain1.data, [
|
||||
domainAsset1[0].get().service,
|
||||
@ -168,6 +177,9 @@ test.describe('Ingestion Bot ', () => {
|
||||
await redirectToHomePage(page);
|
||||
await sidebarClick(page, SidebarItem.DOMAIN);
|
||||
await page.waitForLoadState('networkidle');
|
||||
await page.waitForSelector('[data-testid="loader"]', {
|
||||
state: 'detached',
|
||||
});
|
||||
await selectDomain(page, domain2.data);
|
||||
await addServicesToDomain(page, domain2.data, [
|
||||
domainAsset2[0].get().service,
|
||||
|
||||
@ -61,6 +61,7 @@ test.describe('Login flow should work properly', () => {
|
||||
|
||||
test('Signup and Login with signed up credentials', async ({ page }) => {
|
||||
await page.goto('/');
|
||||
await page.waitForLoadState('networkidle');
|
||||
|
||||
await expect(page).toHaveURL(`/signin`);
|
||||
|
||||
@ -85,15 +86,21 @@ test.describe('Login flow should work properly', () => {
|
||||
await expect(page.locator('#password')).toHaveAttribute('type', 'password');
|
||||
|
||||
await page.locator('#confirmPassword').fill(CREDENTIALS.password);
|
||||
|
||||
const createUserResponse = page.waitForResponse(`/api/v1/users/signup`);
|
||||
// Click on create account button
|
||||
await page.getByRole('button', { name: 'Create Account' }).click();
|
||||
await createUserResponse;
|
||||
|
||||
await expect(page).toHaveURL(`/signin`);
|
||||
|
||||
// Login with the created user
|
||||
await page.fill('#email', CREDENTIALS.email);
|
||||
await page.fill('#password', CREDENTIALS.password);
|
||||
const loginResponse = page.waitForResponse(`/api/v1/users/login`);
|
||||
await page.locator('[data-testid="login"]').click();
|
||||
await loginResponse;
|
||||
await page.waitForLoadState('networkidle');
|
||||
|
||||
await expect(page).toHaveURL(`/my-data`);
|
||||
|
||||
@ -107,10 +114,13 @@ test.describe('Login flow should work properly', () => {
|
||||
|
||||
test('Signin using invalid credentials', async ({ page }) => {
|
||||
await page.goto(`/signin`);
|
||||
await page.waitForLoadState('networkidle');
|
||||
// Login with invalid email
|
||||
await page.fill('#email', invalidEmail);
|
||||
await page.fill('#password', CREDENTIALS.password);
|
||||
const loginResponse = page.waitForResponse(`/api/v1/users/login`);
|
||||
await page.locator('[data-testid="login"]').click();
|
||||
await loginResponse;
|
||||
|
||||
await expect(page.locator('[data-testid="alert-bar"]')).toHaveText(
|
||||
LOGIN_ERROR_MESSAGE
|
||||
@ -119,7 +129,9 @@ test.describe('Login flow should work properly', () => {
|
||||
// Login with invalid password
|
||||
await page.fill('#email', CREDENTIALS.email);
|
||||
await page.fill('#password', invalidPassword);
|
||||
const loginResponse2 = page.waitForResponse(`/api/v1/users/login`);
|
||||
await page.locator('[data-testid="login"]').click();
|
||||
await loginResponse2;
|
||||
|
||||
await expect(page.locator('[data-testid="alert-bar"]')).toHaveText(
|
||||
LOGIN_ERROR_MESSAGE
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user