Searching for HTML elements works only on first rootPage in E2E testing
还没有人认领这个 Issue。
评估
- 难度
- 3/5
- 预计耗时
- 1-2 天
- 新手友好度
- 35/100
- Issue 类型
- 缺陷
- 描述清晰度
- 基本清楚
- 活跃度
- 停滞
- 技术栈
- javascript
- 领域
- testing
调研方向
在页面对象中重现 Protractor 的 E2E 流程:导航到根页面,点击 #start-game,然后在 NavController 更改根页面后查询 #goal-wrapper 和浏览器标题。首先检查 GameComponent 显示后浏览器命令会发生什么。完成标准是选择器、等待、getTitle() 和 getSize() 都能在游戏页面上完成。
由索引模型根据 Issue 内容生成。
描述
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:
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:
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:
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);
});
}
- 主要语言
- TypeScript
- 星标
- 370
- 派生
- 144
- PR 合并指标
- 30 天内没有已合并 PR
贡献指南
这个仓库没有索引到贡献指南
从这里开始
- 先读完整个 Issue,再读项目的贡献指南。
- 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
- Fork 仓库,在一个分支上完成修改。
- 提交 Pull Request,并在描述里引用这个 Issue 编号。
ionic-team/ionic-unit-testing-example 的其他 Issue
-
难度 2/5 1-3 小时 新手友好度 35/100
-
难度 3/5 1-2 天 新手友好度 20/100
-
难度 3/5 1-2 天 新手友好度 35/100
-
难度 4/5 3-5 天 新手友好度 20/100
-
难度 4/5 3-5 天 新手友好度 25/100
ionic-team/ionic-unit-testing-example#91 · 7 条评论 · 11 个 reaction ·
查看 ionic-team/ionic-unit-testing-example 的全部 Issue
相似的 Issue
-
难度 2/5 1-3 小时 新手友好度 84/100
Eynzof/Hermes-CN-Desktop#610 ·
-
bug clawsweeper:linked-pr-open clawsweeper:needs-live-repro clawsweeper:no-new-fix-pr impact:message-loss issue-rating: 🐚 platinum hermit P2 regression
难度 2/5 1-3 小时 新手友好度 78/100
-
enhancement
难度 2/5 1-3 小时 新手友好度 68/100
-
calcite-components needs triage refactor
难度 2/5 1-3 小时 新手友好度 75/100
Esri/calcite-design-system#15203 ·
-
难度 2/5 1-3 小时 新手友好度 90/100
danielmiessler/LifeOS#2218 ·