Skip to content

Commit

Permalink
clean setupBrowser
Browse files Browse the repository at this point in the history
  • Loading branch information
nilgaar committed Oct 2, 2024
1 parent c320494 commit 281c9ac
Show file tree
Hide file tree
Showing 10 changed files with 23 additions and 43 deletions.
6 changes: 2 additions & 4 deletions e2e-tests/playwright/e2e/catalog-scaffoldedfromLink.spec.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { Page, test } from '@playwright/test';
import { UIhelper } from '../utils/UIhelper';
import { Common, setupBrowser } from '../utils/Common';
import { Common } from '../utils/Common';
import { CatalogImport } from '../support/pages/CatalogImport';
import { APIHelper } from '../utils/APIHelper';
import { githubAPIEndpoints } from '../utils/APIEndpoints';
Expand All @@ -25,9 +25,7 @@ test.describe.serial('Link Scaffolded Templates to Catalog Items', () => {
).toString('utf8'), // Default repoOwner janus-qe
};

test.beforeAll(async ({ browser }, testInfo) => {
page = (await setupBrowser(browser, testInfo)).page;

test.beforeAll(async () => {
common = new Common(page);
uiHelper = new UIhelper(page);
catalogImport = new CatalogImport(page);
Expand Down
6 changes: 2 additions & 4 deletions e2e-tests/playwright/e2e/catalog-timestamp.spec.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { Page, expect, test } from '@playwright/test';
import { UIhelper } from '../utils/UIhelper';
import { Common, setupBrowser } from '../utils/Common';
import { Common } from '../utils/Common';
import { CatalogImport } from '../support/pages/CatalogImport';
import { UIhelperPO } from '../support/pageObjects/global-obj';

Expand All @@ -13,9 +13,7 @@ test.describe('Test timestamp column on Catalog', () => {
const component =
'https://github.com/janus-qe/custom-catalog-entities/blob/main/timestamp-catalog-info.yaml';

test.beforeAll(async ({ browser }, testInfo) => {
page = (await setupBrowser(browser, testInfo)).page;

test.beforeAll(async () => {
common = new Common(page);
uiHelper = new UIhelper(page);
catalogImport = new CatalogImport(page);
Expand Down
5 changes: 2 additions & 3 deletions e2e-tests/playwright/e2e/custom-theme.spec.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { test, Page, TestInfo, expect } from '@playwright/test';
import { Common, setupBrowser } from '../utils/Common';
import { Common } from '../utils/Common';
import { ThemeVerifier } from '../utils/custom-theme/theme-verifier';
import {
customTabIcon,
Expand All @@ -12,8 +12,7 @@ test.describe('CustomTheme should be applied', () => {
let common: Common;
let themeVerifier: ThemeVerifier;

test.beforeAll(async ({ browser }, testInfo) => {
page = (await setupBrowser(browser, testInfo)).page;
test.beforeAll(async () => {
common = new Common(page);
themeVerifier = new ThemeVerifier(page);

Expand Down
6 changes: 2 additions & 4 deletions e2e-tests/playwright/e2e/github-happy-path.spec.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { test, expect, Page } from '@playwright/test';
import { UIhelper } from '../utils/UIhelper';
import { Common, setupBrowser } from '../utils/Common';
import { Common } from '../utils/Common';
import { resources } from '../support/testData/resources';
import {
BackstageShowcase,
Expand All @@ -18,9 +18,7 @@ test.describe.serial('GitHub Happy path', () => {
const component =
'https://github.com/janus-idp/backstage-showcase/blob/main/catalog-entities/all.yaml';

test.beforeAll(async ({ browser }, testInfo) => {
page = (await setupBrowser(browser, testInfo)).page;

test.beforeAll(async () => {
uiHelper = new UIhelper(page);
common = new Common(page);
catalogImport = new CatalogImport(page);
Expand Down
5 changes: 2 additions & 3 deletions e2e-tests/playwright/e2e/github-integration-org-fetch.spec.ts
Original file line number Diff line number Diff line change
@@ -1,14 +1,13 @@
import { test, Page } from '@playwright/test';
import { UIhelper } from '../utils/UIhelper';
import { Common, setupBrowser } from '../utils/Common';
import { Common } from '../utils/Common';

let page: Page;
test.describe.serial('GitHub integration with Org data fetching', () => {
let common: Common;
let uiHelper: UIhelper;

test.beforeAll(async ({ browser }, testInfo) => {
page = (await setupBrowser(browser, testInfo)).page;
test.beforeAll(async () => {
uiHelper = new UIhelper(page);
common = new Common(page);
await common.loginAsGithubUser();
Expand Down
6 changes: 2 additions & 4 deletions e2e-tests/playwright/e2e/plugins/acr.spec.ts
Original file line number Diff line number Diff line change
@@ -1,16 +1,14 @@
import { test } from '@playwright/test';
import { UIhelper } from '../../utils/UIhelper';
import { Common, setupBrowser } from '../../utils/Common';
import { Common } from '../../utils/Common';

let page;
test.describe('Test ACR plugin', () => {
let uiHelper: UIhelper;
let common: Common;
const dateRegex =
/(Jan|Feb|Mar|Apr|May|Jun|Jul|Aug|Sep|Oct|Nov|Dec)\s\d{1,2},\s\d{4}/gm;
test.beforeAll(async ({ browser }, testInfo) => {
page = (await setupBrowser(browser, testInfo)).page;

test.beforeAll(async () => {
uiHelper = new UIhelper(page);
common = new Common(page);
await common.loginAsGuest();
Expand Down
14 changes: 4 additions & 10 deletions e2e-tests/playwright/e2e/plugins/bulk-import.spec.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { expect, Page, test } from '@playwright/test';
import { UIhelper } from '../../utils/UIhelper';
import { Common, setupBrowser } from '../../utils/Common';
import { Common } from '../../utils/Common';
import { APIHelper } from '../../utils/APIHelper';
import { BulkImport } from '../../support/pages/BulkImport';
import {
Expand Down Expand Up @@ -33,9 +33,7 @@ test.describe.serial('Bulk Import plugin', () => {
labels: `bulkimport1: test1;bulkimport2: test2`,
repoUrl: `github.com/janus-test/${newRepoName}`,
};
test.beforeAll(async ({ browser }, testInfo) => {
page = (await setupBrowser(browser, testInfo)).page;

test.beforeAll(async () => {
uiHelper = new UIhelper(page);
common = new Common(page);
bulkimport = new BulkImport(page);
Expand Down Expand Up @@ -244,9 +242,7 @@ test.describe
repoName: 'janus-test-2-bulk-import-test',
url: 'https://github.com/janus-test/janus-test-2-bulk-import-test/blob/main/catalog-info.yaml',
};
test.beforeAll(async ({ browser }, testInfo) => {
page = (await setupBrowser(browser, testInfo)).page;

test.beforeAll(async () => {
uiHelper = new UIhelper(page);
common = new Common(page);
bulkimport = new BulkImport(page);
Expand Down Expand Up @@ -289,9 +285,7 @@ test.describe
let page: Page;
let uiHelper: UIhelper;
let common: Common;
test.beforeAll(async ({ browser }, testInfo) => {
page = (await setupBrowser(browser, testInfo)).page;

test.beforeAll(async () => {
uiHelper = new UIhelper(page);
common = new Common(page);
await common.loginAsGithubUser();
Expand Down
5 changes: 2 additions & 3 deletions e2e-tests/playwright/e2e/plugins/frontend/sidebar.spec.ts
Original file line number Diff line number Diff line change
@@ -1,15 +1,14 @@
import { Page, test, expect } from '@playwright/test';
import { UIhelper } from '../../../utils/UIhelper';
import { Common, setupBrowser } from '../../../utils/Common';
import { Common } from '../../../utils/Common';

let page: Page;

test.describe('Validate Sidebar Navigation Customization', () => {
let uiHelper: UIhelper;
let common: Common;

test.beforeAll(async ({ browser }, testInfo) => {
page = (await setupBrowser(browser, testInfo)).page;
test.beforeAll(async () => {
uiHelper = new UIhelper(page);
common = new Common(page);

Expand Down
6 changes: 2 additions & 4 deletions e2e-tests/playwright/e2e/plugins/ocm.spec.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { Page, test } from '@playwright/test';
import { Common, setupBrowser } from '../../utils/Common';
import { Common } from '../../utils/Common';
import { UIhelper } from '../../utils/UIhelper';
import { Clusters } from '../../support/pages/Clusters';

Expand All @@ -21,9 +21,7 @@ test.describe.serial('Test OCM plugin', () => {
let clusters: Clusters;
let common: Common;

test.beforeAll(async ({ browser }, testInfo) => {
page = (await setupBrowser(browser, testInfo)).page;

test.beforeAll(async () => {
common = new Common(page);
uiHelper = new UIhelper(page);
clusters = new Clusters(page);
Expand Down
7 changes: 3 additions & 4 deletions e2e-tests/playwright/e2e/plugins/tekton/tekton.spec.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { test } from '@playwright/test';
import { Common, setupBrowser } from '../../../../playwright/utils/Common';
import { Common } from '../../../../playwright/utils/Common';
import { UIhelper } from '../../../../playwright/utils/UIhelper';
import { Tekton } from '../../../utils/tekton/tekton';
import { Catalog } from '../../../support/pages/Catalog';
Expand All @@ -16,9 +16,8 @@ test.describe('Test Tekton plugin', () => {
let tekton: Tekton;
let catalog: Catalog;

test.beforeAll(async ({ browser }, testInfo) => {
const page = (await setupBrowser(browser, testInfo)).page;
common = new Common(page);
test.beforeAll(async () => {
const common = new Common(page);
await common.loginAsGuest();
uiHelper = new UIhelper(page);
tekton = new Tekton(page);
Expand Down

0 comments on commit 281c9ac

Please sign in to comment.