Я получаю следующий сбой в некоторых функциях Cucumber: «NoSuchElementError: Элемент не найден с помощью локатора: By (css selector, h1)»
Я попытался установить большее время ожидания, чтобы дать Cucumber большевремя, чтобы найти элементы, но это не похоже на работу
Вот основные компоненты теста: cardTitle.feature:
@cardTitle-feature
Feature: See card title
Display the card title
@cardTitle-scenario
Scenario: Card Page
Given I am on the card page
When I do nothing
Then I should see the card title
app.steps.ts:
// Go to the card - Display the title
Given(/^I am on the card page$/, async () => {
await page.navigateToCard();
});
When(/^I do nothing$/, () => {
});
Then(/^I should see the card title$/, async () => {
expect(await page.getCardTitleText()).to.equal('Profile');
});
app.po.ts:
navigateToCard() {
this.sleep(3000);
return browser.get('/card');
}
getCardTitleText() {
this.sleep(3000);
return element(by.css('h1')).getText();
}
card.html:
<div class="profile-container">
<!-- EXAMPLE TOP NAV -->
<h1>Profile</h1>
...
Я думаю, что это может произойти, потому что "карта" может быть недоступна безвойдите в приложение.Если это проблема, как я могу выполнить тест, который входит в приложение, а затем проверяет элемент «h1»?Спасибо!