Skip to content

Commit

Permalink
fix tagger e2e tests (#4783)
Browse files Browse the repository at this point in the history
* fix tagger tests

* lint
  • Loading branch information
sashankaryal authored Sep 10, 2024
1 parent 18b6bd5 commit ad76f26
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 4 deletions.
2 changes: 1 addition & 1 deletion e2e-pw/src/oss/poms/action-row/tagger/modal-tagger.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,8 @@ export class ModalTaggerPom {
}

async toggleOpen() {
await this.locator.getByTestId("tagger-container").hover();
await this.modal.locator.getByTestId("action-tag-sample-labels").click();
await this.locator.getByTestId("tagger-container").hover();
}

async switchTagMode(mode: "sample" | "label") {
Expand Down
15 changes: 14 additions & 1 deletion e2e-pw/src/oss/poms/modal/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,12 @@ import { expect, Locator, Page } from "src/oss/fixtures";
import { EventUtils } from "src/shared/event-utils";
import { Duration } from "../../utils";
import { ModalTaggerPom } from "../action-row/tagger/modal-tagger";
import { ModalPanelPom } from "../panels/modal-panel";
import { UrlPom } from "../url";
import { ModalGroupActionsPom } from "./group-actions";
import { Looker3DControlsPom } from "./looker-3d-controls";
import { ModalSidebarPom } from "./modal-sidebar";
import { ModalVideoControlsPom } from "./video-controls";
import { ModalPanelPom } from "../panels/modal-panel";

export class ModalPom {
readonly groupCarousel: Locator;
Expand Down Expand Up @@ -86,6 +86,19 @@ export class ModalPom {
);
}

async hideControls() {
let isControlsOpacityZero = false;
const controls = this.locator.getByTestId("looker-controls");

do {
await controls.press("c");
const opacity = await controls.evaluate(
(e) => getComputedStyle(e).opacity
);
isControlsOpacityZero = parseFloat(opacity) === 0;
} while (!isControlsOpacityZero);
}

async toggleSelection(isPcd = false) {
if (isPcd) {
await this.looker3d.hover();
Expand Down
4 changes: 2 additions & 2 deletions e2e-pw/src/oss/specs/smoke-tests/tagger.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -103,11 +103,11 @@ test.describe("tag", () => {
eventUtils,
grid,
modal,
page,
}) => {
await grid.openFirstSample();

await modal.sidebar.toggleLabelCheckbox("ground_truth");
await modal.hideControls();
await expect(modal.looker).toHaveScreenshot("labels.png");

const entryExpandPromise = eventUtils.getEventReceivedPromiseForPredicate(
Expand All @@ -124,7 +124,7 @@ test.describe("tag", () => {
await modal.tagger.addLabelTag("correct");

await modal.sidebar.clearGroupFilters("labels");
await page.keyboard.press("c");
await modal.hideControls();
await expect(modal.looker).toHaveScreenshot("labels.png");
});
});

0 comments on commit ad76f26

Please sign in to comment.