用 Jasmine 测试木偶戏? [英] Testing puppeteer with Jasmine?

查看:53
本文介绍了用 Jasmine 测试木偶戏?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我们的网站有很多流程(登录、注册、支付等)

We have a website that has many paths of flow (login , signup , payment ,etc)

我们正在使用 puppeteer 脚本(通过节点打字稿)来自动测试我们的网站行为(全流程),当我们收到错误(或意外结果)时,我们会发送电子邮件或某种警报.

We're using puppeteer scripts ( typescript via node) to automate-testing our website behaviour (full flow) , and when we get an error (or unexpected result) we're sending email or some kind of alerts.

但我看到人们也将 jasmine 与 puppeteer 一起使用.

例如:

const puppeteer = require('puppeteer');

describe("Jasmine puppeteer", function() {

  let browser;
  let page;

  beforeAll(() => {
    browser = await puppeteer.launch({headless: false});
    page = await browser.newPage();
    await page.goto('chrome://newtab');
    await page.screenshot({path: 'a.png'});
  })

  it("jasmine puppeteer", () => {
    expect(await page.title()).toBe("");
    done();
  });

  afterAll(() => {
  })
});

在自动化测试框架上使用测试框架似乎(对我来说)像 Test(Test())

Using a testing framework over automated testing framework seems (to me) like Test(Test())

问题

我们是否应该将我们的站点方法测试改为 jasmin 而不是 puppeteer?我的意思是,目前 puepetteer 提供了一种很好的方法来测试我们的网站流量.我们是否需要在现有的测试脚本上应用 jasmine 测试?我对此有点困惑.

Should we change our site approach testing to jasmin over puppeteer ? I mean , currently puepetteer provides a good way to test our site flow. Should we need to apply jasmine testing over our existing tests scripts ? I'm a bit confused about that.

推荐答案

您可以使用 jest 和 puppeteer 进行端到端测试.Jest 基于 Jasmine 框架.它由 Facebook 开发,现在非常流行.

You can use jest with puppeteer for end to end testing. Jest is based on Jasmine framework. It is developed by Facebook and it’s quite popular now.

这篇关于用 Jasmine 测试木偶戏?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆