Add translation acceptance test (#13280)

* Add translation acceptance test

* Bump testhelpers version

Co-authored-by: Nikolaj Geisle <70372949+Zeegaan@users.noreply.github.com>
This commit is contained in:
Dami Tugbobo
2022-10-24 01:35:01 -04:00
committed by GitHub
parent 66cea99807
commit facadac318
3 changed files with 39 additions and 8 deletions

View File

@@ -8,7 +8,7 @@
"hasInstallScript": true,
"dependencies": {
"@umbraco/json-models-builders": "^1.0.0",
"@umbraco/playwright-testhelpers": "^1.0.10",
"@umbraco/playwright-testhelpers": "^1.0.11",
"camelize": "^1.0.0",
"dotenv": "^16.0.2",
"faker": "^4.1.0",
@@ -101,9 +101,9 @@
}
},
"node_modules/@umbraco/playwright-testhelpers": {
"version": "1.0.10",
"resolved": "https://registry.npmjs.org/@umbraco/playwright-testhelpers/-/playwright-testhelpers-1.0.10.tgz",
"integrity": "sha512-4NTuMbbNWGcawZIuYnDdPUGN4W2F9iw0EvsyJ2Pr5rYj8Rg1PCu2MXW77r27fGhfr31PYDEL6RSL9zp8SyxfJg==",
"version": "1.0.11",
"resolved": "https://registry.npmjs.org/@umbraco/playwright-testhelpers/-/playwright-testhelpers-1.0.11.tgz",
"integrity": "sha512-subAc4t3903+uRZayNnoVxv9yXDnz32th2emTAuwTBi2yc+JRRGOB5Yv4WSYYRWUnMgBXaiDdsJFNjoMQSFWTQ==",
"dependencies": {
"@umbraco/json-models-builders": "^1.0.0",
"camelize": "^1.0.0",
@@ -906,9 +906,9 @@
}
},
"@umbraco/playwright-testhelpers": {
"version": "1.0.10",
"resolved": "https://registry.npmjs.org/@umbraco/playwright-testhelpers/-/playwright-testhelpers-1.0.10.tgz",
"integrity": "sha512-4NTuMbbNWGcawZIuYnDdPUGN4W2F9iw0EvsyJ2Pr5rYj8Rg1PCu2MXW77r27fGhfr31PYDEL6RSL9zp8SyxfJg==",
"version": "1.0.11",
"resolved": "https://registry.npmjs.org/@umbraco/playwright-testhelpers/-/playwright-testhelpers-1.0.11.tgz",
"integrity": "sha512-subAc4t3903+uRZayNnoVxv9yXDnz32th2emTAuwTBi2yc+JRRGOB5Yv4WSYYRWUnMgBXaiDdsJFNjoMQSFWTQ==",
"requires": {
"@umbraco/json-models-builders": "^1.0.0",
"camelize": "^1.0.0",

View File

@@ -19,7 +19,7 @@
},
"dependencies": {
"@umbraco/json-models-builders": "^1.0.0",
"@umbraco/playwright-testhelpers": "^1.0.10",
"@umbraco/playwright-testhelpers": "^1.0.11",
"camelize": "^1.0.0",
"faker": "^4.1.0",
"form-data": "^4.0.0",

View File

@@ -0,0 +1,31 @@
import {ConstantHelper, test} from '@umbraco/playwright-testhelpers';
test.describe('Translation', () => {
test.beforeEach(async ({page, umbracoApi}) => {
// TODO: REMOVE THIS WHEN SQLITE IS FIXED
// Wait so we don't bombard the API
await page.waitForTimeout(1000);
await umbracoApi.login();
});
test('Creates a dictionary key', async ({umbracoUi, umbracoApi, page}) => {
const dictionaryKey = "Test Key";
await umbracoApi.users.ensureUserBelongsToGroup("translator");
await umbracoUi.goToSection(ConstantHelper.sections.translation);
await umbracoApi.translation.ensureKeyNotExists(dictionaryKey);
await umbracoUi.clickElement(umbracoUi.getButtonByLabelKey('dictionary_createNew'));
let form = await page.locator('form[name="createDictionaryForm"]');
await form.locator('input[name="itemKey"]').fill(dictionaryKey);
await form.locator('.umb-button > .btn > .umb-button__content', { hasText: "Create" }).click();
await umbracoUi.clickElement(umbracoUi.getButtonByLabelKey(ConstantHelper.buttons.save))
// Assert
await umbracoUi.isSuccessNotificationVisible();
// Clean up
await umbracoApi.translation.ensureKeyNotExists(dictionaryKey);
});
});