Skip to content

Commit

Permalink
add basic passing e2e test for CampusToggle component #31
Browse files Browse the repository at this point in the history
  • Loading branch information
ritchellesap committed Mar 18, 2020
1 parent 7dea729 commit a9f3493
Show file tree
Hide file tree
Showing 5 changed files with 20 additions and 23 deletions.
1 change: 1 addition & 0 deletions __tests__/__snapshots__/campus-toggle.test.js.snap
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ exports[`CampusToggle component should match snapshot 1`] = `
onResponderTerminationRequest={[Function]}
onStartShouldSetResponder={[Function]}
style={null}
testID="SGWButton"
>
<View
style={
Expand Down
12 changes: 12 additions & 0 deletions e2e/campus-toggle.e2e-spec.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
const { reloadApp } = require("detox-expo-helpers");

describe("CampusToggle: Toggling between campuses", () => {
beforeEach(async () => {
await reloadApp();
});

it("should show the campus toggles", async () => {
// await expect(element(by.id("welcome"))).toBeVisible();
await expect(element(by.id("SGWButton"))).toBeVisible();
});
});
21 changes: 0 additions & 21 deletions e2e/firstTest.spec.js

This file was deleted.

3 changes: 2 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,8 @@
"eject": "expo eject",
"ios": "expo start --ios",
"start": "expo start",
"test": "jest --verbose --coverage",
"test": "jest __tests__ --verbose --coverage",
"e2e": "detox test",
"web": "expo start --web",
"setup-bin": "mkdirp bin/Exponent.app && cd bin/Exponent.app && wget https://dpq5q02fu5f55.cloudfront.net/Exponent-2.14.0.tar.gz && tar zxvf Exponent-2.14.0.tar.gz"
},
Expand Down
6 changes: 5 additions & 1 deletion src/components/campus-toggle/campus-toggle.component.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,11 @@ const CampusToggle = ({ onCampusToggle }: IProps) => {

return (
<View style={styles.container}>
<TouchableHighlight onPress={onSGWPressButton} underlayColor="white">
<TouchableHighlight
testID="SGWButton"
onPress={onSGWPressButton}
underlayColor="white"
>
<View
style={[isSGW ? styles.buttonSelected : styles.buttonNotSelected]}
>
Expand Down

0 comments on commit a9f3493

Please sign in to comment.