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 io.github.bonigarcia.wdm.WebDriverManager; | |
//This method will run once before all of the tests in our class | |
@BeforeClass | |
public static void setupClass() { | |
WebDriverManager.chromedriver().setup(); | |
} | |
//The setup() will run one time before every single @Test method | |
//In our case it will instantiate a new ChromeDriver that WebDriverManager setup for us | |
@Before |
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{ |
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() |
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() |
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]'); |
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); | |
}); |
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 { defineConfig } = require("cypress"); | |
export default defineConfig({ | |
e2e: { | |
// this URL keeps automatically failing the test | |
baseUrl: "https://who--spmstage.sandbox.lightning.force.com/lightning/page/home", | |
failOnStatusCode: false, | |
setupNodeEvents(on, config) { | |
// implement node event listeners here | |
}, |
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
@RunWith(Parameterized.class) | |
public class DesktopTests extends SauceBaseTest { | |
/* | |
* Configure our data driven parameters | |
* */ | |
@Parameterized.Parameter | |
public Browser browserName; | |
@Parameterized.Parameter(1) | |
public String browserVersion; | |
@Parameterized.Parameter(2) |