柏树在所有块完成后退出测试执行环境

发布于 2025-02-11 02:54:40 字数 1399 浏览 1 评论 0原文

我对嵌套的描述有一个很大的描述,并且它阻止了它。 我想在其描述中将每个IT块。问题在于,在运行所有测试后,柏树存在测试跑者。我想保留那些IT阻止测试以查看历史记录条目。

describe("Move timetable until the specified event is executed", () => {
  describe("Login", () => {
    it("should log in and retrive the timetable related info", () => {
      cy.login()
    });
  });
  describe("Access dedicated menu leaf", () => {
    it("should access the Maintenance menu and click on Execute", () => {
      executeCurrentTimetable.accessMenuLeafAndClickExecute();
    });

    describe("Execute events until specified event is executed", () => {
      it("should execute the timetable until a specified event is reached", () => {
        // get the event based on eventsList array
        executeCurrentTimetable.executeEvents(eventKeyObj.SoBD);
  });
});

只有将所有命令包裹在相同的描述中并堵塞时,只有

    describe("Execute events until last event of the day", () => {
      it.only("should execute the timetable until a specified event is reached", () => {
        cy.login()
        executeCurrentTimetable.accessMenuLeafAndClickExecute();
        executeCurrentTimetable.executeLastEvent();
      });
    });

在测试完成后自动进入菜单后(请参阅图片)。 任何帮助都将不胜感激。 谢谢你!

I have one big describe with nested describes and it blocks.
I wanted to have each it block within its describe. The issue is that cypress exists the tests runner after all tests are run. I want to preserve those it blocks tests in order to see the history entries.

describe("Move timetable until the specified event is executed", () => {
  describe("Login", () => {
    it("should log in and retrive the timetable related info", () => {
      cy.login()
    });
  });
  describe("Access dedicated menu leaf", () => {
    it("should access the Maintenance menu and click on Execute", () => {
      executeCurrentTimetable.accessMenuLeafAndClickExecute();
    });

    describe("Execute events until specified event is executed", () => {
      it("should execute the timetable until a specified event is reached", () => {
        // get the event based on eventsList array
        executeCurrentTimetable.executeEvents(eventKeyObj.SoBD);
  });
});

Only if all commands are wrapped within the same describe and it block works:

    describe("Execute events until last event of the day", () => {
      it.only("should execute the timetable until a specified event is reached", () => {
        cy.login()
        executeCurrentTimetable.accessMenuLeafAndClickExecute();
        executeCurrentTimetable.executeLastEvent();
      });
    });

After the tests are completed cypress automatically goes to the menu (see picture).
Any help would be much appreciated.
Thank you!

enter image description here

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

尐籹人 2025-02-18 02:54:40

您可以使用- 无exit标志来防止执行后退出。有关更多信息,请参见NPX Cypress运行-Help。这是问题
示例:NPX柏树运行-NO-EXIT

You can use the --no-exit flag to prevent an exit after execution. See npx cypress run --help for more information. Here is the issue of the feature.
Example: npx cypress run --no-exit

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文