Skip to content

Commit

Permalink
LPD-41705 SF
Browse files Browse the repository at this point in the history
  • Loading branch information
marcosapmf authored and brianchandotcom committed Jan 16, 2025
1 parent d81f9ed commit 381187e
Show file tree
Hide file tree
Showing 5 changed files with 28 additions and 55 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -116,6 +116,7 @@ export class JSONWebServicesOSBFaroApiHelper {
method: 'DELETE',
}
).then((response) => {
return response.json();});
return response.json();
});
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -10,20 +10,10 @@ import {dataApiHelpersTest} from '../../fixtures/dataApiHelpersTest';
import {featureFlagsTest} from '../../fixtures/featureFlagsTest';
import {loginAnalyticsCloudTest} from '../../fixtures/loginAnalyticsCloudTest';
import {loginTest} from '../../fixtures/loginTest';
import {liferayConfig} from '../../liferay.config';
import getRandomString from '../../utils/getRandomString';
import {syncAnalyticsCloud} from '../analytics-settings-web/utils/analytics-settings';
import { faroConfig } from './faro.config';
import { clickOnLink } from './utils/actions';
import {switchChannel} from './utils/channel';
import {
ACPage,
navigateTo,
navigateToACPageViaURL,
navigateToACSettingsViaURL,
navigateToACWorkspace,
} from './utils/navigation';
import {addBreakdownByIndividualAttribute} from './utils/utils';
import {faroConfig} from './faro.config';
import {clickOnLink} from './utils/actions';
import {ACPage, navigateToACSettingsViaURL} from './utils/navigation';

export const test = mergeTests(
apiHelpersTest,
Expand All @@ -40,7 +30,9 @@ let project;
const randomString = getRandomString();

test.beforeEach(async ({apiHelpers}) => {
project = await apiHelpers.jsonWebServicesOSBFaro.createProject('My Project ' + randomString)
project = await apiHelpers.jsonWebServicesOSBFaro.createProject(
'My Project ' + randomString
);
});

test.afterEach(async ({apiHelpers}) => {
Expand Down Expand Up @@ -74,7 +66,7 @@ test(
).toBeVisible();

await clickOnLink({
baseUrl:faroConfig.environment.baseUrl,
baseUrl: faroConfig.environment.baseUrl,
name: 'Access our documentation to learn more.',
page,
});
Expand Down Expand Up @@ -105,7 +97,7 @@ test(
).toBeVisible();

await clickOnLink({
baseUrl:faroConfig.environment.baseUrl,
baseUrl: faroConfig.environment.baseUrl,
name: 'Access our documentation to learn more.',
page,
});
Expand Down Expand Up @@ -145,25 +137,19 @@ test(
projectID: project.groupId,
});

//await clickOnLink({baseUrl:faroConfig.environment.baseUrl, name: 'canonicalUrl', page});

const tableBodyElement = await page.locator('table tbody');

await expect(
tableBodyElement
).toBeVisible();
await expect(tableBodyElement).toBeVisible();

const elements = await tableBodyElement.locator('td .table-title a').all();
const elements = await tableBodyElement
.locator('td .table-title a')
.all();

const href = await elements[0].getAttribute('href');

await page.goto(`${faroConfig.environment.baseUrl}${href}`);

await expect(
page.getByText(
'No Sample Data Found'
)
).toBeVisible();
await expect(page.getByText('No Sample Data Found')).toBeVisible();
await expect(
page.getByText(
'You can come back later and check if there is any data received from your events.Learn more about event tracking'
Expand All @@ -174,13 +160,13 @@ test(
).toBeVisible();

await clickOnLink({
baseUrl:faroConfig.environment.baseUrl,
baseUrl: faroConfig.environment.baseUrl,
name: 'Learn more about event tracking.',
page,
});

await expect(page).toHaveTitle('Definitions - Liferay Learn');

const header = await page.locator('h2#event-attributes');

await expect(header.getByText('Event Attributes')).toBeVisible();
Expand All @@ -204,7 +190,7 @@ test(
).toBeVisible();

await clickOnLink({
baseUrl:faroConfig.environment.baseUrl,
baseUrl: faroConfig.environment.baseUrl,
name: 'Learn how to add custom events on your site.',
page,
});
Expand Down Expand Up @@ -232,7 +218,7 @@ test(
).toBeVisible();

await clickOnLink({
baseUrl:faroConfig.environment.baseUrl,
baseUrl: faroConfig.environment.baseUrl,
name: 'Access our documentation to learn how to manage custom events.',
page,
});
Expand Down Expand Up @@ -276,7 +262,7 @@ test(
).toBeVisible();

await clickOnLink({
baseUrl:faroConfig.environment.baseUrl,
baseUrl: faroConfig.environment.baseUrl,
name: 'Access our documentation to learn more.',
page,
});
Expand All @@ -288,8 +274,7 @@ test(
const element = await page.locator('a#data-control-and-privacy');

await expect(
element
.getByText('Data Control and Privacy')
element.getByText('Data Control and Privacy')
).toBeVisible();
});
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
import {Page, expect} from '@playwright/test';

import {liferayConfig} from '../../../liferay.config';
import { clickOnLink } from './actions';
import {clickOnLink} from './actions';

export async function checkEmptyStateOnACSide(page: Page) {
await expect(page.getByText('There are no tests found.')).toBeVisible();
Expand Down
12 changes: 3 additions & 9 deletions modules/test/playwright/tests/osb-faro-web/utils/actions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,18 +5,16 @@

import {Page, expect} from '@playwright/test';

import {liferayConfig} from '../../../liferay.config';

export async function checkEmptyStateOnACSide(page: Page) {
await expect(page.getByText('There are no tests found.')).toBeVisible();
}

export async function clickOnLink({
baseUrl,
name,
name,
page,
}: {
baseUrl: string;
baseUrl: string;
name: string;
page: Page;
}) {
Expand All @@ -26,9 +24,5 @@ export async function clickOnLink({

const href = await reviewTagA.getAttribute('href');

console.log('href', href);

await page.goto(
href.replace('http://localhost:8080', baseUrl)
);
await page.goto(href.replace('http://localhost:8080', baseUrl));
}
13 changes: 3 additions & 10 deletions modules/test/playwright/tests/osb-faro-web/utils/project.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,7 @@
import {Page, expect} from '@playwright/test';

import getRandomString from '../../../utils/getRandomString';
import { faroConfig } from '../faro.config';

import {faroConfig} from '../faro.config';

export async function acceptsCookiesBanner(page: Page) {
const cookiesBannerButton = page.getByRole('button', {name: 'Accept All'});
Expand All @@ -17,11 +16,7 @@ export async function acceptsCookiesBanner(page: Page) {
}
}

export async function createProject({
page,
}: {
page: Page;
}) {
export async function createProject({page}: {page: Page}) {
await page.goto(faroConfig.environment.baseUrl);

await page.getByRole('link', {name: 'Start Free Trial'}).click();
Expand All @@ -43,8 +38,6 @@ export async function createProject({
expect(page.getByText('Welcome to Analytics Cloud')).toBeVisible();

expect(
page.getByText(
'Just a few more steps to set up your workspace.'
)
page.getByText('Just a few more steps to set up your workspace.')
).toBeVisible();
}

0 comments on commit 381187e

Please sign in to comment.