-
Notifications
You must be signed in to change notification settings - Fork 4
playwright module unit tests #80
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
Open
mnovitskyi-cap
wants to merge
11
commits into
develop
Choose a base branch
from
feature/playwright-unit-tests
base: develop
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
11 commits
Select commit
Hold shift + click to select a range
683f4a4
add new playwright tests
91080e1
comment unassigned vars
ed01033
add properties to playwright module
30548d2
Merge branch 'develop' into feature/playwright-unit-tests
77d6f6c
correct test assertion
6dcbdea
correct test method name
4098dfe
add error message to assertion
2057580
Merge branch 'develop' into feature/playwright-unit-tests
faac50e
ignore setting proxy, if playwright.browser.proxy var is empty
2b1c4a6
add new line at EOF + format
39348c0
Merge branch 'develop' into feature/playwright-unit-tests
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
20 changes: 20 additions & 0 deletions
20
...aywright-module/src/main/java/com/capgemini/mrchecker/playwright/core/pages/TestPage.java
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,20 @@ | ||
| package com.capgemini.mrchecker.playwright.core.pages; | ||
|
|
||
| import com.capgemini.mrchecker.playwright.core.BasePage; | ||
|
|
||
| public class TestPage extends BasePage { | ||
| @Override | ||
| public boolean isLoaded() { | ||
| return true; | ||
| } | ||
|
|
||
| @Override | ||
| public void load() { | ||
| loadPage("https://google.com/"); | ||
| } | ||
|
|
||
| @Override | ||
| public String pageTitle() { | ||
| return getActualPageTitle(); | ||
| } | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
43 changes: 43 additions & 0 deletions
43
...e/src/test/java/com/capgemini/mrchecker/playwright/core/newDrivers/DriverManagerTest.java
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,43 @@ | ||
| package com.capgemini.mrchecker.playwright.core.newDrivers; | ||
|
|
||
| import static org.junit.jupiter.api.Assertions.assertTrue; | ||
|
|
||
| import org.junit.jupiter.api.*; | ||
|
|
||
| import com.capgemini.mrchecker.playwright.core.base.properties.PropertiesPlaywright; | ||
| import com.capgemini.mrchecker.playwright.tags.UnitTest; | ||
| import com.capgemini.mrchecker.test.core.base.properties.PropertiesSettingsModule; | ||
| import com.google.inject.Guice; | ||
|
|
||
| @UnitTest | ||
| public class DriverManagerTest { | ||
| private DriverManager driverManager; | ||
|
|
||
| @BeforeAll | ||
| public static void setUpBeforeClass() { | ||
| } | ||
|
|
||
| @AfterAll | ||
| public static void tearDownAfterClass() { | ||
| } | ||
|
|
||
| @BeforeEach | ||
| public void setUp() { | ||
| PropertiesPlaywright propertiesPlaywright = Guice.createInjector(PropertiesSettingsModule.init()) | ||
| .getInstance(PropertiesPlaywright.class); | ||
|
|
||
| driverManager = new DriverManager(propertiesPlaywright); | ||
| driverManager.start(); | ||
| } | ||
|
|
||
| @AfterEach | ||
| public void tearDown() { | ||
| driverManager.stop(); | ||
| } | ||
|
|
||
| @Test | ||
| public void shouldDriverBeCreated() { | ||
| assertTrue(DriverManager.wasDriverCreated(), "Driver was not created"); | ||
| } | ||
|
|
||
| } | ||
14 changes: 14 additions & 0 deletions
14
...ker-playwright-module/src/test/java/com/capgemini/mrchecker/playwright/tags/UnitTest.java
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,14 @@ | ||
| package com.capgemini.mrchecker.playwright.tags; | ||
|
|
||
| import java.lang.annotation.ElementType; | ||
| import java.lang.annotation.Retention; | ||
| import java.lang.annotation.RetentionPolicy; | ||
| import java.lang.annotation.Target; | ||
|
|
||
| import org.junit.jupiter.api.Tag; | ||
|
|
||
| @Target(ElementType.TYPE) | ||
| @Retention(RetentionPolicy.RUNTIME) | ||
| @Tag("UnitTest") | ||
| public @interface UnitTest { | ||
| } |
20 changes: 20 additions & 0 deletions
20
...playwright-module/src/test/java/com/capgemini/mrchecker/playwright/unit/BasePageTest.java
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,20 @@ | ||
| package com.capgemini.mrchecker.playwright.unit; | ||
|
|
||
| import org.junit.jupiter.api.Assertions; | ||
| import org.junit.jupiter.api.Test; | ||
|
|
||
| import com.capgemini.mrchecker.playwright.core.pages.TestPage; | ||
| import com.capgemini.mrchecker.playwright.tags.UnitTest; | ||
| import com.capgemini.mrchecker.test.core.BaseTest; | ||
| import com.capgemini.mrchecker.test.core.utils.PageFactory; | ||
|
|
||
| @UnitTest | ||
| class BasePageTest extends BaseTest { | ||
|
|
||
| @Test | ||
| void testGetPageTitle() { | ||
| TestPage testPage = PageFactory.getPageInstance(TestPage.class); | ||
| testPage.load(); | ||
| Assertions.assertEquals("Google", testPage.pageTitle(), "Wrong page title"); | ||
| } | ||
| } |
44 changes: 44 additions & 0 deletions
44
...odule/src/test/java/com/capgemini/mrchecker/playwright/unit/DefaultDriverBrowserTest.java
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,44 @@ | ||
| package com.capgemini.mrchecker.playwright.unit; | ||
|
|
||
| import static org.junit.jupiter.api.Assertions.assertEquals; | ||
|
|
||
| import org.junit.jupiter.api.*; | ||
| import org.junit.jupiter.api.parallel.ResourceLock; | ||
|
|
||
| import com.capgemini.mrchecker.playwright.core.newDrivers.DriverManager; | ||
| import com.capgemini.mrchecker.playwright.core.pages.TestPage; | ||
| import com.capgemini.mrchecker.playwright.tags.UnitTest; | ||
| import com.capgemini.mrchecker.test.core.utils.PageFactory; | ||
|
|
||
| @UnitTest | ||
| @ResourceLock(value = "SingleThread") | ||
| public class DefaultDriverBrowserTest { | ||
| @BeforeAll | ||
| public static void setUpBeforeClass() { | ||
| } | ||
|
|
||
| @AfterAll | ||
| public static void tearDownAfterClass() { | ||
| } | ||
|
|
||
| @BeforeEach | ||
| public void setUp() { | ||
|
|
||
| } | ||
|
|
||
| @AfterEach | ||
| public void tearDown() { | ||
| } | ||
|
|
||
| @Test | ||
| public void testParameterGetChrome() { | ||
| TestPage testPage = PageFactory.getPageInstance(TestPage.class); | ||
| testPage.load(); | ||
| String driverName = DriverManager.getDriver() | ||
| .browser() | ||
| .browserType() | ||
| .name(); | ||
| assertEquals("chromium", driverName, "Wrong browser name"); | ||
| } | ||
|
|
||
| } |
39 changes: 39 additions & 0 deletions
39
...dule/src/test/java/com/capgemini/mrchecker/playwright/unit/NewPlaywrightBrowsersTest.java
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,39 @@ | ||
| package com.capgemini.mrchecker.playwright.unit; | ||
|
|
||
| import static org.junit.jupiter.api.Assertions.assertEquals; | ||
|
|
||
| import org.junit.jupiter.api.Test; | ||
|
|
||
| import com.capgemini.mrchecker.playwright.core.newDrivers.NewPlaywright; | ||
| import com.capgemini.mrchecker.playwright.tags.UnitTest; | ||
| import com.microsoft.playwright.Browser; | ||
| import com.microsoft.playwright.Playwright; | ||
|
|
||
| @UnitTest | ||
| public class NewPlaywrightBrowsersTest { | ||
| private final NewPlaywright playwright = new NewPlaywright(Playwright.create()); | ||
|
|
||
| @Test | ||
| public void shouldBrowserNameBeFirefox() { | ||
| Browser browser = playwright.firefox() | ||
| .launch(); | ||
| assertEquals("firefox", browser.browserType() | ||
| .name(), "Wrong browser name"); | ||
| } | ||
|
|
||
| @Test | ||
| public void shouldBrowserNameBeChromium() { | ||
| Browser browser = playwright.chromium() | ||
| .launch(); | ||
| assertEquals("chromium", browser.browserType() | ||
| .name(), "Wrong browser name"); | ||
| } | ||
|
|
||
| @Test | ||
| public void shouldBrowserNameBeWebkit() { | ||
| Browser browser = playwright.webkit() | ||
| .launch(); | ||
| assertEquals("webkit", browser.browserType() | ||
| .name(), "Wrong browser name"); | ||
| } | ||
| } |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
Double newline, please use formatter