Skip to content

Commit 9a9fa4b

Browse files
Revert "fix: wait for element to be displayed before assertView (#1244)"
This reverts commit 7b57b7b.
1 parent 36f5036 commit 9a9fa4b

3 files changed

Lines changed: 10 additions & 11 deletions

File tree

src/browser/commands/assert-view/index.js

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -170,23 +170,23 @@ module.exports.default = browser => {
170170
testplaneCtx.assertViewResults.add({ stateName: state, refImg: refImg });
171171
};
172172

173-
const waitSelectorsForDisplayed = async (browser, selectors) => {
173+
const waitSelectorsForExist = async (browser, selectors) => {
174174
await Promise.all(
175175
[].concat(selectors).map(selector =>
176176
browser
177177
.$(selector)
178-
.then(el => el.waitForDisplayed())
178+
.then(el => el.waitForExist())
179179
.catch(() => {
180180
throw new Error(
181-
`element ("${selector}") still not displayed after ${browser.options.waitforTimeout} ms`,
181+
`element ("${selector}") still not existing after ${browser.options.waitforTimeout} ms`,
182182
);
183183
}),
184184
),
185185
);
186186
};
187187

188188
const assertViewBySelector = async (browser, state, selectors, opts) => {
189-
await waitSelectorsForDisplayed(browser, selectors);
189+
await waitSelectorsForExist(browser, selectors);
190190

191191
return assertView(state, selectors, opts);
192192
};
@@ -214,9 +214,9 @@ module.exports.default = browser => {
214214
session.addCommand(
215215
"assertView",
216216
async function (state, opts = {}) {
217-
await this.waitForDisplayed({ timeoutMsg: "custom timeout msg" }).catch(() => {
217+
await this.waitForExist({ timeoutMsg: "custom timeout msg" }).catch(() => {
218218
throw new Error(
219-
`element ("${this.selector}") still not displayed after ${this.options.waitforTimeout} ms`,
219+
`element ("${this.selector}") still not existing after ${this.options.waitforTimeout} ms`,
220220
);
221221
});
222222

test/src/browser/commands/assert-view/index.js

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -119,24 +119,24 @@ describe("assertView command", () => {
119119
assert.equal(error.refImg.path, "/ref/invalid");
120120
});
121121

122-
it("should wait for all selectors to be displayed", async () => {
122+
it("should wait for all selectors to exist", async () => {
123123
const browser = await initBrowser_();
124124
const element = await browser.publicAPI.$(".selector");
125125

126126
await browser.publicAPI.assertView("plain", [".selector1", ".selector2"]);
127127

128128
assert.calledWith(browser.publicAPI.$, ".selector1");
129129
assert.calledWith(browser.publicAPI.$, ".selector2");
130-
assert.calledTwice(element.waitForDisplayed);
130+
assert.calledTwice(element.waitForExist);
131131
});
132132

133-
it("should wait for element to be displayed", async () => {
133+
it("should wait for element to exist", async () => {
134134
const browser = await initBrowser_();
135135
const element = await browser.publicAPI.$(".selector");
136136

137137
await element.assertView("plain");
138138

139-
assert.calledOnce(element.waitForDisplayed);
139+
assert.calledOnce(element.waitForExist);
140140
});
141141

142142
it("should fail on duplicate name of the state on mixed scopes", async () => {

test/src/browser/utils.js

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -122,7 +122,6 @@ const mkSessionStub_ = () => {
122122
selector: ".selector",
123123
click: sinon.stub().named("click").resolves(),
124124
waitForExist: sinon.stub().named("waitForExist").resolves(),
125-
waitForDisplayed: sinon.stub().named("waitForDisplayed").resolves(),
126125
};
127126

128127
session.sessionId = "1234567890";

0 commit comments

Comments
 (0)