@esimplicity/stack-tests 0.1.6 → 0.1.8
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -304,6 +304,7 @@ function registerFlagSteps(test) {
|
|
|
304
304
|
|
|
305
305
|
// src/steps/ui.basic.ts
|
|
306
306
|
import { createBdd as createBdd8 } from "playwright-bdd";
|
|
307
|
+
import { expect as expect3 } from "@playwright/test";
|
|
307
308
|
function registerUiBasicSteps(test) {
|
|
308
309
|
const { Given, When, Then } = createBdd8(test);
|
|
309
310
|
Given("I navigate to {string}", { tags: "@ui or @hybrid" }, async ({ ui, world }, path) => {
|
|
@@ -312,6 +313,9 @@ function registerUiBasicSteps(test) {
|
|
|
312
313
|
When("I click the button {string}", { tags: "@ui or @hybrid" }, async ({ ui, world }, name) => {
|
|
313
314
|
await ui.clickButton(interpolate(name, world.vars));
|
|
314
315
|
});
|
|
316
|
+
When("I click the {string} button", { tags: "@ui or @hybrid" }, async ({ ui, world }, name) => {
|
|
317
|
+
await ui.clickButton(interpolate(name, world.vars));
|
|
318
|
+
});
|
|
315
319
|
When("I click the link {string}", { tags: "@ui or @hybrid" }, async ({ ui, world }, name) => {
|
|
316
320
|
await ui.clickLink(interpolate(name, world.vars));
|
|
317
321
|
});
|
|
@@ -321,18 +325,45 @@ function registerUiBasicSteps(test) {
|
|
|
321
325
|
When("I fill the field {string} with {string}", { tags: "@ui or @hybrid" }, async ({ ui, world }, label, value) => {
|
|
322
326
|
await ui.fillLabel(interpolate(label, world.vars), interpolate(value, world.vars));
|
|
323
327
|
});
|
|
328
|
+
When("I fill in {string} with {string}", { tags: "@ui or @hybrid" }, async ({ ui, world }, label, value) => {
|
|
329
|
+
await ui.fillLabel(interpolate(label, world.vars), interpolate(value, world.vars));
|
|
330
|
+
});
|
|
324
331
|
When("I log in as admin in UI", { tags: "@ui or @hybrid" }, async ({ auth, world }) => {
|
|
325
332
|
await auth.uiLoginAsAdmin(world);
|
|
326
333
|
});
|
|
327
334
|
When("I log in as user in UI", { tags: "@ui or @hybrid" }, async ({ auth, world }) => {
|
|
328
335
|
await auth.uiLoginAsUser(world);
|
|
329
336
|
});
|
|
337
|
+
When("I click the element {string}", { tags: "@ui or @hybrid" }, async ({ page, world }, selector) => {
|
|
338
|
+
await page.locator(interpolate(selector, world.vars)).click();
|
|
339
|
+
});
|
|
340
|
+
When("I select {string} from dropdown {string}", { tags: "@ui or @hybrid" }, async ({ page, world }, option, selector) => {
|
|
341
|
+
await page.locator(interpolate(selector, world.vars)).selectOption({ label: interpolate(option, world.vars) });
|
|
342
|
+
});
|
|
330
343
|
Then("I should see text {string}", { tags: "@ui or @hybrid" }, async ({ ui, world }, text) => {
|
|
331
344
|
await ui.expectText(interpolate(text, world.vars));
|
|
332
345
|
});
|
|
333
346
|
Then("the URL should contain {string}", { tags: "@ui or @hybrid" }, async ({ ui, world }, part) => {
|
|
334
347
|
await ui.expectUrlContains(interpolate(part, world.vars));
|
|
335
348
|
});
|
|
349
|
+
Then("I should be on page {string}", { tags: "@ui or @hybrid" }, async ({ ui, world }, path) => {
|
|
350
|
+
await ui.expectUrlContains(interpolate(path, world.vars));
|
|
351
|
+
});
|
|
352
|
+
Then("the element {string} should be visible", { tags: "@ui or @hybrid" }, async ({ page, world }, selector) => {
|
|
353
|
+
await expect3(page.locator(interpolate(selector, world.vars))).toBeVisible();
|
|
354
|
+
});
|
|
355
|
+
Then("the element {string} should not be visible", { tags: "@ui or @hybrid" }, async ({ page, world }, selector) => {
|
|
356
|
+
await expect3(page.locator(interpolate(selector, world.vars))).not.toBeVisible();
|
|
357
|
+
});
|
|
358
|
+
Then("the element {string} should have value {string}", { tags: "@ui or @hybrid" }, async ({ page, world }, selector, value) => {
|
|
359
|
+
await expect3(page.locator(interpolate(selector, world.vars))).toHaveValue(interpolate(value, world.vars));
|
|
360
|
+
});
|
|
361
|
+
Then("the element {string} should be checked", { tags: "@ui or @hybrid" }, async ({ page, world }, selector) => {
|
|
362
|
+
await expect3(page.locator(interpolate(selector, world.vars))).toBeChecked();
|
|
363
|
+
});
|
|
364
|
+
Then("the element {string} should not be checked", { tags: "@ui or @hybrid" }, async ({ page, world }, selector) => {
|
|
365
|
+
await expect3(page.locator(interpolate(selector, world.vars))).not.toBeChecked();
|
|
366
|
+
});
|
|
336
367
|
}
|
|
337
368
|
|
|
338
369
|
// src/steps/ui.wizard.ts
|
|
@@ -822,7 +853,7 @@ ${truncated}`);
|
|
|
822
853
|
}
|
|
823
854
|
|
|
824
855
|
// src/steps/ui.layout.ts
|
|
825
|
-
import { expect as
|
|
856
|
+
import { expect as expect4 } from "@playwright/test";
|
|
826
857
|
import { createBdd as createBdd12 } from "playwright-bdd";
|
|
827
858
|
function registerLayoutSteps(test) {
|
|
828
859
|
const { Given, When, Then } = createBdd12(test);
|
|
@@ -832,7 +863,7 @@ function registerLayoutSteps(test) {
|
|
|
832
863
|
async ({ page, world }, panelName) => {
|
|
833
864
|
const resolvedName = interpolate(panelName, world.vars);
|
|
834
865
|
const panel = page.getByTestId(`${resolvedName}-panel`);
|
|
835
|
-
await
|
|
866
|
+
await expect4(panel).toBeVisible();
|
|
836
867
|
}
|
|
837
868
|
);
|
|
838
869
|
Then(
|
|
@@ -841,7 +872,7 @@ function registerLayoutSteps(test) {
|
|
|
841
872
|
async ({ page, world }, panelName) => {
|
|
842
873
|
const resolvedName = interpolate(panelName, world.vars);
|
|
843
874
|
const panel = page.getByTestId(`${resolvedName}-panel`);
|
|
844
|
-
await
|
|
875
|
+
await expect4(panel).toBeHidden();
|
|
845
876
|
}
|
|
846
877
|
);
|
|
847
878
|
Then(
|
|
@@ -851,9 +882,9 @@ function registerLayoutSteps(test) {
|
|
|
851
882
|
const resolvedName = interpolate(panelName, world.vars);
|
|
852
883
|
const panel = page.getByTestId(`${resolvedName}-panel`);
|
|
853
884
|
if (state === "visible") {
|
|
854
|
-
await
|
|
885
|
+
await expect4(panel).toBeVisible();
|
|
855
886
|
} else if (state === "hidden") {
|
|
856
|
-
await
|
|
887
|
+
await expect4(panel).toBeHidden();
|
|
857
888
|
} else {
|
|
858
889
|
throw new Error(`Unknown panel state: ${state}. Expected 'visible' or 'hidden'.`);
|
|
859
890
|
}
|
|
@@ -868,7 +899,7 @@ function registerLayoutSteps(test) {
|
|
|
868
899
|
const isFullWidth = await panel.evaluate((el) => {
|
|
869
900
|
return !el.classList.contains("split") && !el.classList.contains("narrow") && !el.classList.contains("split-view-list");
|
|
870
901
|
});
|
|
871
|
-
|
|
902
|
+
expect4(isFullWidth, `Expected "${resolvedName}" panel to be full width`).toBe(true);
|
|
872
903
|
}
|
|
873
904
|
);
|
|
874
905
|
Then(
|
|
@@ -880,7 +911,7 @@ function registerLayoutSteps(test) {
|
|
|
880
911
|
const isNarrow = await panel.evaluate((el) => {
|
|
881
912
|
return el.classList.contains("split") || el.classList.contains("narrow") || el.classList.contains("split-view-list");
|
|
882
913
|
});
|
|
883
|
-
|
|
914
|
+
expect4(isNarrow, `Expected "${resolvedName}" panel to be narrow`).toBe(true);
|
|
884
915
|
}
|
|
885
916
|
);
|
|
886
917
|
Then(
|
|
@@ -888,7 +919,7 @@ function registerLayoutSteps(test) {
|
|
|
888
919
|
{ tags: "@ui or @hybrid" },
|
|
889
920
|
async ({ page }) => {
|
|
890
921
|
const splitContainer = page.locator("[data-testid='split-view'], .split-view, [data-split-view]");
|
|
891
|
-
await
|
|
922
|
+
await expect4(splitContainer.first()).toBeVisible();
|
|
892
923
|
}
|
|
893
924
|
);
|
|
894
925
|
Then(
|
|
@@ -897,7 +928,7 @@ function registerLayoutSteps(test) {
|
|
|
897
928
|
async ({ page }) => {
|
|
898
929
|
const splitContainer = page.locator("[data-testid='split-view'], .split-view, [data-split-view]");
|
|
899
930
|
const count = await splitContainer.count();
|
|
900
|
-
|
|
931
|
+
expect4(count === 0 || !await splitContainer.first().isVisible()).toBe(true);
|
|
901
932
|
}
|
|
902
933
|
);
|
|
903
934
|
Then(
|
|
@@ -905,7 +936,7 @@ function registerLayoutSteps(test) {
|
|
|
905
936
|
{ tags: "@ui or @hybrid" },
|
|
906
937
|
async ({ page }) => {
|
|
907
938
|
const sidebar = page.locator("[data-testid='sidebar'], aside, nav.sidebar, .sidebar");
|
|
908
|
-
await
|
|
939
|
+
await expect4(sidebar.first()).toBeVisible();
|
|
909
940
|
}
|
|
910
941
|
);
|
|
911
942
|
Then(
|
|
@@ -915,7 +946,7 @@ function registerLayoutSteps(test) {
|
|
|
915
946
|
const sidebar = page.locator("[data-testid='sidebar'], aside.sidebar, nav.sidebar");
|
|
916
947
|
const count = await sidebar.count();
|
|
917
948
|
if (count > 0) {
|
|
918
|
-
await
|
|
949
|
+
await expect4(sidebar.first()).toBeHidden();
|
|
919
950
|
}
|
|
920
951
|
}
|
|
921
952
|
);
|
|
@@ -927,7 +958,7 @@ function registerLayoutSteps(test) {
|
|
|
927
958
|
const isCollapsed = await sidebar.evaluate((el) => {
|
|
928
959
|
return el.classList.contains("collapsed") || el.classList.contains("minimized") || el.getAttribute("data-collapsed") === "true";
|
|
929
960
|
});
|
|
930
|
-
|
|
961
|
+
expect4(isCollapsed, "Expected sidebar to be collapsed").toBe(true);
|
|
931
962
|
}
|
|
932
963
|
);
|
|
933
964
|
Then(
|
|
@@ -935,7 +966,7 @@ function registerLayoutSteps(test) {
|
|
|
935
966
|
{ tags: "@ui or @hybrid" },
|
|
936
967
|
async ({ page }) => {
|
|
937
968
|
const modal = page.locator("[role='dialog'], [data-testid='modal'], .modal, [aria-modal='true']");
|
|
938
|
-
await
|
|
969
|
+
await expect4(modal.first()).toBeVisible();
|
|
939
970
|
}
|
|
940
971
|
);
|
|
941
972
|
Then(
|
|
@@ -945,7 +976,7 @@ function registerLayoutSteps(test) {
|
|
|
945
976
|
const modal = page.locator("[role='dialog'], [data-testid='modal'], .modal, [aria-modal='true']");
|
|
946
977
|
const count = await modal.count();
|
|
947
978
|
if (count > 0) {
|
|
948
|
-
await
|
|
979
|
+
await expect4(modal.first()).toBeHidden();
|
|
949
980
|
}
|
|
950
981
|
}
|
|
951
982
|
);
|
|
@@ -955,7 +986,7 @@ function registerLayoutSteps(test) {
|
|
|
955
986
|
async ({ page, world }, modalName) => {
|
|
956
987
|
const resolvedName = interpolate(modalName, world.vars);
|
|
957
988
|
const modal = page.getByTestId(`${resolvedName}-modal`);
|
|
958
|
-
await
|
|
989
|
+
await expect4(modal).toBeVisible();
|
|
959
990
|
}
|
|
960
991
|
);
|
|
961
992
|
Given(
|
|
@@ -1002,7 +1033,7 @@ function registerLayoutSteps(test) {
|
|
|
1002
1033
|
async ({ page, world }, tabName) => {
|
|
1003
1034
|
const resolvedName = interpolate(tabName, world.vars);
|
|
1004
1035
|
const tab = page.getByRole("tab", { name: resolvedName });
|
|
1005
|
-
await
|
|
1036
|
+
await expect4(tab).toHaveAttribute("aria-selected", "true");
|
|
1006
1037
|
}
|
|
1007
1038
|
);
|
|
1008
1039
|
Then(
|
|
@@ -1011,7 +1042,7 @@ function registerLayoutSteps(test) {
|
|
|
1011
1042
|
async ({ page, world }, tabName) => {
|
|
1012
1043
|
const resolvedName = interpolate(tabName, world.vars);
|
|
1013
1044
|
const tab = page.getByRole("tab", { name: resolvedName });
|
|
1014
|
-
await
|
|
1045
|
+
await expect4(tab).toHaveAttribute("aria-selected", "false");
|
|
1015
1046
|
}
|
|
1016
1047
|
);
|
|
1017
1048
|
When(
|
package/dist/index.js
CHANGED
package/dist/steps/index.js
CHANGED