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

Pw/chen #300

Open
wants to merge 79 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
79 commits
Select commit Hold shift + click to select a range
139e3a2
chore(demand_style_e2e): 1. add test id to constructor
bar-unity Mar 21, 2024
54009a3
chore(demand_style_e2e): fix alert constructor
bar-unity Mar 21, 2024
2cc737d
Merge branch 'release/6.x.x' into demand_style_e2e
bar-unity Mar 25, 2024
3f43684
chore(ISCT-291): use base wrapped methods
bar-unity Mar 25, 2024
4dc7dc7
chore(ISCT-291): improve code
bar-unity Mar 25, 2024
9a097f7
chore(ISCT-291): remove PW import in alert component
bar-unity Mar 25, 2024
d22473d
chore(ISCT-291): fix also button component
bar-unity Mar 25, 2024
025b4d0
chore(demand_style_e2e): change ComponentBasePage to BasePage
bar-unity Mar 25, 2024
f4782fa
chore(demand_style_e2e): move pages to different folder
bar-unity Mar 25, 2024
a3b4da3
chore(demand_style_e2e): fix more components
bar-unity Mar 25, 2024
210c81a
chore(demand_style_e2e): fix input components
bar-unity Mar 25, 2024
6c70af8
chore(demand_style_e2e): fix more components
bar-unity Mar 25, 2024
d13da3e
chore(demand_style_e2e): use just base component functions
bar-unity Mar 25, 2024
0c63852
chore(demand_style_e2e): use just base component functions
bar-unity Mar 25, 2024
88acc19
chore(demand_style_e2e): improve naming
bar-unity Mar 25, 2024
950a443
chore(demand_style_e2e): improve button-component.ts
bar-unity Mar 26, 2024
c8a0b87
chore(demand_style_e2e): improve chart-component.ts
bar-unity Mar 26, 2024
5e9e17b
chore(demand_style_e2e): fix cr comment and add elements folder
bar-unity Mar 27, 2024
9c5491e
chore(demand_style_e2e): remove "waitForComponent" from all component…
bar-unity Mar 27, 2024
19cbde7
chore(demand_style_e2e): added return type for methods
bar-unity Mar 27, 2024
4c83aba
chore(demand_style_e2e): make properties public
bar-unity Mar 27, 2024
469400e
chore(release): 6.5.5-rc.9
Mar 27, 2024
a0842fa
chore(demand_style_e2e): fix const.ts
bar-unity Mar 27, 2024
482958a
chore(demand_style_e2e): move tests to separate file
bar-unity Mar 27, 2024
c5381d9
chore(demand_style_e2e): change 'component' to relevant entity name
bar-unity Mar 27, 2024
4488b85
chore(demand_style_e2e): use getLocator from base in button-component.ts
bar-unity Mar 27, 2024
2b23810
chore(demand_style_e2e): improve all components readability and added…
bar-unity Mar 27, 2024
98d6c5f
revert unneeded change
bar-unity Mar 27, 2024
f6a62f1
chore(demand_style_e2e): revert unneeded changes
bar-unity Mar 27, 2024
df93e87
Merge remote-tracking branch 'origin/demand_style_e2e' into demand_st…
bar-unity Mar 27, 2024
3ba7896
chore(demand_style_e2e): revert more unneeded changes
bar-unity Mar 27, 2024
3448b48
chore(demand_style_e2e): revert more unneeded changes
bar-unity Mar 27, 2024
3c2b4a9
Merge branch 'release/6.x.x' into demand_style_e2e
bar-unity Mar 27, 2024
ecc5673
chore(demand_style_e2e): package-lock.json changes
bar-unity Mar 27, 2024
7f01850
Merge branch 'release/7.x.x' into demand_style_e2e
bar-unity Mar 27, 2024
adb8531
chore(demand_style_e2e): package-lock.json
bar-unity Mar 27, 2024
85f5e49
Merge remote-tracking branch 'origin/feature/components-dashboards' i…
bar-unity Mar 27, 2024
68975d6
chore(demand_style_e2e): package-lock.json
bar-unity Mar 27, 2024
f0f3953
chore(demand_style_e2e): fix tests
bar-unity Mar 27, 2024
f7c5d34
Merge branch 'feature/components-dashboards' into demand_style_e2e
bar-unity Mar 28, 2024
0ef8fb8
chore(demand_style_e2e): fix package-lock.json
bar-unity Mar 28, 2024
cd61d28
chore(detached): before build
bar-unity Apr 4, 2024
7dc3ba2
chore(detached): before build
bar-unity Apr 4, 2024
4a27b6c
chore(detached): before build
bar-unity Apr 4, 2024
fb7724b
chore(detached): fix ts imports and add index.ts
bar-unity Apr 7, 2024
828852e
chore(detached): remove vite and other build files
bar-unity Apr 7, 2024
c5730c7
chore: asdasd
chenlevin89 Apr 8, 2024
7e20489
chore: remove type module
chenlevin89 Apr 9, 2024
7894aa4
Merge branch 'refs/heads/release/8.x.x' into pw/chen
bar-unity Apr 10, 2024
2aab4b3
chore(fix): rewrite chart-v4 tests, for the new story
bar-unity Apr 10, 2024
4748086
chore(fix): rewrite chart-v4 tests, add tests for chart wrapper
bar-unity Apr 11, 2024
be42946
chore(fix): add icon tests
bar-unity Apr 11, 2024
1e0148f
chore(fix): improve chart loadedPageSelector
bar-unity Apr 11, 2024
dfc94f1
ci: added path "@fusion-e2e/*": ["projects/fusion-e2e/*"]
AndyKIron Apr 11, 2024
b755246
Merge remote-tracking branch 'origin/pw/chen' into pw/chen
AndyKIron Apr 11, 2024
fc04516
ci: remove import "fusion-e2e/*" from fusion-ui
AndyKIron Apr 11, 2024
80b2bfe
chore(fix): move this input to the ChartBaseComponent
bar-unity Apr 14, 2024
4a8a507
Merge remote-tracking branch 'origin/pw/chen' into pw/chen
bar-unity Apr 14, 2024
8e335e3
chore(fix): fix Chart tests
bar-unity Apr 15, 2024
48cc6d0
chore(fix): fix CRR commends
bar-unity Apr 17, 2024
90e751c
chore(fix): fix CR commands - chip-filter
bar-unity Apr 17, 2024
ae011a3
chore(fix): fix CR commands - input
bar-unity Apr 17, 2024
eaf3f0a
chore(fix): fix CR commands - chart-component.ts
bar-unity Apr 17, 2024
d402b97
chore(fix): fix CR commands - dialog-component.ts
bar-unity Apr 17, 2024
bf09b9b
chore(fix): fix CR commands - dropdown
bar-unity Apr 17, 2024
7da4312
chore(fix): fix CR commands - tabs
bar-unity Apr 17, 2024
1c8f3a2
chore(fix): fix CR commands
bar-unity Apr 17, 2024
ab1e0a0
chore(fix): fix CR commands: tooltip-component.ts
bar-unity Apr 17, 2024
9eb7e9d
chore(fix): fix CR comment: trendindicator-component.ts
bar-unity Apr 17, 2024
74a861e
chore(fix): fix CR comment
bar-unity Apr 18, 2024
ecffda5
chore(fix): fix CR comment
bar-unity Apr 18, 2024
d535e90
chore(fix): fix CR comment
bar-unity Apr 18, 2024
d817557
chore(fix): fix CR comment
bar-unity Apr 18, 2024
d1fd99e
chore(fix): fix CR comment
bar-unity Apr 18, 2024
0392a07
Merge branch 'refs/heads/release/8.x.x' into pw/chen
bar-unity Apr 24, 2024
66f9f48
chore(fix): fix import
bar-unity Apr 24, 2024
24da38d
chore: set test version
AndyKIron Apr 24, 2024
0f024ad
Merge branch 'refs/heads/release/8.x.x' into pw/chen
bar-unity Apr 24, 2024
5eb779f
Merge branch 'refs/heads/release/8.x.x' into pw/chen
AndyKIron Apr 25, 2024
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
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -53,3 +53,5 @@ testem.log
# System Files
.DS_Store
Thumbs.db

/fusion-e2e/dist
1 change: 1 addition & 0 deletions projects/fusion-e2e/.gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -4,3 +4,4 @@ node_modules/
/playwright-report/
/blob-report/
/playwright/.cache/
dist
204 changes: 204 additions & 0 deletions projects/fusion-e2e/entities/behavior/behavior-class/base-element.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,204 @@
import {Locator, Page, test} from '@playwright/test';
import {getTestId, getTestIdSelector} from '../../global/utils';

export class BaseElement {
readonly page: Page;
readonly selector: string;
locator: Locator;

constructor(page: Page, selector: string) {
this.page = page;
this.selector = selector;
this.locator = this.page.locator(selector);
}

async click(): Promise<void> {
await test.step(`Click on: ${this.selector}`, async () => {
await this.page.click(this.selector);
});
}

async count(): Promise<number> {
let count: number;

await test.step(`Count: ${this.selector}`, async () => {
count = await this.page.locator(this.selector).count();
});

return count;
}

async hover(): Promise<void> {
await test.step(`Hover on: ${this.selector}`, async () => {
await this.page.hover(this.selector);
});
}

async isVisible(): Promise<boolean> {
let isVisible: boolean;

await test.step(`Is visible: ${this.selector}`, async () => {
isVisible = await this.page.isVisible(this.selector);
});

return isVisible;
}

async isHidden(): Promise<boolean> {
let isHidden: boolean;

await test.step(`Is hidden: ${this.selector}`, async () => {
isHidden = await this.page.isHidden(this.selector);
});

return isHidden;
}

async isDisabled(): Promise<boolean> {
let isDisabled: boolean;

await test.step(`Is disabled: ${this.selector}`, async () => {
isDisabled = await this.page.isDisabled(this.selector);
});

return isDisabled;
}

async isEnabled(): Promise<boolean> {
let isEnabled: boolean;

await test.step(`Is enabled: ${this.selector}`, async () => {
isEnabled = await this.page.isEnabled(this.selector);
});

return isEnabled;
}

async isAttached(): Promise<any> {
let isAttached: any;

await test.step(`Is attached: ${this.selector}`, async () => {
isAttached = await this.page.waitForSelector(this.selector, {state: `attached`});
});

return isAttached;
}

async getSelector(): Promise<string> {
let selector: string;

await test.step(`Get selector`, async () => {
selector = this.selector;
});

return selector;
}

async getLocator(selector: string): Promise<Locator> {
let locator: Locator;

await test.step(`Get locator of: ${this.selector}`, async () => {
locator = this.page.locator(selector);
});

return locator;
}

async getAttribute(attributeName: string): Promise<string | null> {
let attribute: string | null;

await test.step(`Get attribute of: ${attributeName}`, async () => {
attribute = await this.page.getAttribute(this.selector, attributeName);
});
return attribute;
}

async keyPress(key: string, count: number = 1): Promise<void> {
await test.step(`Press key: ${key}, ${count} times`, async () => {
for (let i = 0; i < count; i++) {
await this.page.keyboard.press(key);
}
});
}

async waitForElementToBeAttached(): Promise<void> {
await test.step(`Wait for element to be attached: ${this.selector}`, async () => {
await this.locator.waitFor({state: `attached`});
});
}

async waitForTimeout(timeout: number): Promise<void> {
await test.step(`Wait for timeout`, async () => {
await this.page.waitForTimeout(timeout);
});
}

async waitForURL(url: string): Promise<void> {
await test.step(`Wait for URL: ${url}`, async () => {
await this.page.waitForURL(url);
});
}

async waitForLoadState(state: `load` | `domcontentloaded` | `networkidle` = `load`) {
await test.step(`Wait for load state: ${state}`, async () => {
await this.page.waitForLoadState(state);
});
}

async waitForSelector(selectorName: string): Promise<void> {
await test.step(`Wait for selector: ${selectorName}`, async () => {
await this.page.waitForSelector(selectorName);
});
}

async waitForComponent(modifiers?: string) {
let loadedPageSelector: string;
if (!modifiers) {
loadedPageSelector = getTestIdSelector(this.selector);
} else {
loadedPageSelector = getTestIdSelector(getTestId(this.selector, modifiers));
}
await this.waitForSelector(loadedPageSelector);
}

async selectorText(locator: Locator): Promise<string> {
let text: string;

await test.step(`Get text of: ${this.selector}`, async () => {
text = await locator.textContent();
});

return text;
}

async textContent(): Promise<string> {
let text: string;

await test.step(`Get text content of: ${this.selector}`, async () => {
text = await this.locator.textContent();
});

return text;
}

async reload(): Promise<void> {
await test.step(`Reload page`, async () => {
await this.page.reload();
});
}

async getByTestId(testId: string): Promise<Locator> {
return test.step(`Get element by test id: ${testId}`, async () => {
return this.page.getByTestId(testId);
});
}

async waitForEvent(event: any): Promise<any> {
let eventResponse: any;
await test.step(`Wait for event ${event}`, async () => {
eventResponse = this.page.waitForEvent(event);
});

return eventResponse;
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
import {Page, test} from '@playwright/test';
import {BaseElement} from './base-element';

export class Checkable extends BaseElement {
constructor(page: Page, selector: string) {
super(page, selector);
}

async check(): Promise<void> {
await test.step(`Check`, async () => {
await this.page.check(this.selector);
if (!(await this.isChecked())) {
throw new Error(`Couldn't check the Check box ${this.selector}`);
}
});
}
async uncheck(): Promise<void> {
await test.step(`UnCheck`, async () => {
await this.page.uncheck(this.selector);
if (await this.isChecked()) {
throw new Error(`Couldn't uncheck the Check box ${this.selector}`);
}
});
}

async isChecked(): Promise<boolean> {
let isChecked: boolean;

await test.step(`isChecked`, async () => {
isChecked = await this.locator.isChecked();
});

return isChecked;
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
import {Page} from '@playwright/test';
import {BaseElement} from './base-element';

export class Clickable extends BaseElement {
constructor(page: Page, selector: string) {
super(page, selector);
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
import {Page, test} from '@playwright/test';
import {Clickable} from './clickable';

export class Editable extends Clickable {
constructor(page: Page, selector: string) {
super(page, selector);
}

async clearInput(): Promise<void> {
await test.step(`Clear input`, async () => {
await this.page.fill(this.selector, '');
});
}

async fill(text: string): Promise<void> {
await test.step(`Fill input with text: ${text}`, async () => {
await this.page.fill(this.selector, '');
await this.page.fill(this.selector, text);
});
}

async type(text: string): Promise<void> {
await test.step(`Fill input with text: ${text}`, async () => {
await this.page.fill(this.selector, '');
await this.locator.type(text, {delay: 50});
});
}
}
4 changes: 4 additions & 0 deletions projects/fusion-e2e/entities/behavior/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
export {Editable} from './behavior-class/editable';
export {Clickable} from './behavior-class/clickable';
export {Checkable} from './behavior-class/checkable';
export {BaseElement} from './behavior-class/base-element';
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
import {AlertTestIdModifiers} from '@ironsource/fusion-ui/entities/test-ids-modifiers';
import {getTestId, getTestIdSelector} from '../../global/utils';
import {BaseComponent} from '../base-component';
import {ButtonComponent} from '../button/button-component';
import {StaticText} from '../../elements';
import {Page} from '@playwright/test';

export class AlertComponent extends BaseComponent {
wrapperElement: StaticText;
messageElement: StaticText;
titleElement: StaticText;
actionButtonElement: ButtonComponent;
closeButtonElement: ButtonComponent;

constructor(page: Page, selector: string) {
super(page, selector);
this.wrapperElement = new StaticText(page, getTestIdSelector(getTestId(this.selector, AlertTestIdModifiers.WRAPPER)));
this.messageElement = new StaticText(page, getTestIdSelector(getTestId(this.selector, AlertTestIdModifiers.MESSAGE)));
this.titleElement = new StaticText(page, getTestIdSelector(getTestId(this.selector, AlertTestIdModifiers.TITLE)));
this.actionButtonElement = new ButtonComponent(
page,
getTestIdSelector(getTestId(this.selector, AlertTestIdModifiers.ACTION_BUTTON))
);
this.closeButtonElement = new ButtonComponent(page, getTestIdSelector(getTestId(this.selector, AlertTestIdModifiers.CLOSE_BUTTON)));
}

async getAlertText(): Promise<string> {
return this.messageElement.textContent();
}

async getAlertTitle(): Promise<string> {
return this.titleElement.textContent();
}

async getActionButtonText(): Promise<string> {
return this.actionButtonElement.textContent();
}

async clickOnActionButton(): Promise<void> {
await this.actionButtonElement.click();
}

async closeAlert(): Promise<void> {
await this.closeButtonElement.click();
}

async isAlertVisible(): Promise<boolean> {
const alertSelector = await this.wrapperElement.count();
return alertSelector > 0;
}

async getAlertIconType(): Promise<string> {
return this.wrapperElement.getAttribute('class');
}
}
Original file line number Diff line number Diff line change
@@ -1,14 +1,7 @@
import {AlertTestIdModifiers} from '@ironsource/fusion-ui/entities';
import {AlertTestIdModifiers} from '@ironsource/fusion-ui/entities/test-ids-modifiers';
import {getTestId, getTestIdSelector} from '../../global/utils';

export const alertStoryId = 'v4-components-feedback-alert--basic';
export const alertSeveritiesStoryId = 'v4-components-feedback-alert--severities';
export const defaultTestId = 'alert-default';
export const successTestId = 'success-alert';
export const warningTestId = 'warning-alert';

export const dangerTestId = 'danger-alert';
export const infoTestId = 'info-alert';
export const outlinedTestId = 'outlined-alert';

export const loadedPageSelector = getTestIdSelector(getTestId(defaultTestId, AlertTestIdModifiers.WRAPPER));
20 changes: 20 additions & 0 deletions projects/fusion-e2e/entities/components/base-component.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
import {Page} from '@playwright/test';
import {BaseElement} from '../behavior';

export class BaseComponent extends BaseElement {
constructor(page: Page, selector: string) {
super(page, selector);
}

async isAllControlsVisible(controls: BaseElement[]) {
let isVisible = true;
for (const control of controls) {
const isControlVisible = await control.isVisible();
if (!isControlVisible) {
isVisible = false;
break;
}
}
return isVisible;
}
}
Loading
Loading