Skip to content

Commit

Permalink
feat(test): add test for toggle theme in web ide
Browse files Browse the repository at this point in the history
  • Loading branch information
xpyctumo committed Feb 11, 2025
1 parent 54b24a2 commit 761e7a9
Show file tree
Hide file tree
Showing 4 changed files with 19 additions and 0 deletions.
3 changes: 3 additions & 0 deletions tests/locators.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,9 @@ export const UNIT_TESTS_LOCATOR =
export const GIT_TAB_LOCATOR =
'//div[contains(@class, "WorkspaceSidebar_action_")][4]';

export const SWITCH_THEME_LOCATOR =
'(//div[contains(@class, "WorkspaceSidebar_action_")])[6]';

export const DELETE_PROJECT_LOCATOR =
'//div[contains(@class, "ManageProject_deleteProject")]';

Expand Down
16 changes: 16 additions & 0 deletions tests/project/toggle-theme.spec.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
import { expect, test } from '@playwright/test';
import { SWITCH_THEME_LOCATOR } from 'tests/locators';

test('Theme should switch', async ({ page }) => {
// Open Web IDE
await page.goto('https://ide.ton.org/');

// Validate light theme
await expect(page).toHaveScreenshot('light.png', { maxDiffPixels: 100 });
await expect(page.locator(SWITCH_THEME_LOCATOR)).toBeVisible();

// Toggle theme
await page.locator(SWITCH_THEME_LOCATOR).click();
// Validate dark theme
await expect(page).toHaveScreenshot('dark.png', { maxDiffPixels: 100 });
});
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

0 comments on commit 761e7a9

Please sign in to comment.