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

Vse filter sample report #3395

Open
wants to merge 11 commits into
base: main
Choose a base branch
from
2 changes: 1 addition & 1 deletion e2e/.sauce/staging.yml
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ suites:
- name: "Chromium Mac"
platformName: "macOS 12"
screenResolution: "1440x900"
testMatch: ['.*.spec.ts']
testMatch: ['./sampleReport/sample-report-filters.spec.ts']
params:
browserName: "chromium"
project: "chromium"
Expand Down
12 changes: 9 additions & 3 deletions e2e/.sauceignore
Original file line number Diff line number Diff line change
@@ -1,11 +1,17 @@
# This file instructs saucectl to not package any files mentioned here.

# Ignore node_modules directory
node_modules/

playwright-report/
html-reports/

# Ignore .git directory
.git/

.git/
.github/
.DS_Store
.vscode/
.idea/
.gitignore
.npmrc
\*.gif
\*.gif
38 changes: 37 additions & 1 deletion e2e/constants/sample.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ export const NUMBER_INPUT = 'input[type="number"]';

export const PATHOGEN_LINk = 'a[class="linkDefault-34rbs"]';

export const TAXONS = '[class*="taxonName"]'
export const FILTER_RESULT = '[data-testid="filter-tag"]';
export const SEARCH_BAR = '[placeholder="Taxon name"]';
export const ALL_COLUMN_HEADERS = [
Expand Down Expand Up @@ -36,6 +37,8 @@ export const COLUMNS_LABEL = 'div[data-testid*="column-header"]';
export const FILTER_TAG = '[data-testid="filter-tag"]';
export const CANCEL_ICON =
'[data-testid="filter-tag"] [data-testid="x-close-icon"]';
export const X_CLOSE_ICON =
'[data-testid="x-close-icon"]';
export const TOTAL_READ_POPOUP_CONTENT = '[data-testid="column-tooltip"]';
export const COLUMN_HEADER_PROP = {
Score: {
Expand Down Expand Up @@ -95,9 +98,28 @@ export const BACTERIA_FILTER = '[data-testid="dropdown-bacteria"]';
export const EUKARYOTA_FILTER = '[data-testid="dropdown-eukaryota"]';
export const VIROIDS_FILTER = '[data-testid="dropdown-viroids"]';
export const VIRUSES_FILTER = '[data-testid="dropdown-viruses"]';
export const VIRUSES_PHAGE_FILTER = '[data-testid="dropdown-viruses---phage"]';
export const UNCATEGORIZED_FILTER = '[data-testid="dropdown-uncategorized"]';
export const CATEGORIES_FILTER = '[data-testid="category-filter"]';
export const ARCHAEA = "Archaea";
export const BACTERIA = "Bacteria";
export const EUKARYOTA = "Eukaryota";
export const VIROIDS = "Viroids";
export const VIRUSES = "Viruses";
export const PHAGE = "Phage";
export const UNCATEGORIZED = "Uncategorized";
export const CATEGORY_NAMES = [
ARCHAEA,
BACTERIA,
EUKARYOTA,
VIROIDS,
VIRUSES,
PHAGE,
UNCATEGORIZED
];
export const FILTERS_DROPDOWN = '[data-testid="dropdown-menu"]';
export const THRESHOLD_OPTION_FILTER = '[class*="thresholdFilterList"] [data-testid="filters"]'
export const THRESHOLD_COMPARISON_OPERATORS = [">=", "<="]
export const THRESHOLD_FILTERS = [
"Score",
"NT Z Score",
Expand All @@ -117,9 +139,23 @@ export const THRESHOLD_FILTERS = [
"NR L (alignment length in bp)",
"NR E value (as a power of 10)",
];
export const READ_SPECIFICITY_FILTERS = ["All", "Specific Only"];
export const ALL = "All"
export const SPECIFIC_ONLY = "Specific Only"
export const READ_SPECIFICITY_FILTERS = [ALL, SPECIFIC_ONLY];

export const ANNOTATION_FILTERS = ["Hit", "Not a hit", "Inconclusive"];

export const NAME_TYPE_FILTER = '[data-testid="name-type-filter"]'

export const SCIENTIFIC = "Scientific";
export const COMMON = "Common";
export const NAME_TYPES = [
SCIENTIFIC,
COMMON
];

export const NAME_TYPE_FILTER_VALUE = 'span[data-testid="name-type-filter"] + span'

export const APPLY_BUTTON = '[data-testid="apply"]';
export const APPLY = 'text="Apply"';
export const THRESHOLD_FILTER = '[data-testid="threshold-filters-filter"]';
Expand Down
4 changes: 2 additions & 2 deletions e2e/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,8 @@
"pw:staging:headless": "NODE_ENV=staging npx playwright test -c ./setup/staging.config.ts",
"pw:staging:debug": "DEBUG=pw:browser*,pw:api NODE_ENV=staging npx playwright test --headed -c ./setup/staging.config.ts",
"pw:report": "npx playwright show-report",
"sauce:ci": "NODE_ENV=ci saucectl run -c ./.sauce/ci.yml",
"sauce:staging": "NODE_ENV=staging saucectl run -c ./.sauce/staging.yml"
"sauce:ci": "saucectl run -c ./.sauce/ci.yml",
"sauce:staging": "saucectl run -c ./.sauce/staging.yml"
},
"devDependencies": {
"@faker-js/faker": "^7.6.0",
Expand Down
9 changes: 9 additions & 0 deletions e2e/page-objects/articles-page.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
import { expect } from "@playwright/test";
import { PageObject } from "./page-object"

export class ArticlesPage extends PageObject {

public async validateUrlIncludesLinkText(linkText: string) {
expect(this.page.url().includes(linkText)).toBeTruthy();
}
}
59 changes: 59 additions & 0 deletions e2e/page-objects/page-object.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
import { Page } from "@playwright/test";

export abstract class PageObject {
public page: Page;
public baseUrl: string;

constructor(page: Page) {
this.page = page;
this.baseUrl = process.env.BASEURL
}

// #region Keyboard
public async pressEscape() {
await this.page.keyboard.press("Escape");
}

public async pressEnter() {
await this.page.keyboard.press("Enter");
}
// #endregion Keyboard

public async close() {
this.page.close()
}

public async pause(seconds: number) {
await this.page.waitForTimeout(seconds * 1000);
}

public async scrollToElement(locator: string, direction: 'up' | 'down') {
const startTime = Date.now();
const oneMinute = 60000;
const scrollAmount = direction === 'up' ? -500 : 500;

while (true) {
const element = await this.page.locator(locator).first();
const isElementVisible = await element.isVisible();

if (isElementVisible) {
break;
}

if (Date.now() - startTime > oneMinute) {
console.warn('Stopped scrolling after 1 minute.');
break;
}

await this.page.mouse.wheel(0, scrollAmount);
}
}

public async scrollUpToElement(locator: string) {
await this.scrollToElement(locator, 'up');
}

public async scrollDownToElement(locator: string) {
await this.scrollToElement(locator, 'down');
}
}
Loading