View Solution1.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
// 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; |
View .gitpod.Dockerfile
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 \ |
View loginPage.ts
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; |
View playwright.spec.ts
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) |
View loginPage.ts
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{ |
View example.ts
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
const page = await context.newPage(); | |
await page.goto('/'); | |
const loginPage = new LoginPage(page) | |
//option 1 | |
await loginPage.login(data) | |
//option 2 | |
await loginPage.userNameFill(userData.standart) | |
await loginPage.userPasswordFill(userData.correctPassword) | |
await loginPage.loginButtonClick() | |
await loginPage.burgerMenuClick() |
View spm.spec.ts
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('User can create GPW record', async ({page}) => { | |
await dashboardPage.createNewModule(dataModule) | |
// What if instead of comments, our code was self readable? | |
// Verify that module has name: [newModule] is created | |
const expectedMessage = `SuccessModule "${content}" was created.Close` | |
expect(dashboardPage.isModuleCreated(newModule).toEqual(expectedMessage) | |
await dashboardPage.isModuleCreated(newModule) | |
// Remove the new module to avoid spam | |
await dashboardPage.goToHomePage() |
View playwright-azure.yml
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
trigger: | |
- main | |
pool: | |
vmImage: ubuntu-latest | |
steps: | |
- task: NodeTool@0 | |
inputs: | |
versionSpec: '14.x' |
View happo.spec.ts
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
// @ts-check | |
import { test } from '@playwright/test'; | |
const happoPlaywright = require('happo-playwright'); | |
test.describe('Sitefinity CMS', () => { | |
test.beforeEach(async ({ page }) => { | |
await happoPlaywright.init(page); | |
await page.goto('https://afro.who.int/countries'); | |
await page.waitForLoadState('networkidle'); | |
await page.isVisible('[alt=Countries]'); |
View happo.js
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 { Page, test } from '@playwright/test'; | |
const happoPlaywright = require('happo-playwright'); | |
let page: Page; | |
test.beforeAll(async ({ browser }) => { | |
page = await browser.newPage(); | |
await happoPlaywright.init(page); | |
}); |
NewerOlder