-
Notifications
You must be signed in to change notification settings - Fork 2.7k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add e2e for multiple setRoot (#4993)
- Loading branch information
Showing
6 changed files
with
79 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
const Utils = require('./Utils'); | ||
const TestIDs = require('../playground/src/testIDs'); | ||
const { elementById } = Utils; | ||
|
||
describe('SetRoot', () => { | ||
beforeEach(async () => { | ||
await device.relaunchApp(); | ||
await elementById(TestIDs.NAVIGATION_TAB).tap(); | ||
await elementById(TestIDs.SET_ROOT_BTN).tap(); | ||
}); | ||
|
||
it('set root multiple times with the same componentId', async () => { | ||
await elementById(TestIDs.SET_MULTIPLE_ROOTS_BTN).tap(); | ||
await expect(elementById(TestIDs.PUSHED_SCREEN_HEADER)).toBeVisible(); | ||
}); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,55 @@ | ||
const React = require('react'); | ||
const Root = require('../components/Root'); | ||
const Button = require('../components/Button') | ||
const Navigation = require('./../services/Navigation'); | ||
const { | ||
NAVIGATION_TAB, | ||
SET_MULTIPLE_ROOTS_BTN | ||
} = require('../testIDs'); | ||
const Screens = require('./Screens'); | ||
|
||
class SetRootScreen extends React.Component { | ||
static options() { | ||
return { | ||
topBar: { | ||
title: { | ||
text: 'Navigation' | ||
} | ||
}, | ||
bottomTab: { | ||
text: 'Navigation', | ||
icon: require('../../img/navigation.png'), | ||
testID: NAVIGATION_TAB | ||
} | ||
}; | ||
} | ||
|
||
render() { | ||
return ( | ||
<Root componentId={this.props.componentId}> | ||
<Button label='Set Multiple Roots' testID={SET_MULTIPLE_ROOTS_BTN} onPress={this.setMultipleRoot} /> | ||
</Root> | ||
); | ||
} | ||
|
||
setMultipleRoot = async () => { | ||
await this.setRoot(); | ||
await this.setRoot(); | ||
}; | ||
|
||
setRoot = async () => await Navigation.setRoot({ | ||
root: { | ||
stack: { | ||
id: 'stack', | ||
children: [{ | ||
component: { | ||
id: 'component', | ||
name: Screens.Pushed | ||
} | ||
}] | ||
} | ||
} | ||
}); | ||
} | ||
|
||
module.exports = SetRootScreen; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters