-
Notifications
You must be signed in to change notification settings - Fork 137
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
[UI Test] Test for "login not WP" case. #13098
base: trunk
Are you sure you want to change the base?
Changes from all commits
5e906c5
ef8b3bd
0a1803f
2b6c9a1
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
{ | ||
"request": { | ||
"method": "GET", | ||
"urlPath": "/rest/v1.1/connect/site-info/", | ||
"queryParameters": { | ||
"url": { | ||
"matches": ".*notawpsite.com.*" | ||
} | ||
} | ||
}, | ||
"response": { | ||
"status": 200, | ||
"jsonBody": { | ||
"exists": true, | ||
"isWordPress": false, | ||
"hasJetpack": false, | ||
"isJetpackActive": false, | ||
"isJetpackConnected": false, | ||
"isWordPressDotCom": false, | ||
"urlAfterRedirects": "", | ||
"jetpackVersion": false | ||
}, | ||
"headers": { | ||
"Content-Type": "application/json", | ||
"Connection": "keep-alive", | ||
"Cache-Control": "no-cache, must-revalidate, max-age=0" | ||
} | ||
} | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,24 +1,29 @@ | ||
{ | ||
"request": { | ||
"method": "GET", | ||
"urlPath": "/rest/v1.1/connect/site-info/" | ||
"request": { | ||
"method": "GET", | ||
"urlPath": "/rest/v1.1/connect/site-info/", | ||
"queryParameters": { | ||
"url": { | ||
"matches": ".*automatticwidgets.wpcomstaging.com.*" | ||
} | ||
} | ||
}, | ||
"response": { | ||
"status": 200, | ||
"jsonBody": { | ||
"exists": true, | ||
"isWordPress": true, | ||
"hasJetpack": true, | ||
"isJetpackActive": true, | ||
"isJetpackConnected": true, | ||
"isWordPressDotCom": true, | ||
"urlAfterRedirects": "https:\/\/automatticwidgets.wpcomstaging.com", | ||
"jetpackVersion": false | ||
}, | ||
"response": { | ||
"status": 200, | ||
"jsonBody": { | ||
"exists": true, | ||
"isWordPress": true, | ||
"hasJetpack": true, | ||
"isJetpackActive": true, | ||
"isJetpackConnected": true, | ||
"isWordPressDotCom": true, | ||
"urlAfterRedirects": "https:\/\/automatticwidgets.wpcomstaging.com", | ||
"jetpackVersion": false | ||
}, | ||
"headers": { | ||
"Content-Type": "application/json", | ||
"Connection": "keep-alive", | ||
"Cache-Control": "no-cache, must-revalidate, max-age=0" | ||
} | ||
"headers": { | ||
"Content-Type": "application/json", | ||
"Connection": "keep-alive", | ||
"Cache-Control": "no-cache, must-revalidate, max-age=0" | ||
} | ||
} | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
package com.woocommerce.android.e2e.screens.login | ||
|
||
import androidx.test.espresso.Espresso | ||
import androidx.test.espresso.assertion.ViewAssertions | ||
import androidx.test.espresso.matcher.ViewMatchers | ||
import com.woocommerce.android.R | ||
import com.woocommerce.android.e2e.helpers.util.Screen | ||
|
||
class LoginNotWPScreen : Screen { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Remark, technically, the error is shown on the |
||
companion object { | ||
val ERROR_MESSAGE = R.string.login_not_wordpress_site_v2 | ||
} | ||
constructor() : super(ERROR_MESSAGE) | ||
|
||
fun assertErrorElements(): LoginNotWPScreen { | ||
Espresso.onView(ViewMatchers.withText(R.string.login_try_another_store)) | ||
.check(ViewAssertions.matches(ViewMatchers.isDisplayed())) | ||
|
||
Espresso.onView(ViewMatchers.withText(R.string.login_try_another_account)) | ||
.check(ViewAssertions.matches(ViewMatchers.isDisplayed())) | ||
|
||
return this | ||
} | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
@file:Suppress("DEPRECATION") | ||
|
||
package com.woocommerce.android.e2e.tests.ui | ||
|
||
import androidx.compose.ui.test.junit4.createComposeRule | ||
import androidx.test.rule.ActivityTestRule | ||
import com.woocommerce.android.e2e.helpers.InitializationRule | ||
import com.woocommerce.android.e2e.helpers.TestBase | ||
import com.woocommerce.android.e2e.rules.RetryTestRule | ||
import com.woocommerce.android.e2e.screens.login.SiteAddressScreen | ||
import com.woocommerce.android.e2e.screens.login.WelcomeScreen | ||
import com.woocommerce.android.ui.login.LoginActivity | ||
import dagger.hilt.android.testing.HiltAndroidRule | ||
import dagger.hilt.android.testing.HiltAndroidTest | ||
import org.junit.Before | ||
import org.junit.Rule | ||
import org.junit.Test | ||
|
||
@HiltAndroidTest | ||
class LoginUITest: TestBase() { | ||
@get:Rule(order = 0) | ||
val rule = HiltAndroidRule(this) | ||
|
||
@get:Rule(order = 1) | ||
val composeTestRule = createComposeRule() | ||
|
||
@get:Rule(order = 2) | ||
val initRule = InitializationRule() | ||
|
||
@get:Rule(order = 3) | ||
var activityRule = ActivityTestRule(LoginActivity::class.java) | ||
|
||
@get:Rule(order = 4) | ||
var retryTestRule = RetryTestRule() | ||
|
||
@Before | ||
fun setUp() { | ||
WelcomeScreen | ||
.skipCarouselIfNeeded() | ||
.selectLogin() | ||
} | ||
|
||
@Test | ||
fun siteAddressWithWrongURL() { | ||
SiteAddressScreen() | ||
.openLoginNotWpScreen(siteAddress = "notawpsite.com") | ||
.assertErrorElements() | ||
} | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
remark, the
.
in the site address there matches any character, you might want to replace it with\\.