-
Notifications
You must be signed in to change notification settings - Fork 107
[MBL-16328][Teacher] Implement E2E test for quiz edit and preview #3405
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
base: master
Are you sure you want to change the base?
Changes from all commits
35c0d71
c5f9c2a
73d44d8
d4f3639
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,46 @@ | ||
| /* | ||
| * Copyright (C) 2025 - present Instructure, Inc. | ||
| * | ||
| * Licensed under the Apache License, Version 2.0 (the "License"); | ||
| * you may not use this file except in compliance with the License. | ||
| * You may obtain a copy of the License at | ||
| * | ||
| * http://www.apache.org/licenses/LICENSE-2.0 | ||
| * | ||
| * Unless required by applicable law or agreed to in writing, software | ||
| * distributed under the License is distributed on an "AS IS" BASIS, | ||
| * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
| * See the License for the specific language governing permissions and | ||
| * limitations under the License. | ||
| */ | ||
| package com.instructure.teacher.ui.pages.classic | ||
|
|
||
| import androidx.test.espresso.web.assertion.WebViewAssertions.webMatches | ||
| import androidx.test.espresso.web.sugar.Web.onWebView | ||
| import androidx.test.espresso.web.webdriver.DriverAtoms.findElement | ||
| import androidx.test.espresso.web.webdriver.DriverAtoms.getText | ||
| import androidx.test.espresso.web.webdriver.Locator | ||
| import com.instructure.espresso.page.BasePage | ||
| import com.instructure.espresso.page.waitForViewWithId | ||
| import com.instructure.teacher.R | ||
| import org.hamcrest.Matchers.containsString | ||
|
|
||
| class QuizPreviewPage : BasePage(R.id.canvasWebView) { | ||
|
|
||
| fun assertPreviewLoaded() { | ||
| waitForViewWithId(R.id.canvasWebView) | ||
| } | ||
|
|
||
| fun assertQuizTitleDisplayed(quizTitle: String) { | ||
| onWebView() | ||
| .withElement(findElement(Locator.TAG_NAME, "body")) | ||
| .check(webMatches(getText(), containsString(quizTitle))) | ||
| } | ||
|
|
||
| fun assertQuizDescriptionDisplayed(description: String) { | ||
| onWebView() | ||
| .withElement(findElement(Locator.TAG_NAME, "body")) | ||
| .check(webMatches(getText(), containsString(description))) | ||
| } | ||
|
|
||
| } |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -107,6 +107,7 @@ class QuizPreviewWebviewFragment : InternalWebViewFragment() { | |
| @JvmStatic val TITLE = "title" | ||
|
|
||
| fun newInstance(args: Bundle) = QuizPreviewWebviewFragment().apply { | ||
| arguments = args | ||
|
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. This change fixes a bug where the fragment's arguments weren't being set, which could cause issues when the fragment is recreated. However, this is a production code fix that should be called out explicitly in the PR description and potentially covered with a unit test. Consider adding a test to verify that the arguments are properly set when creating a new instance of this fragment. |
||
| url = args.getString(URL)!! | ||
| title = args.getString(TITLE)!! | ||
| } | ||
|
|
@@ -116,6 +117,7 @@ class QuizPreviewWebviewFragment : InternalWebViewFragment() { | |
| args.putString(URL, url) | ||
| args.putString(TITLE, title) | ||
| args.putBoolean(DARK_TOOLBAR, false) | ||
| args.putBoolean(AUTHENTICATE, true) | ||
|
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. Adding
Was this missing authentication causing the preview to fail in the E2E test? |
||
| return args | ||
| } | ||
| } | ||
|
|
||
Uh oh!
There was an error while loading. Please reload this page.