-
Notifications
You must be signed in to change notification settings - Fork 754
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add partial selenium tests implementation for Video component
- Loading branch information
Gabriel Negrusa
committed
Jul 9, 2021
1 parent
51447af
commit 2324f9f
Showing
5 changed files
with
179 additions
and
1 deletion.
There are no files selected for viewing
This file contains 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
54 changes: 54 additions & 0 deletions
54
...est/java/com/adobe/cq/wcm/core/components/it/seljup/components/video/VideoEditDialog.java
This file contains 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,54 @@ | ||
/*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ | ||
~ Copyright 2021 Adobe | ||
~ | ||
~ 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.adobe.cq.wcm.core.components.it.seljup.components.video; | ||
|
||
import com.adobe.cq.testing.selenium.pagewidgets.coral.CoralCheckbox; | ||
|
||
import static com.codeborne.selenide.Selenide.$$; | ||
|
||
public class VideoEditDialog { | ||
private static String loopEnabled = ".cmp-video__editor coral-checkbox[name='./loopEnabled']"; | ||
private static String hideControl = ".cmp-video__editor coral-checkbox[name='./hideControl']"; | ||
private static String autoplayEnabled = ".cmp-video__editor coral-checkbox[name='./autoplayEnabled']"; | ||
|
||
public void openVideoTab() { | ||
$$(".cmp-video__editor coral-tab").get(0).click(); | ||
} | ||
|
||
public void openPosterTab() { | ||
$$(".cmp-video__editor coral-tab").get(1).click(); | ||
} | ||
|
||
public void openPropertiesTab() { | ||
$$(".cmp-video__editor coral-tab").get(2).click(); | ||
} | ||
|
||
public void clickLoopEnabled() { | ||
CoralCheckbox checkbox = new CoralCheckbox(loopEnabled); | ||
checkbox.click(); | ||
} | ||
|
||
public void clickHideControl() { | ||
CoralCheckbox checkbox = new CoralCheckbox(hideControl); | ||
checkbox.click(); | ||
} | ||
|
||
public void clickAutoplayEnabled() { | ||
CoralCheckbox checkbox = new CoralCheckbox(autoplayEnabled); | ||
checkbox.click(); | ||
} | ||
} |
31 changes: 31 additions & 0 deletions
31
...m/src/test/java/com/adobe/cq/wcm/core/components/it/seljup/components/video/v1/Video.java
This file contains 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,31 @@ | ||
/*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ | ||
~ Copyright 2021 Adobe | ||
~ | ||
~ 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.adobe.cq.wcm.core.components.it.seljup.components.video.v1; | ||
|
||
import com.adobe.cq.testing.selenium.pagewidgets.common.BaseComponent; | ||
import com.adobe.cq.wcm.core.components.it.seljup.components.video.VideoEditDialog; | ||
|
||
public class Video extends BaseComponent { | ||
|
||
public Video() { | ||
super(".cmp-video"); | ||
} | ||
|
||
public VideoEditDialog getEditDialog() { | ||
return new VideoEditDialog(); | ||
} | ||
} |
91 changes: 91 additions & 0 deletions
91
...nium/src/test/java/com/adobe/cq/wcm/core/components/it/seljup/tests/video/v1/VideoIT.java
This file contains 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,91 @@ | ||
/*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ | ||
~ Copyright 2021 Adobe | ||
~ | ||
~ 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.adobe.cq.wcm.core.components.it.seljup.tests.video.v1; | ||
|
||
import com.adobe.cq.testing.selenium.pageobject.EditorPage; | ||
import com.adobe.cq.testing.selenium.pageobject.PageEditorPage; | ||
import com.adobe.cq.wcm.core.components.it.seljup.AuthorBaseUITest; | ||
import com.adobe.cq.wcm.core.components.it.seljup.components.video.VideoEditDialog; | ||
import com.adobe.cq.wcm.core.components.it.seljup.components.video.v1.Video; | ||
import com.adobe.cq.wcm.core.components.it.seljup.constant.CoreComponentConstants; | ||
import com.adobe.cq.wcm.core.components.it.seljup.util.Commons; | ||
import org.apache.http.HttpStatus; | ||
import org.apache.sling.testing.clients.ClientException; | ||
import org.junit.jupiter.api.*; | ||
|
||
import java.util.concurrent.TimeoutException; | ||
|
||
import static com.codeborne.selenide.Selenide.$; | ||
import static org.junit.jupiter.api.Assertions.assertTrue; | ||
|
||
@Tag("group2") | ||
public class VideoIT extends AuthorBaseUITest { | ||
|
||
private static String componentName = "video"; | ||
|
||
private String proxyComponentPath; | ||
|
||
protected String testPage; | ||
protected EditorPage editorPage; | ||
protected Video video; | ||
protected String cmpPath; | ||
protected String videoRT; | ||
|
||
private void setupResources() { | ||
videoRT = Commons.rtVideo_v1; | ||
} | ||
|
||
protected void setup() throws ClientException { | ||
testPage = authorClient.createPage("testPage", "Test Page", rootPage, defaultPageTemplate, 200, 201).getSlingPath(); | ||
proxyComponentPath = Commons.creatProxyComponent(adminClient, videoRT, "Proxy Video", componentName); | ||
addPathtoComponentPolicy(responsiveGridPath, proxyComponentPath); | ||
cmpPath = Commons.addComponent(adminClient, proxyComponentPath,testPage + Commons.relParentCompPath, componentName, null); | ||
editorPage = new PageEditorPage(testPage); | ||
editorPage.open(); | ||
video = new Video(); | ||
} | ||
|
||
@BeforeEach | ||
public void setupBefore() throws Exception { | ||
setupResources(); | ||
setup(); | ||
} | ||
|
||
@AfterEach | ||
public void cleanup() throws ClientException, InterruptedException { | ||
Commons.deleteProxyComponent(adminClient, proxyComponentPath); | ||
authorClient.deletePageWithRetry(testPage, true,false, CoreComponentConstants.TIMEOUT_TIME_MS, CoreComponentConstants.RETRY_TIME_INTERVAL, HttpStatus.SC_OK); | ||
} | ||
|
||
@Test | ||
@DisplayName("Test: Add video component") | ||
public void testAddVideo() throws InterruptedException { | ||
VideoEditDialog editDialog = video.getEditDialog(); | ||
Thread.sleep(4000); | ||
} | ||
|
||
@Test | ||
@DisplayName("Test: Check video boxes") | ||
public void testCheckBoxes() throws InterruptedException, TimeoutException { | ||
Commons.openEditDialog(editorPage, cmpPath); | ||
VideoEditDialog editDialog = video.getEditDialog(); | ||
editDialog.openPropertiesTab(); | ||
editDialog.clickLoopEnabled(); | ||
Commons.saveConfigureDialog(); | ||
assertTrue($(".cmp-video video").getAttribute("loop").equals(""), "loop is set"); | ||
} | ||
} |
This file contains 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