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
package PortfolioTests; | |
import java.util.Arrays; | |
public class CodeWars { | |
public static void main(String[] args) { | |
Integer[] ar = {100, 5, 3, 99, 34, 63, 2}; | |
int sum = 39; | |
// bubble(ar); | |
// findSum(ar, sum); |
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
const {webdriver, Builder, By, Key, until} = require('selenium-webdriver'), | |
test = require('selenium-webdriver/testing'), | |
assert = require('assert'); | |
test.describe('PortfolioTestsAsyncAwait', function() { | |
test.before(async function () { | |
driver = await new Builder().forBrowser('chrome').build(); | |
}); | |
test.it('01 Drums Access Await', async function () { |
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
const {webdriver, Builder, By, Key, until} = require('selenium-webdriver'), | |
test = require('selenium-webdriver/testing'), | |
assert = require('assert'); | |
let driver; | |
test.describe('PortfolioTests', function() { | |
test.before(function *() { | |
driver = new Builder().forBrowser('chrome').build(); | |
}); |
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
const {Builder, By, Key, until} = require('selenium-webdriver'); | |
let driver = new Builder().forBrowser('chrome').build(); | |
driver.get("https://andreidbr.github.io/JS30/"); | |
driver.findElement(By.xpath('/html/body/div[2]/div[1]')).click(); | |
driver.wait(until.titleIs('JS30: 01 Drums'), 1000); | |
driver.close(); |
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
@Test(testName = "Check all sounds", description = "Check that, when clicking every key, a sound is played", groups = {"01Drums"}) | |
public void soundsPlayTest() throws InterruptedException { | |
driver.findElement(By.xpath("/html/body/div[2]/div[1]")).click(); | |
List<WebElement> keyList = driver.findElements(By.className("key")); | |
List<WebElement> audioList = driver.findElements(By.tagName("audio")); | |
Actions builder = new Actions(driver); | |
for (int i = 0; i < keyList.size(); i++) { | |
Action sendKey = builder.moveToElement(keyList.get(i)).sendKeys(String.valueOf(keyList.get(i).getText().charAt(0))).build(); | |
sendKey.perform(); |
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
@Test(testName = "06 Filter Functionality Test", description = "Check that the 06 Filter page functions correctly", groups = {"06Filter"}) | |
public void verifyFilterTest() throws InterruptedException { | |
driver.findElement(By.xpath("/html/body/div[2]/div[6]")).click(); | |
driver.findElement(By.xpath("/html/body/form/input")).sendKeys("an"); | |
Thread.sleep(500); | |
driver.findElement(By.xpath("/html/body/form/input")).sendKeys("dr"); | |
if (driver.findElement(By.className("name")).isDisplayed()) { | |
List<WebElement> resultList = driver.findElements(By.className("name")); |
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
@Test(testName = "Listen for Sound", description = "Check that, when clicking the 'A' key, a sound is played", groups = {"01Drums"}) | |
public void soundPlayTest() throws InterruptedException { | |
driver.findElement(By.xpath("/html/body/div[2]/div[1]")).click(); | |
WebElement aKey = driver.findElement(By.xpath("/html/body/div/div[1]")); | |
Actions builder = new Actions(driver); | |
Action sendAKey = builder.moveToElement(aKey).sendKeys("A").build(); | |
sendAKey.perform(); | |
Thread.sleep(1000); | |
WebElement audio = driver.findElement(By.tagName("audio")); |
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
@Test(testName = "03 CSS Variable Functionality Test", description = "Check that the 03 CSS Variable page functions correctly", groups = {"03CSS"}) | |
public void verifyCSSTest() { | |
driver.findElement(By.xpath("/html/body/div[2]/div[3]")).click(); | |
String initialStyle = driver.findElement(By.xpath("/html")).getAttribute("style"); | |
WebElement slider = driver.findElement(By.xpath("/html/body/div/p[1]/input[2]")); | |
slider.click(); | |
slider.sendKeys(Keys.ARROW_RIGHT); | |
String secondStyle = driver.findElement(By.xpath("/html")).getAttribute("style"); | |
Assert.assertNotEquals(initialStyle, secondStyle); |
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
@Test(testName = "02 Clock Functionality Test", description = "Check that the 02 Clock page functions correctly", groups = {"02Clock"}) | |
public void verifyClockTest() throws InterruptedException { | |
driver.findElement(By.xpath("/html/body/div[2]/div[2]")).click(); | |
String firstStyle = driver.findElement(By.xpath("/html/body/div/div/div[3]")).getAttribute("style"); | |
Thread.sleep(2000); | |
String secondStyle = driver.findElement(By.xpath("/html/body/div/div/div[3]")).getAttribute("style"); | |
Assert.assertNotEquals(firstStyle, secondStyle, "There are no differences in the two styles"); | |
} |
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
@Test(testName = "Click 'A' Test", description = "Check that you can click the 'A' key and the correct response triggers", groups = {"01Drums"}) | |
public void aKeyTest() { | |
driver.findElement(By.xpath("/html/body/div[2]/div[1]")).click(); | |
WebElement aKey = driver.findElement(By.xpath("/html/body/div/div[1]")); | |
Actions builder = new Actions(driver); | |
Action sendAKey = builder.moveToElement(aKey).sendKeys("A").build(); | |
sendAKey.perform(); | |
Assert.assertEquals(aKey.getAttribute("class"), "key playing"); | |
} |
NewerOlder