ionic-team / ionic-team/ionic-unit-testing-example

Searching for HTML elements works only on first rootPage in E2E testing

Đang mở
#73 0 bình luận 0 reaction 0 người được giao Xem trên GitHub
Ngôn ngữ chính
TypeScript
Star
370
Fork
144
Chỉ số merge pull request
Không có pull request nào được merge trong 30 ngày

Mô tả

Hey guys!

I am facing one issue when I try to run E2E tests. I am using Protractor (5.1.2) for E2E tests.
So everything works fine when I try to search for elements on the rootPage. My tests look like this:
```js
game.navigateToRoot();
game.startGame();
game.playTheGame();
```

Navigation to root works fine, I can normally find the START BUTTON and click on it, which leads me to the GameComponent (I actually change the root like this.nav.setRoot(GameComponent)).
When the game panel is shown, I can not do any HTML selector query, not even (browser.title), because neither one Promise callback is executed. I tried to wait the browser with:
```js
const until = rotractor.ExpectedConditions;
browser.wait(until.presenceOf(game.getFinalResultWrapper()), 5000, 'Element taking too long to appear in the DOM');
```

Here is my game page object where I make HTML queries:
```js
navigateToRoot() {
return browser.get('');
}

startGame() {
const startGameButton = this.getStartGameButton();
this.getStartGameButton().click();
// the NavController's root changes
}

getStartGameButton() {
return $('#start-game');
}

getFinalResultWrapper() {
return $('.level-complete-wrapper');
}

playTheGame() {
// nothing works from now on
const goalWrapper = $('#goal-wrapper');
const until = protractor.ExpectedConditions;
browser.wait(until.presenceOf(goalWrapper), 5000, 'Element taking too long to appear in the DOM');
browser.getTitle().then((title) => {
console.log('title = ', title);
});
$('#goal-wrapper').getSize().then((size) => {
console.log(size);
});
}
```

Hướng dẫn đóng góp

Chưa lập chỉ mục được hướng dẫn đóng góp cho kho mã nguồn này

Đánh giá

Issue này chưa được đánh giá.

Nhận issue mới trong hộp thư của bạn

Bản tóm tắt ngắn những issue GitHub phù hợp với người mới.