Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use alternative selector script #4628

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
@@ -1,13 +1,16 @@
package com.wix.detox.espresso.web;


import static androidx.test.espresso.web.webdriver.DriverAtoms.findMultipleElements;

import static com.wix.detox.espresso.web.DetoxDriverAtoms.findMultipleElementsDetox;

import androidx.test.espresso.web.model.Atom;
import androidx.test.espresso.web.model.ElementReference;
import androidx.test.espresso.web.webdriver.Locator;

import java.util.List;

import static androidx.test.espresso.web.webdriver.DriverAtoms.findMultipleElements;

public class DetoxWebAtomMatcher {

Expand All @@ -16,19 +19,19 @@ private DetoxWebAtomMatcher() {
}

public static Atom<List<ElementReference>> matcherForId(String id) {
return findMultipleElements(Locator.ID, id);
return findMultipleElementsDetox(Locator.ID, id);
}

public static Atom<List<ElementReference>> matcherForClassName(String className) {
return findMultipleElements(Locator.CLASS_NAME, className);
return findMultipleElementsDetox(Locator.CLASS_NAME, className);
}

public static Atom<List<ElementReference>> matcherForCssSelector(String cssSelector) {
return findMultipleElements(Locator.CSS_SELECTOR, cssSelector);
return findMultipleElementsDetox(Locator.CSS_SELECTOR, cssSelector);
}

public static Atom<List<ElementReference>> matcherForName(String name) {
return findMultipleElements(Locator.NAME, name);
return findMultipleElementsDetox(Locator.NAME, name);
}

public static Atom<List<ElementReference>> matcherForXPath(String xpath) {
Expand All @@ -46,4 +49,4 @@ public static Atom<List<ElementReference>> matcherForPartialLinkText(String part
public static Atom<List<ElementReference>> matcherForTagName(String tag) {
return findMultipleElements(Locator.TAG_NAME, tag);
}
}
}
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
package com.wix.detox.espresso.web;

import android.util.Log;

import androidx.test.espresso.web.model.Atom;
import androidx.test.espresso.web.model.Atoms;
import androidx.test.espresso.web.model.ElementReference;
Expand Down Expand Up @@ -29,7 +31,9 @@ Web.WebInteraction<Void> getWebViewInteraction() {
}

ElementReference get() {
long timestamp = System.currentTimeMillis();
List<ElementReference> elements = getWebViewInteraction().withTimeout(30, TimeUnit.SECONDS).perform(matcherAtom).get();
Log.d("WebElement", "Time taken to get element: " + (System.currentTimeMillis() - timestamp) + "ms");

if (elements == null || elements.size() == 0 || index >= elements.size()) {
throw new RuntimeException(String.format("element was not found at index: %d", index));
Expand Down
2 changes: 1 addition & 1 deletion detox/package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "detox",
"description": "E2E tests and automation for mobile",
"version": "20.27.6",
"version": "20.27.7-smoke.0",
"bin": {
"detox": "local-cli/cli.js"
},
Expand Down
4 changes: 2 additions & 2 deletions detox/test/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "detox-test",
"version": "20.27.6",
"version": "20.27.7-smoke.0",
"private": true,
"engines": {
"node": ">=18"
Expand Down Expand Up @@ -61,7 +61,7 @@
"@typescript-eslint/parser": "^6.16.0",
"axios": "^1.7.7",
"cross-env": "^7.0.3",
"detox": "^20.27.6",
"detox": "^20.27.7-smoke.0",
"detox-allure2-adapter": "^1.0.0-alpha.8",
"eslint": "^8.56.0",
"eslint-plugin-unicorn": "^50.0.1",
Expand Down
4 changes: 2 additions & 2 deletions examples/demo-native-android/package.json
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
{
"name": "detox-demo-native-android",
"version": "20.27.6",
"version": "20.27.7-smoke.0",
"private": true,
"scripts": {
"packager": "react-native start",
"detox-server": "detox run-server"
},
"devDependencies": {
"detox": "^20.27.6"
"detox": "^20.27.7-smoke.0"
},
"detox": {}
}
4 changes: 2 additions & 2 deletions examples/demo-native-ios/package.json
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
{
"name": "detox-demo-native-ios",
"version": "20.27.6",
"version": "20.27.7-smoke.0",
"private": true,
"devDependencies": {
"detox": "^20.27.6"
"detox": "^20.27.7-smoke.0"
},
"detox": {
"specs": "",
Expand Down
4 changes: 2 additions & 2 deletions examples/demo-plugin/package.json
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
{
"name": "demo-plugin",
"version": "20.27.6",
"version": "20.27.7-smoke.0",
"private": true,
"scripts": {
"test:plugin": "detox test --configuration plugin -l verbose"
},
"devDependencies": {
"detox": "^20.27.6",
"detox": "^20.27.7-smoke.0",
"jest": "^29.0.0"
},
"detox": {
Expand Down
4 changes: 2 additions & 2 deletions examples/demo-react-native-detox-instruments/package.json
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
{
"name": "demo-react-native-detox-instruments",
"version": "20.27.6",
"version": "20.27.7-smoke.0",
"private": true,
"scripts": {},
"devDependencies": {
"detox": "^20.27.6"
"detox": "^20.27.7-smoke.0"
},
"detox": {
"configurations": {
Expand Down
4 changes: 2 additions & 2 deletions examples/demo-react-native/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "example",
"version": "20.27.6",
"version": "20.27.7-smoke.0",
"private": true,
"scripts": {
"start": "react-native start",
Expand Down Expand Up @@ -35,7 +35,7 @@
"@types/fs-extra": "^9.0.13",
"@types/jest": "^29.2.1",
"@types/react": "^18.0.24",
"detox": "^20.27.6",
"detox": "^20.27.7-smoke.0",
"fs-extra": "^9.1.0",
"jest": "^29.6.3",
"ts-jest": "^29.0.3",
Expand Down
2 changes: 1 addition & 1 deletion lerna.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
"generation",
"."
],
"version": "20.27.6",
"version": "20.27.7-smoke.0",
"npmClient": "npm",
"command": {
"publish": {
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -55,5 +55,5 @@
"shell-utils": "1.x.x",
"unified": "^10.1.0"
},
"version": "20.27.6"
"version": "20.27.7-smoke.0"
}