Browse Source

test: language verification

Signed-off-by: Raju Udava <86527202+dstala@users.noreply.github.com>
pull/3848/head
Raju Udava 2 years ago committed by Muhammed Mustafa
parent
commit
dc3f150c06
  1. 29
      scripts/playwright/pages/Dashboard/index.ts
  2. 61
      scripts/playwright/tests/language.spec.ts

29
scripts/playwright/pages/Dashboard/index.ts

@ -75,6 +75,10 @@ export class DashboardPage extends BasePage {
await this.rootPage.waitForTimeout(2000); await this.rootPage.waitForTimeout(2000);
} }
async clickHome() {
await this.rootPage.locator('[data-cy="nc-noco-brand-icon"]').click();
}
async waitForTabRender({ title }: { title: string }) { async waitForTabRender({ title }: { title: string }) {
await this.get().locator('[pw-data="grid-id-column"]').waitFor(); await this.get().locator('[pw-data="grid-id-column"]').waitFor();
@ -101,4 +105,29 @@ export class DashboardPage extends BasePage {
`/#/nc/${this.project.id}/table/${title}` `/#/nc/${this.project.id}/table/${title}`
); );
} }
// Project page language menu
async openLanguageMenu() {
await this.rootPage.locator(".nc-menu-translate").click();
}
async selectLanguage({ index }: { index: number }) {
let modal = await this.rootPage.locator(".nc-dropdown-menu-translate");
await modal.locator(`.ant-dropdown-menu-item`).nth(index).click();
}
async verifyLanguage(param: { json: any }) {
let title = await this.rootPage
.locator(`.nc-project-page-title`)
.textContent();
let menu = await this.rootPage
.locator(`.nc-new-project-menu`)
.textContent();
console.log(title, menu);
expect(title).toContain(param.json.title.myProject);
expect(menu).toContain(param.json.title.newProj);
await this.rootPage
.locator(`[placeholder="${param.json.activity.searchProject}"]`)
.waitFor();
}
} }

61
scripts/playwright/tests/language.spec.ts

@ -0,0 +1,61 @@
import { test } from "@playwright/test";
import { DashboardPage } from "../pages/Dashboard";
import setup from "../setup";
const langMenu = [
"help-translate",
"ar.json",
"bn_IN.json",
"da.json",
"de.json",
"en.json",
"es.json",
"fa.json",
"fi.json",
"fr.json",
"he.json",
"hi.json",
"hr.json",
"id.json",
"it.json",
"ja.json",
"ko.json",
"lv.json",
"nl.json",
"no.json",
"pl.json",
"pt.json",
"pt_BR.json",
"ru.json",
"sl.json",
"sv.json",
"th.json",
"tr.json",
"uk.json",
"vi.json",
"zh-Hans.json",
"zh-Hant.json",
];
test.describe("Common", () => {
let dashboard: DashboardPage;
let context: any;
test.beforeEach(async ({ page }) => {
context = await setup({ page });
dashboard = new DashboardPage(page, context.project);
});
test("Language", async () => {
await dashboard.clickHome();
// Index is the order in which menu options appear
for (let i = 1; i < langMenu.length; i++) {
// scripts/playwright/tests/language.spec.ts
let json = require(`../../../packages/nc-gui/lang/${langMenu[i]}`);
await dashboard.openLanguageMenu();
await dashboard.selectLanguage({ index: i });
await dashboard.verifyLanguage({ json });
}
});
});
Loading…
Cancel
Save