Skip to content

Commit

Permalink
fix: error in expectation of orientation change
Browse files Browse the repository at this point in the history
  • Loading branch information
DudaGod committed Apr 5, 2021
1 parent f7e438b commit 3c8b21d
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 12 deletions.
8 changes: 4 additions & 4 deletions lib/browser/commands/set-orientation/index.js
Expand Up @@ -9,17 +9,17 @@ module.exports = (browser) => {
}

session.overwriteCommand('setOrientation', async (origSetOrientation, orientation) => {
const result = await origSetOrientation(orientation);

if (!config.waitOrientationChange) {
return result;
return origSetOrientation(orientation);
}

const initialBodyWidth = await getBodyWidth();
const result = await origSetOrientation(orientation);

if (typeof result === 'string' && result.match(/Already in/)) {
return result;
}

const initialBodyWidth = await getBodyWidth();
await waitForOrientationChange(initialBodyWidth, orientation);

return result;
Expand Down
8 changes: 0 additions & 8 deletions test/lib/browser/commands/set-orientation/index.js
Expand Up @@ -60,14 +60,6 @@ describe('"setOrientation" command', () => {

assert.notCalled(session.waitUntil);
});

it('should not get initial body width', async () => {
await mkBrowser_().init();

await session.setOrientation('portrait');

assert.notCalled(session.execute);
});
});

it('should return changed orientation if it differs from the current one', async () => {
Expand Down

0 comments on commit 3c8b21d

Please sign in to comment.