当URL更改超过2次时(在相同的测试用例中),使用'currentURL()‘的测试开始随机失败。
这是在应用程序从版本1.X更新到~2.16.2之后开始的。
我试过(没有取得积极的结果):
更新ember-cli-qunit.的
使用import { currentURL } from '@ember/test-helpers';.的
更新:
下面是其中一个测试的示例(标记为“碎片”问题部分):
test('My test', async () => {
await visit('/testing-page-1');
const selectSortId = find('[data-test-select="my-select"]');
equal(selectSortId.val(), "1", "Wrong selection,...");
await selectSortId.val(3).trigger('change');
equal(currentURL(), '/testing-page-2'); // All good here
const firstEditButton = find('[data-test-button="1"]');
await click(firstEditButton);
equal(currentURL(), '/testing-page-3'); // Flaky
const secondButton = find('[data-test-button="2"]');
await click(secondButton);
equal(currentURL(), '/testing-page-4') // Flaky
});发布于 2021-03-09 15:51:19
我终于修好了,这不是余烬测试服的问题.
应用程序中有一个Ember.hash,其中一个调用包含了一些数据,以便用一些参数填充我们的urls。
在生产中,对数据的调用明显慢于其他调用,因此我们幸运地获得了数据。在测试模式中,这些数据被其他调用覆盖。
这是一个糟糕的设计,需要重新分解.
https://stackoverflow.com/questions/66034670
复制相似问题