Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

test(e2e): added new cases #6

Merged
merged 4 commits into from
Sep 2, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 1 addition & 7 deletions e2e/playwright.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ export default defineConfig({
/* Shared settings for all the projects below. See https://playwright.dev/docs/api/class-testoptions. */
use: {
/* Base URL to use in actions like `await page.goto('/')`. */
// baseURL: 'http://127.0.0.1:3000',
baseURL: 'https://d2ojv9ksm0gp58.cloudfront.net',

/* Collect trace when retrying the failed test. See https://playwright.dev/docs/trace-viewer */
trace: 'on-first-retry',
Expand All @@ -45,10 +45,4 @@ export default defineConfig({
},
],

/* Run your local dev server before starting the tests */
// webServer: {
// command: 'npm run start',
// url: 'http://127.0.0.1:3000',
// reuseExistingServer: !process.env.CI,
// },
});
8 changes: 8 additions & 0 deletions e2e/tests/base/base.po.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
import { Page } from '@playwright/test';

export class BasePage {

constructor(protected page: Page) {}

public goto = (adress: string) => this.page.goto(adress);
}
9 changes: 9 additions & 0 deletions e2e/tests/dashboart-filter/dashboard-filter-panel.po.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
import { BasePage } from '../base/base.po';

export class DashboartFilterpanelPage extends BasePage {
public readonly pageAdress = '/dashboard-filter-panel';


public gotoMainPage = async () => await this.goto(this.pageAdress);
public weightedPipelineValue = () => this.page.getByText('Weighted pipeline value (€)', {exact: true}).first();
}
16 changes: 16 additions & 0 deletions e2e/tests/dashboart-filter/dashboard-filter-panel.spec.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
import { test, expect } from '@playwright/test';
import { DashboartFilterpanelPage } from './dashboard-filter-panel.po';

test.describe('Dashboard filter panel page', () => {
test('should have working initial screen', async ({ page }) => {
// given
const dashboartFilterpanelPage = new DashboartFilterpanelPage(page);

// when
await dashboartFilterpanelPage.gotoMainPage();
await dashboartFilterpanelPage.weightedPipelineValue().waitFor({ state: 'visible' });

// then
await expect(page).toHaveScreenshot('init-page.png', { maxDiffPixelRatio: 0.1, fullPage: true});
});
});
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
import { BasePage } from '../base/base.po';

export class DragNDropChartLibraryPage extends BasePage {
public readonly pageAdress = '/drag-n-drop-chart-library';

public gotoMainPage = async () => await this.goto(this.pageAdress);
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
import { test, expect } from '@playwright/test';
import { DragNDropChartLibraryPage } from './drag-n-drop-chart-library.po';

test.describe('Drag and drop page', () => {
test('should have working initial screen', async ({ page }) => {
// given
const dragNDropChartLibraryPage = new DragNDropChartLibraryPage(page);

// when
await dragNDropChartLibraryPage.gotoMainPage();

// then
await expect(page).toHaveScreenshot('init-page.png', { maxDiffPixelRatio: 0.1, fullPage: true});
});
});

Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
18 changes: 6 additions & 12 deletions e2e/tests/report-builder/report-builder.po.ts
Original file line number Diff line number Diff line change
@@ -1,16 +1,10 @@
import { Page } from '@playwright/test';
import { BasePage } from '../base/base.po';

export class ReportBuilderPage {
/**
* @todo: Extract to config file
*/
public readonly URL = 'https://d2ojv9ksm0gp58.cloudfront.net/report-builder/';
export class ReportBuilderPage extends BasePage {
public readonly pageAdress = '/report-builder/';

constructor(
private page: Page,
) {}

public gotoMainPage = () => this.page.goto(this.URL);
public gotoMainPage = async () => await this.goto(this.pageAdress);

public tableContainer = () => this.page.locator('.regular-table-container');
public chartOneBar = () => this.page.locator('.bars-container .bar').first();
}
}
4 changes: 2 additions & 2 deletions e2e/tests/report-builder/report-builder.spec.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { test, expect } from '@playwright/test';
import { ReportBuilderPage } from './report-builder.po';
import { ReportBuilderPage } from './report-builder.po.ts';

test.describe('Report builder', () => {
test('should have working initial screen', async ({ page }) => {
Expand All @@ -12,6 +12,6 @@ test.describe('Report builder', () => {
await reportBuilderPage.chartOneBar().waitFor({ state: 'visible' });

// then
await expect(page).toHaveScreenshot('init-page.png', { threshold: 0.35 });
await expect(page).toHaveScreenshot('init-page.png', { maxDiffPixelRatio: 0.1, fullPage: true});
});
});
Binary file not shown.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
8 changes: 8 additions & 0 deletions e2e/tests/wearables-dashboard/wearables-dashboard.po.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
import { BasePage } from '../base/base.po';

export class WearablesDashboardPage extends BasePage {
public readonly pageAdress = '/wearables-dashboard';

public gotoMainPage = async () => await this.goto(this.pageAdress);
public NumberOfStepsChart = () => this.page.getByText('Number of steps by minute', {exact: true});
}
16 changes: 16 additions & 0 deletions e2e/tests/wearables-dashboard/wearables-dashboard.spec.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
import { test, expect } from '@playwright/test';
import { WearablesDashboardPage } from '../wearables-dashboard/wearables-dashboard.po';

test.describe('Wearables dashboard', () => {
test('should have working initial screen', async ({ page }) => {
// given
const wearablesDashboardPage = new WearablesDashboardPage(page);

// when
await wearablesDashboardPage.gotoMainPage();
await wearablesDashboardPage.NumberOfStepsChart().waitFor({ state: 'visible' });

// then
await expect(page).toHaveScreenshot('init-page.png', { maxDiffPixelRatio: 0.1, fullPage: true});
});
});
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading