Skip to content
This repository has been archived by the owner on Apr 18, 2024. It is now read-only.

Commit

Permalink
Fix tests
Browse files Browse the repository at this point in the history
  • Loading branch information
nick-skriabin authored and Gondragos committed Jan 30, 2024
1 parent 526b5ee commit d25814e
Showing 1 changed file with 28 additions and 25 deletions.
53 changes: 28 additions & 25 deletions tests/functional/specs/relations/basic.cy.ts
Original file line number Diff line number Diff line change
@@ -1,10 +1,13 @@
import { ImageView, LabelStudio, Relations, ToolBar } from '@heartexlabs/ls-test/helpers/LSF';
import { Hotkeys, ImageView, LabelStudio, Relations, ToolBar } from '@heartexlabs/ls-test/helpers/LSF';
import {
imageConfigWithRelations,
simpleImageConfig,
simpleImageData, simpleImageResult,
simpleImageData,
simpleImageResult,
simpleImageResultWithRelation,
simpleImageResultWithRelations, simpleImageResultWithRelationsAndLabels, simpleImageResultWithRelationsAndLabelsAlt
simpleImageResultWithRelations,
simpleImageResultWithRelationsAndLabels,
simpleImageResultWithRelationsAndLabelsAlt
} from '../../data/relations/basic';

describe('Relations: Basic', () => {
Expand Down Expand Up @@ -176,19 +179,19 @@ describe('Relations: Basic', () => {

Relations.hasRelations(0);

ImageView.clickAtRelative(.30, .30);
ImageView.clickAtRelative(0.3, 0.3);
Relations.toggleCreationWithHotkey();
ImageView.clickAtRelative(.60, .60);
ImageView.clickAtRelative(0.6, 0.6);

cy.window().then((win) => {
cy.window().then(win => {
expect(win.Htx.annotationStore.selected.history.history.length).to.equal(2);
});

cy.get('body').type('{ctrl+z}');
Hotkeys.undo();
Relations.hasRelations(0);
cy.get('body').type('{ctrl+shift+z}');
Hotkeys.redo();
Relations.hasRelations(1);
cy.window().then((win) => {
cy.window().then(win => {
expect(win.Htx.annotationStore.selected.history.history.length).to.equal(2);
});
});
Expand All @@ -203,26 +206,26 @@ describe('Relations: Basic', () => {
ImageView.waitForImage();

Relations.hasRelations(1);
cy.window().then((win) => {
cy.window().then(win => {
expect(win.Htx.annotationStore.selected.history.history.length).to.equal(1);
});

Relations.deleteRelationAction(0);

Relations.hasRelations(0);
cy.window().then((win) => {
cy.window().then(win => {
expect(win.Htx.annotationStore.selected.history.history.length).to.equal(2);
});

cy.get('body').type('{ctrl+z}');
Hotkeys.undo();
Relations.hasRelations(1);
cy.window().then((win) => {
cy.window().then(win => {
expect(win.Htx.annotationStore.selected.history.history.length).to.equal(2);
});

cy.get('body').type('{ctrl+shift+z}');
Hotkeys.redo();
Relations.hasRelations(0);
cy.window().then((win) => {
cy.window().then(win => {
expect(win.Htx.annotationStore.selected.history.history.length).to.equal(2);
});
});
Expand All @@ -237,14 +240,14 @@ describe('Relations: Basic', () => {
ImageView.waitForImage();

Relations.hasRelations(1);
cy.window().then((win) => {
cy.window().then(win => {
expect(win.Htx.annotationStore.selected.history.history.length).to.equal(1);
});

Relations.toggleRelationDirection(0);

Relations.hasRelations(1);
cy.window().then((win) => {
cy.window().then(win => {
expect(win.Htx.annotationStore.selected.history.history.length).to.equal(2);
});
});
Expand All @@ -263,19 +266,19 @@ describe('Relations: Basic', () => {
Relations.clickShowRelationLabels(0);
Relations.addLabelToRelation('Blue label', 0);
Relations.hasRelationLabels(['Blue label'], 0);
cy.window().then((win) => {
cy.window().then(win => {
expect(win.Htx.annotationStore.selected.history.history.length).to.equal(2);
});

cy.get('body').type('{ctrl+z}');
Hotkeys.undo();
Relations.hasRelationLabels([], 0);
cy.window().then((win) => {
cy.window().then(win => {
expect(win.Htx.annotationStore.selected.history.history.length).to.equal(2);
});

cy.get('body').type('{ctrl+shift+z}');
Hotkeys.redo();
Relations.hasRelationLabels(['Blue label'], 0);
cy.window().then((win) => {
cy.window().then(win => {
expect(win.Htx.annotationStore.selected.history.history.length).to.equal(2);
});
});
Expand All @@ -292,7 +295,7 @@ describe('Relations: Basic', () => {
Relations.hoverOverRelation(0);
Relations.stopHoveringOverRelation(0);

cy.window().then((win) => {
cy.window().then(win => {
expect(win.Htx.annotationStore.selected.history.history.length).to.equal(1);
});
});
Expand All @@ -307,12 +310,12 @@ describe('Relations: Basic', () => {
ImageView.waitForImage();

Relations.hasRelations(1);
cy.window().then((win) => {
cy.window().then(win => {
expect(win.Htx.annotationStore.selected.history.history.length).to.equal(1);
});

Relations.hideRelationAction(0);
cy.window().then((win) => {
cy.window().then(win => {
expect(win.Htx.annotationStore.selected.history.history.length).to.equal(1);
});
});
Expand Down

0 comments on commit d25814e

Please sign in to comment.