Skip to content

Commit

Permalink
fix: test-utils
Browse files Browse the repository at this point in the history
  • Loading branch information
manan-redsoft committed Jun 12, 2024
1 parent c438f35 commit 31da062
Show file tree
Hide file tree
Showing 6 changed files with 18 additions and 18 deletions.
4 changes: 2 additions & 2 deletions frontend/tests/functional/detailed/login.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,15 +12,15 @@ baseTest.skip('login page as expected title', async ({ page }) => {

test('login / logout process is working properly', async ({
loginPage,
analyticsPage,
birdEyePage,
sideBar,
page
}) => {
await loginPage.hasUrl(1);
await expect.soft(page.getByTestId('login')).toBeVisible();
await loginPage.checkForUndefinedText();
await loginPage.login();
await analyticsPage.hasUrl();
await birdEyePage.hasUrl();
await sideBar.logout();
});

Expand Down
8 changes: 4 additions & 4 deletions frontend/tests/functional/nav.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,12 @@ import { localItems } from '../../src/lib/utils/locales.js';
import { languageTag, setLanguageTag, availableLanguageTags } from '../../src/paraglide/runtime.js';
import { test, expect, setHttpResponsesListener } from '../utils/test-utils.js';

test('sidebar navigation tests', async ({ logedPage, analyticsPage, sideBar, page }) => {
test('sidebar navigation tests', async ({ logedPage, birdEyePage, sideBar, page }) => {
test.slow();

await test.step('proper redirection to the analytics page after login', async () => {
await analyticsPage.hasUrl();
await analyticsPage.hasTitle();
await birdEyePage.hasUrl();
await birdEyePage.hasTitle();
setHttpResponsesListener(page);
});

Expand Down Expand Up @@ -59,7 +59,7 @@ test('sidebar navigation tests', async ({ logedPage, analyticsPage, sideBar, pag
});

await test.step('translation panel is working properly', async () => {
await analyticsPage.goto();
await birdEyePage.goto();
const locales = [...availableLanguageTags];
const index = locales.indexOf('en');
if (index !== -1) {
Expand Down
8 changes: 4 additions & 4 deletions frontend/tests/functional/startup.test.ts
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
import { test } from '../utils/test-utils.js';

test('startup tests', async ({ loginPage, analyticsPage, page }) => {
test('startup tests', async ({ loginPage, birdEyePage, page }) => {
await test.step('proper redirection to the login page', async () => {
await page.goto('/');
await loginPage.hasUrl(1);
await loginPage.login();
await analyticsPage.hasUrl();
await birdEyePage.hasUrl();
});

await test.step('proper redirection to the analytics page after login', async () => {
await analyticsPage.hasUrl();
await analyticsPage.hasTitle();
await birdEyePage.hasUrl();
await birdEyePage.hasTitle();
});
});
6 changes: 3 additions & 3 deletions frontend/tests/functional/user-route.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,15 +6,15 @@ const vars = TestContent.generateTestVars();
test('user usual routine actions are working correctly', async ({
logedPage,
pages,
analyticsPage,
birdEyePage,
sideBar,
page
}) => {
test.slow();

await test.step('proper redirection to the analytics page after login', async () => {
await analyticsPage.hasUrl();
await analyticsPage.hasTitle();
await birdEyePage.hasUrl();
await birdEyePage.hasTitle();
setHttpResponsesListener(page);
});

Expand Down
2 changes: 1 addition & 1 deletion frontend/tests/utils/birdEye-page.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import { BasePage } from './base-page.js';

export class BirdEyePage extends BasePage {
constructor(public readonly page: Page) {
super(page, '/bird-eye', 'BirdEye');
super(page, '/bird-eye', 'Bird Eye');
// this.page.goto('/analytics');
}
}
8 changes: 4 additions & 4 deletions frontend/tests/utils/test-utils.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { test as base, expect as baseExpect, type Page } from '@playwright/test';
import { SideBar } from './sidebar.js';
import { LoginPage } from './login-page.js';
import { AnalyticsPage } from './analytics-page.js';
import { BirdEyePage } from './birdEye-page.js';
import { PageContent } from './page-content.js';
import { FormFieldType as type } from './form-content.js';
import { Mailer } from './mailer.js';
Expand All @@ -14,7 +14,7 @@ type Fixtures = {
mailer: Mailer;
sideBar: SideBar;
pages: { [page: string]: PageContent };
analyticsPage: AnalyticsPage;
birdEyePage: BirdEyePage;
assetsPage: PageContent;
complianceAssessmentsPage: PageContent;
evidencesPage: PageContent;
Expand Down Expand Up @@ -90,8 +90,8 @@ export const test = base.extend<Fixtures>({
});
},

analyticsPage: async ({ page }, use) => {
await use(new AnalyticsPage(page));
birdEyePage: async ({ page }, use) => {
await use(new BirdEyePage(page));
},

complianceAssessmentsPage: async ({ page }, use) => {
Expand Down

0 comments on commit 31da062

Please sign in to comment.