Skip to content

Instantly share code, notes, and snippets.

@rsicarelli
rsicarelli / valencia_cita_automation.json
Created October 8, 2021 13:54
Valencia 'administraction' publica cita web automation
/* Instructions
- Downlaod and install https://ui.vision/
- Open the chrome extension
- On top left, click on the small folder with plus icon
- Select "Import JSON"
- Import this file
*/
/* Running
- Select the "valencia cita automation" macro
This file has been truncated, but you can view the full file.
[
{
"id": "3",
"year": 1978,
"target": "DEU",
"name": "Aachen Cathedral ",
"type": "Cultural",
"region": "EUR",
"regionLong": "Europe and North America",
"coordinates": "N50 46 28 E6 5 4",
class SpannableTextView @JvmOverloads constructor(
context: Context,
attrs: AttributeSet? = null,
defStyle: Int = 0
) : TextView(context, attrs, defStyle) {
fun setSpannableText(vararg texts: SpannableStyle) {
buildWith(breaker = " ", blocks = *texts)
}
public static Intent getCallingIntent(Context context, ArrayList<GalleryPhoto> imagesOnDevice) {
Intent intent = new Intent(context, GalleryActivity.class);
intent.putParcelableArrayListExtra(EXTRA_IMAGES_ON_DEVICE, imagesOnDevice);
return intent;
}
...
@Test
public void someTest() {
@Test
public void shouldShareImageFromGallery() {
Instrumentation.ActivityResult result = new Instrumentation.ActivityResult(Activity.RESULT_OK, data);
intending(hasAction(Intent.ACTION_CHOOSER)).respondWith(result);
onView(withId(R.id.share)).perform(click());
intended(allOf(
hasExtras(allOf(
public void shareImage(String text, Uri imageUri) {
Intent shareIntent = new Intent();
shareIntent.setAction(Intent.ACTION_SEND);
shareIntent.putExtra(Intent.EXTRA_STREAM, imageUri);
shareIntent.setType("image/*");
activity.startActivity(Intent.createChooser(shareIntent, text));
}
@Test
public void shouldSelectImageOnCamera() {
Instrumentation.ActivityResult result = new Instrumentation.ActivityResult(Activity.RESULT_OK, data);
intending(hasAction(MediaStore.ACTION_IMAGE_CAPTURE)).respondWith(result);
onView(withId(R.id.camera)).perform(click());
}
@Test
public void someTest() {
Intents.init();
onView(withId(R.id.some_id)).perform(click());
Intents.release();
}
@Rule
public ActivityTestRule activityRule = new ActivityTestRule<>(
MainActivity.class,
true, // initialTouchMode
false); // launchActivity. False to set intent per method
public void navigateToCamera(Uri photoLocalUri, int requestImageCapture) {
Intent intent = new Intent(MediaStore.ACTION_IMAGE_CAPTURE);
intent.putExtra(MediaStore.EXTRA_OUTPUT, photoLocalUri);
activity.startActivityForResult(intent, requestImageCapture);
}