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
package com.saucelabs.saucebindings.junit5.examples.without; | |
import java.net.MalformedURLException; | |
import java.net.URL; | |
import java.util.HashMap; | |
import java.util.Map; | |
import org.junit.jupiter.api.BeforeEach; | |
import org.junit.jupiter.api.Test; | |
import org.junit.jupiter.api.TestInfo; | |
import org.junit.jupiter.api.extension.ExtensionContext; |
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
// Problem: Test order dependency | |
@FixMethodOrder(MethodSorters.NAME_ASCENDING) // This ensures the test methods are executed in lexicographical order by their names | |
public class TestOrderDependency { | |
private static WebDriver driver; | |
@BeforeClass | |
public static void setUpClass() throws Exception { | |
DesiredCapabilities caps = new DesiredCapabilities(); | |
caps.setCapability("browserName", "chrome"); |
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
package com.saucelabs.saucebindings.junit4.examples; | |
public class ConditionTester { | |
private boolean actionDone; | |
public boolean option1(boolean conditionA, boolean conditionB) { | |
if (!conditionA) { | |
actionDone = true; // Represents "Another action" | |
return actionDone; | |
} |
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
interface UserData { | |
username: string; | |
password: string; | |
} | |
interface AddressData { | |
street: string; | |
city: string; | |
zipCode: string; | |
} |
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
//usage | |
const actualQuantity = | |
await locationInventoryPage.getQuantityColumnValueUsing(adjustment.receiptData.lotNumber); | |
const actualQuantity = | |
await locationInventoryPage.getInventoryQuantityUsing(adjustment.receiptData.lotNumber); | |
async getQuantityColumnValue(item: string): Promise<string> { | |
return this.getInventoryQuantityCellFromRowUsingOtherLabelSelector(item).innerText(); | |
} |
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
// Solution to 1 | |
import org.junit.Test; | |
import static org.junit.Assert.assertEquals; | |
public class AdditionTest { | |
@Test | |
public void testSum() { | |
int sum = 3 + 4; | |
int expectedSum = 7; |
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
FROM gitpod/workspace-full-vnc:latest | |
USER gitpod | |
RUN bash -c ". /home/gitpod/.sdkman/bin/sdkman-init.sh && \ | |
sdk install java 17.0.3-ms && \ | |
sdk default java 17.0.3-ms" | |
# Install dependencies. | |
RUN sudo apt-get update \ |
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
export class LoginPage { | |
readonly page: Page; | |
readonly userNameTextbox: Locator | |
readonly passwordTextbox: Locator | |
readonly loginBtn: Locator | |
// Clarity over duplication removal | |
// Don't start with the abstraction | |
constructor(page: Page) { | |
this.page = page; |
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
test('Dashboard page should not have any WCAG A violations', async ({ page }) => { | |
const authentication = new Authentication(page); | |
const loginPage = new LoginPage(page); | |
const dashboardPage = new DashboardPage(page); | |
await loginPage.login(user) | |
// Wait until the logo is visible - default 30000 | |
await dashboardPage.waitForLogo() | |
await page.getByRole('button', { name: 'Log In' }).click(); | |
await authentication.loginWith2FA(user) |
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
import { expect, Locator, Page } from '@playwright/test'; | |
const userNameFieldLoc = '[id="user-name"]' | |
const passwordFieldLoc = '[id="password"]' | |
const loginButtonLoc = '[id="login-button"]' | |
const errorloc = '[data-test="error"]' | |
const headerLoc = '[class="title"]' | |
const burgerMenue = '[id="react-burger-menu-btn"]' | |
const aboutButtonLoc = '[id="about_sidebar_link"]' | |
export default class LoginPage{ |
NewerOlder