Skip to content

Instantly share code, notes, and snippets.

@rotemmiz
Created May 19, 2020 09:26
Show Gist options
  • Save rotemmiz/436c031bf01a93d942fbb017350d5643 to your computer and use it in GitHub Desktop.
Save rotemmiz/436c031bf01a93d942fbb017350d5643 to your computer and use it in GitHub Desktop.
Detox Recorder Output example
describe('My Recorded Spec', () => {
it('should follow my recorded test', async () => {
await element(by.label("Button")).tap();
await element(by.label("Button")).tap();
await element(by.id("MySwitch")).tap();
await element(by.id("MySwitch")).tap();
await element(by.type("UIView")).atIndex(37).tap();
await element(by.type("UIView")).atIndex(37).longPress(1002);
await element(by.id("MyDatePicker")).setDatePickerDate("2020-05-21T10:37:04+03:00", "yyyy-MM-dd'T'HH:mm:ssZZZZZ");
await element(by.id("MyDatePicker")).setDatePickerDate("2020-05-21T09:37:04+03:00", "yyyy-MM-dd'T'HH:mm:ssZZZZZ");
await element(by.id("MyDatePicker")).setDatePickerDate("2020-05-21T21:37:04+03:00", "yyyy-MM-dd'T'HH:mm:ssZZZZZ");
await element(by.id("MyPickerView")).setColumnToValue(2, "#");
await element(by.id("MyPickerView")).setColumnToValue(1, "3");
await element(by.label("Tabs")).tap();
await element(by.id("TextViewTestID")).replaceText("Lorem ipsum dolor sit er elit lamet, consectetaur cillium adipisicing pecu, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim aveniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum. Nam liber te conscient to factor tum poen legum odioque civiuda.");
await element(by.id("TextViewTestID")).replaceText("Lorem ipsum dolor sit er elit lamet, consectetaur cillium adipisicing pecu, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim asveniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum. Nam liber te conscient to factor tum poen legum odioque civiuda.");
await element(by.id("TextViewTestID")).replaceText("Lorem ipsum dolor sit er elit lamet, consectetaur cillium adipisicing pecu, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim asdveniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum. Nam liber te conscient to factor tum poen legum odioque civiuda.");
await element(by.id("TextFieldTestID")).replaceText("H");
await element(by.id("TextFieldTestID")).replaceText("He");
await element(by.id("TextFieldTestID")).replaceText("Hel");
await element(by.id("TextFieldTestID")).replaceText("Hell");
await element(by.id("TextFieldTestID")).replaceText("Hello");
await element(by.id("TextFieldTestID")).replaceText("Hello ");
await element(by.id("TextFieldTestID")).replaceText("Hello W");
await element(by.id("TextFieldTestID")).replaceText("Hello Wo");
await element(by.id("TextFieldTestID")).replaceText("Hello Wor");
await element(by.id("TextFieldTestID")).replaceText("Hello Worl");
await element(by.id("TextFieldTestID")).replaceText("Hello World");
await element(by.type("_UIButtonBarButton").and(by.label("Back"))).atIndex(1).tap();
await element(by.type("_UIButtonBarButton").and(by.label("Done"))).tap();
await element(by.id("Tab2")).tap();
await waitFor(element(by.id("LastButtonTestID"))).toBeVisible().whileElement(element(by.id("ScrollViewTestID"))).scroll(50, "down");
await element(by.id("LastButtonTestID")).tap();
await element(by.id("ScrollViewTestID")).scrollTo("top");
await element(by.type("_UIButtonBarButton").and(by.label("Done"))).tap();
await element(by.type("_UIButtonBarButton").and(by.label("Back"))).atIndex(0).tap();
await device.takeScreenshot("Screen1");
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment