Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feature/update translation tests #671

Merged
merged 31 commits into from
May 20, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
31 commits
Select commit Hold shift + click to select a range
618ead2
Web:Files:Tests: add new folder mock for mockData function
TimofeyBoyko May 18, 2022
20f9775
Web:Files:Tests: remove translation model from git
TimofeyBoyko May 18, 2022
86697f3
Web:Files:Tests: change screenshotOutput and baseFolder for translati…
TimofeyBoyko May 18, 2022
c2d9b8d
Web:Files:Tests: update translation tests and delete useless code
TimofeyBoyko May 18, 2022
13a96c9
Web:Files:Tests: add cloneModelScreenshot helper
TimofeyBoyko May 18, 2022
eaee2d2
Web:Files:Tests: update pathToModels for cloneModelScreenshot helper
TimofeyBoyko May 18, 2022
295ad63
Web:Files: start cloneModelScreenshot helper after creating model tra…
TimofeyBoyko May 18, 2022
44cf38b
Web:People:Tests: remove translation models from git
TimofeyBoyko May 18, 2022
2d892cf
Web:People:Tests: change screenshotOutput and baseFolder for translat…
TimofeyBoyko May 18, 2022
a8dab95
Web:People:Tests: update translation tests and delete useless code
TimofeyBoyko May 18, 2022
3ebc2db
Web:People:Tests: add cloneModelScreenshot helper
TimofeyBoyko May 18, 2022
a7c08fa
Web:People: start cloneModelScreenshot helper after creating model tr…
TimofeyBoyko May 18, 2022
d6fdc06
Web: update e2e.test:translation script, now create translation model…
TimofeyBoyko May 18, 2022
d5794df
Web:Components:TableContainer: remove '!important' for color style of…
TimofeyBoyko May 18, 2022
6dd814b
Web: fix translation tests crash
TimofeyBoyko May 18, 2022
830491e
Merge branch 'release/v1.2' into feature/update-translation-tests
TimofeyBoyko May 18, 2022
00fcb61
Web:Files/People:Tests: delete screenshotOutput when model translatio…
TimofeyBoyko May 19, 2022
d7898d3
Web:Files/People:Tests: update translation tests for personal
TimofeyBoyko May 19, 2022
58a4124
Web:Files/People:Tests: add mock-data for personal build
TimofeyBoyko May 19, 2022
6c73ad9
Web: add scripts for build and start translation tests on personal
TimofeyBoyko May 19, 2022
394aafb
Add bat file for run e2e translations tests on personal
TimofeyBoyko May 19, 2022
373e6dc
Web:Files:Tests: hide browser when tests are running
TimofeyBoyko May 19, 2022
cb23ce1
Web:Files/People:Tests: update changeCulture helper for personal
TimofeyBoyko May 19, 2022
31dec5f
Web:Files:Tests: add new translation tests: sort button on tile view,…
TimofeyBoyko May 19, 2022
85a28a7
Web:People:Tests: add new translation test: profile page
TimofeyBoyko May 19, 2022
7fa4aee
Web:People:Tests: add new mock endpoints and data: subscription and t…
TimofeyBoyko May 19, 2022
15cd287
Web:Editor: add build:test.translation:personal script
TimofeyBoyko May 19, 2022
494e8cf
Web:Studio:Tests: hide text when build project for translation tests
TimofeyBoyko May 19, 2022
7cb2d92
Web:Studio: delete console log
TimofeyBoyko May 20, 2022
4935dbc
Merge branch 'release/v1.2' into feature/update-translation-tests
AlexeySafronov May 20, 2022
dbeed86
Build: Removed old psl replacements
AlexeySafronov May 20, 2022
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 0 additions & 4 deletions build/run.e2e.translations.tests.bat
Original file line number Diff line number Diff line change
Expand Up @@ -27,14 +27,10 @@ powershell -Command "(gc build\deploy\nginx\onlyoffice.conf) -replace '#', '' |
xcopy config\nginx\sites-enabled\* build\deploy\nginx\sites-enabled\ /E /R /Y

REM fix paths
powershell -Command "(gc build\deploy\nginx\sites-enabled\onlyoffice-calendar.conf) -replace 'ROOTPATH', '%~dp0deploy\products\ASC.Calendar\client' -replace '\\', '/' | Out-File -encoding ASCII build\deploy\nginx\sites-enabled\onlyoffice-calendar.conf"
powershell -Command "(gc build\deploy\nginx\sites-enabled\onlyoffice-crm.conf) -replace 'ROOTPATH', '%~dp0deploy\products\ASC.CRM\client' -replace '\\', '/' | Out-File -encoding ASCII build\deploy\nginx\sites-enabled\onlyoffice-crm.conf"
powershell -Command "(gc build\deploy\nginx\sites-enabled\onlyoffice-editor.conf) -replace 'ROOTPATH', '%~dp0deploy\products\ASC.Files\editor' -replace '\\', '/' | Out-File -encoding ASCII build\deploy\nginx\sites-enabled\onlyoffice-editor.conf"
powershell -Command "(gc build\deploy\nginx\sites-enabled\onlyoffice-files.conf) -replace 'ROOTPATH', '%~dp0deploy\products\ASC.Files\client' -replace '\\', '/' | Out-File -encoding ASCII build\deploy\nginx\sites-enabled\onlyoffice-files.conf"
powershell -Command "(gc build\deploy\nginx\sites-enabled\onlyoffice-login.conf) -replace 'ROOTPATH', '%~dp0deploy\studio\login' -replace '\\', '/' | Out-File -encoding ASCII build\deploy\nginx\sites-enabled\onlyoffice-login.conf"
powershell -Command "(gc build\deploy\nginx\sites-enabled\onlyoffice-mail.conf) -replace 'ROOTPATH', '%~dp0deploy\products\ASC.Mail\client' -replace '\\', '/' | Out-File -encoding ASCII build\deploy\nginx\sites-enabled\onlyoffice-mail.conf"
powershell -Command "(gc build\deploy\nginx\sites-enabled\onlyoffice-people.conf) -replace 'ROOTPATH', '%~dp0deploy\products\ASC.People\client' -replace '\\', '/' | Out-File -encoding ASCII build\deploy\nginx\sites-enabled\onlyoffice-people.conf"
powershell -Command "(gc build\deploy\nginx\sites-enabled\onlyoffice-projects.conf) -replace 'ROOTPATH', '%~dp0deploy\products\ASC.Projects\client' -replace '\\', '/' | Out-File -encoding ASCII build\deploy\nginx\sites-enabled\onlyoffice-projects.conf"
powershell -Command "(gc build\deploy\nginx\sites-enabled\onlyoffice-studio.conf) -replace 'ROOTPATH', '%~dp0deploy\studio\client' -replace '\\', '/' | Out-File -encoding ASCII build\deploy\nginx\sites-enabled\onlyoffice-studio.conf"

REM restart nginx
Expand Down
67 changes: 67 additions & 0 deletions build/run.e2e.translations.tests.personal.bat
Original file line number Diff line number Diff line change
@@ -0,0 +1,67 @@
@echo off

PUSHD %~dp0
call runasadmin.bat "%~dpnx0"

if %errorlevel% == 0 (
PUSHD %~dp0..


echo "mode="


REM call yarn wipe
call yarn install

call yarn build:test.translation:personal

REM call yarn wipe
call yarn deploy:personal



REM copy nginx configurations to deploy folder
xcopy config\nginx\onlyoffice.conf build\deploy\nginx\ /E /R /Y
powershell -Command "(gc build\deploy\nginx\onlyoffice.conf) -replace '#', '' | Out-File -encoding ASCII build\deploy\nginx\onlyoffice.conf"

xcopy config\nginx\sites-enabled\* build\deploy\nginx\sites-enabled\ /E /R /Y

REM fix paths
powershell -Command "(gc build\deploy\nginx\sites-enabled\onlyoffice-editor.conf) -replace 'ROOTPATH', '%~dp0deploy\products\ASC.Files\editor' -replace '\\', '/' | Out-File -encoding ASCII build\deploy\nginx\sites-enabled\onlyoffice-editor.conf"
powershell -Command "(gc build\deploy\nginx\sites-enabled\onlyoffice-files.conf) -replace 'ROOTPATH', '%~dp0deploy\products\ASC.Files\client' -replace '\\', '/' | Out-File -encoding ASCII build\deploy\nginx\sites-enabled\onlyoffice-files.conf"
powershell -Command "(gc build\deploy\nginx\sites-enabled\onlyoffice-login.conf) -replace 'ROOTPATH', '%~dp0deploy\studio\login' -replace '\\', '/' | Out-File -encoding ASCII build\deploy\nginx\sites-enabled\onlyoffice-login.conf"
powershell -Command "(gc build\deploy\nginx\sites-enabled\onlyoffice-people.conf) -replace 'ROOTPATH', '%~dp0deploy\products\ASC.People\client' -replace '\\', '/' | Out-File -encoding ASCII build\deploy\nginx\sites-enabled\onlyoffice-people.conf"
powershell -Command "(gc build\deploy\nginx\sites-enabled\onlyoffice-studio.conf) -replace 'ROOTPATH', '%~dp0deploy\studio\client' -replace '\\', '/' | Out-File -encoding ASCII build\deploy\nginx\sites-enabled\onlyoffice-studio.conf"

REM restart nginx
echo service nginx stop
call sc stop nginx > nul

REM sleep 5 seconds
call ping 127.0.0.1 -n 6 > nul

echo service nginx start
call sc start nginx > nul

REM sleep 5 seconds
call ping 127.0.0.1 -n 6 > nul

call yarn e2e.test:translation:personal

exit



if NOT %errorlevel% == 0 (
echo Couldn't restarte Onlyoffice%%~nf service
)

)

echo.

POPD

if "%1"=="nopause" goto start
pause
:start
4 changes: 3 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
"build:personal": "lerna run build:personal --parallel --scope {@appserver/studio,@appserver/people,@appserver/files,@appserver/editor}",
"build:test": "lerna run build:test --parallel --ignore @appserver/common --ignore @appserver/components --ignore @appserver/browserslist-config-asc --ignore @appserver/debug-info",
"build:test.translation": "lerna run build:test.translation --parallel --ignore @appserver/common --ignore @appserver/components --ignore @appserver/browserslist-config-asc --ignore @appserver/debug-info",
"build:test.translation:personal": "lerna run build:test.translation:personal --parallel --ignore @appserver/common --ignore @appserver/components --ignore @appserver/browserslist-config-asc --ignore @appserver/debug-info",
"bump": "lerna version --no-push --no-git-tag-version",
"clean": "lerna run clean --parallel",
"deploy": "shx rm -rf build/deploy/products && shx rm -rf build/deploy/public && shx rm -rf build/deploy/studio && lerna run deploy --parallel --ignore @appserver/common --ignore @appserver/components --ignore @appserver/browserslist-config-asc && shx cp -r public build/deploy",
Expand Down Expand Up @@ -44,7 +45,8 @@
"e2e.test": "lerna run test:sequential --parallel --scope {@appserver/people,@appserver/files,@appserver/login}",
"e2e.test:sequential": "yarn workspace @appserver/people test:sequential && yarn workspace @appserver/files test:sequential && yarn workspace @appserver/login test:sequential",
"e2e.test:model": "yarn workspace @appserver/people test:model && yarn workspace @appserver/files test:model && yarn workspace @appserver/login test:model",
"e2e.test:translation": "lerna run test:translation --parallel --scope {@appserver/people,@appserver/files}"
"e2e.test:translation": "lerna run test:translation:model --parallel --scope {@appserver/people,@appserver/files} && lerna run test:translation --parallel --scope {@appserver/people,@appserver/files}",
"e2e.test:translation:personal": "lerna run test:translation:model:personal --parallel --scope {@appserver/people,@appserver/files} && lerna run test:translation:personal --parallel --scope {@appserver/people,@appserver/files}"
},
"devDependencies": {
"auto-changelog": "https://github.com/ONLYOFFICE/auto-changelog.git#master",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -263,7 +263,7 @@ const StyledTableHeaderCell = styled.div`
color: ${(props) =>
props.isActive
? props.theme.tableContainer.header.activeTextColor
: props.theme.tableContainer.header.textColor} !important;
: props.theme.tableContainer.header.textColor};

&:hover {
color: ${(props) =>
Expand Down
1 change: 1 addition & 0 deletions products/ASC.Files/Client/.gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
/coverage
/tests/output
/tests/reports
/tests/screenshots/translation

# production
/build
Expand Down
12 changes: 9 additions & 3 deletions products/ASC.Files/Client/codecept.conf.js
Original file line number Diff line number Diff line change
Expand Up @@ -26,14 +26,14 @@ const isModel = !!process.env.MODEL;

const screenshotOutput = isTranslation
? isModel
? `./tests/screenshots/translation/${browser}/${deviceType}`
: `./tests/output/translation/${browser}/${deviceType}`
? `./tests/screenshots/translation/`
: `./tests/output/translation/`
: isModel
? `./tests/screenshots/${browser}/${deviceType}`
: `./tests/output/${browser}/${deviceType}`;

const baseFolder = isTranslation
? `./tests/screenshots/translation/${browser}/${deviceType}`
? `./tests/screenshots/translation`
: `./tests/screenshots/${browser}/${deviceType}`;

const tests = isTranslation
Expand Down Expand Up @@ -63,6 +63,12 @@ if (isTranslation) {
fs.mkdir(diffFolder, { recursive: true }, (err) => {
if (err) throw err;
});

if (isModel) {
fs.rmdir(screenshotOutput, { recursive: true }, (err) => {
if (err) throw err;
});
}
}

exports.config = {
Expand Down
7 changes: 5 additions & 2 deletions products/ASC.Files/Client/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
"build:personal": "webpack --mode production --env personal=true",
"build:test": "webpack --env minimize=false --mode production",
"build:test.translation": "webpack --env minimize=false hideText=true --mode production",
"build:test.translation:personal": "webpack --env minimize=false hideText=true personal=true --mode production",
"clean": "shx rm -rf dist",
"deploy": "shx --silent mkdir -p ../../../build/deploy/products/ASC.Files/client && shx cp -r dist/* ../../../build/deploy/products/ASC.Files/client",
"serve": "serve dist -p 5008",
Expand All @@ -19,12 +20,14 @@
"test:smallTablet": "cross-env DEVICE_TYPE=smallTablet yarn test:codeceptjs",
"test:tablet": "cross-env DEVICE_TYPE=tablet yarn test:codeceptjs",
"test:desktop": "cross-env DEVICE_TYPE=desktop yarn test:codeceptjs ",
"test:translation": "cross-env DEVICE_TYPE=desktop translation=true yarn test:codeceptjs --profile chromium",
"test:translation": "cross-env DEVICE_TYPE=desktop translation=true yarn test:codeceptjs --profile chromium ",
"test:translation:personal": "cross-env DEVICE_TYPE=desktop translation=true personal=true yarn test:codeceptjs --profile chromium ",
"test:mobile:model": "cross-env DEVICE_TYPE=mobile MODEL=true yarn test:codeceptjs",
"test:smallTablet:model": "cross-env DEVICE_TYPE=smallTablet MODEL=true yarn test:codeceptjs",
"test:tablet:model": "cross-env DEVICE_TYPE=tablet MODEL=true yarn test:codeceptjs",
"test:desktop:model": "cross-env DEVICE_TYPE=desktop MODEL=true yarn test:codeceptjs",
"test:translation:model": "cross-env DEVICE_TYPE=desktop MODEL=true TRANSLATION=true yarn test:codeceptjs --profile chromium",
"test:translation:model": "cross-env DEVICE_TYPE=desktop MODEL=true translation=true yarn test:codeceptjs --profile chromium && node tests/helpers/cloneModelScreenshot.js",
"test:translation:model:personal": "cross-env DEVICE_TYPE=desktop MODEL=true translation=true personal=true yarn test:codeceptjs --profile chromium && node tests/helpers/cloneModelScreenshot.js",
"test:chromium:parallel": "run-p -c \"test:mobile --profile chromium \" \"test:smallTablet --profile chromium \" \"test:tablet --profile chromium \" \"test:desktop --profile chromium \" && yarn test:parse-xml",
"test:chromium:sequential": "run-s -c \"test:mobile --profile chromium \" \"test:smallTablet --profile chromium \" \"test:tablet --profile chromium \" \"test:desktop --profile chromium \" && yarn test:parse-xml",
"test:chromium:model": "run-s -c \"test:mobile:model --profile chromium \" \"test:smallTablet:model --profile chromium \" \"test:tablet:model --profile chromium \" \"test:desktop:model --profile chromium \" && yarn test:parse-xml",
Expand Down
1 change: 1 addition & 0 deletions products/ASC.Files/Client/steps_file.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ module.exports = function () {
this.mockEndpoint(Endpoints.capabilities, "capabilities");
this.mockEndpoint(Endpoints.thirdparty, "thirdparty");
this.mockEndpoint(Endpoints.thumbnails, "thumbnails");
this.mockEndpoint(Endpoints.getFolder(1), "1");
},

selectAuthor: function () {
Expand Down
37 changes: 26 additions & 11 deletions products/ASC.Files/Client/tests/helpers/changeCulture.js
Original file line number Diff line number Diff line change
@@ -1,34 +1,49 @@
const fs = require('fs');
const path = require('path');
const fs = require("fs");
const path = require("path");

const settingsFile = require(path.resolve(
__dirname,
'../mocking/mock-data/settings/settingsTranslation.json',
"../mocking/mock-data/settings/settingsTranslation.json"
));

const settingsFilePersonal = require(path.resolve(
__dirname,
"../mocking/mock-data/settings/settingsTranslationPersonal.json"
));

const selfFile = require(path.resolve(
__dirname,
'../mocking/mock-data/people/selfTranslation.json',
"../mocking/mock-data/people/selfTranslation.json"
));

function changeCulture(culture) {
settingsFile.response.culture = culture;
function changeCulture(culture, isPersonal) {
if (isPersonal) {
settingsFilePersonal.response.culture = culture;
} else {
settingsFile.response.culture = culture;
}
selfFile.response.cultureName = culture;

fs.writeFile(
path.resolve(__dirname, '../mocking/mock-data/settings/settingsTranslation.json'),
JSON.stringify(settingsFile, null, 2),
path.resolve(
__dirname,
`../mocking/mock-data/settings/settingsTranslation${
isPersonal ? "Personal" : ""
}.json`
),

JSON.stringify(isPersonal ? settingsFilePersonal : settingsFile, null, 2),
function writeJSON(err) {
if (err) return console.log(err);
},
}
);

fs.writeFile(
path.resolve(__dirname, '../mocking/mock-data/people/selfTranslation.json'),
path.resolve(__dirname, "../mocking/mock-data/people/selfTranslation.json"),
JSON.stringify(selfFile, null, 2),
function writeJSON(err) {
if (err) return console.log(err);
},
}
);
}

Expand Down
80 changes: 80 additions & 0 deletions products/ASC.Files/Client/tests/helpers/cloneModelScreenshot.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,80 @@
var path = require("path");
var fs = require("fs");
var async = require("async");

const config = require("../../../../../config/appsettings.json");
const cultures = config.web.cultures.split(",");

function getFiles(dirPath, callback) {
fs.readdir(dirPath, function (err, files) {
if (err) return callback(err);

var filePaths = [];
async.eachSeries(
files,
function (fileName, eachCallback) {
var filePath = path.join(dirPath, fileName);

fs.stat(filePath, function (err, stat) {
if (err) return eachCallback(err);

if (stat.isDirectory()) {
getFiles(filePath, function (err, subDirFiles) {
if (err) return eachCallback(err);

filePaths = filePaths.concat(subDirFiles);
eachCallback(null);
});
} else {
if (stat.isFile() && /\.png$/.test(filePath)) {
filePaths.push(filePath);
}

eachCallback(null);
}
});
},
function (err) {
callback(err, filePaths);
}
);
});
}

function getClonePath(filePath, culture) {
const splitFilePath = filePath.split("\\");

const splitFileName = splitFilePath[splitFilePath.length - 1].split("-");

splitFileName[0] = culture;

splitFilePath[splitFilePath.length - 1] = splitFileName.join("-");

const copyPath = splitFilePath.join("\\");

return copyPath;
}

function copyFile(filePath) {
cultures.forEach((culture) => {
const copyPath = getClonePath(filePath, culture);

fs.copyFile(filePath, copyPath, (err) => {
if (err) console.log(err);
});
});
}

const pathToModels = path.resolve(__dirname, "../screenshots/translation");

function cloneModelScreenshot() {
getFiles(pathToModels, function (err, files) {
if (err) console.log(err);

files.forEach((file) => {
copyFile(file);
});
});
}

cloneModelScreenshot();
6 changes: 5 additions & 1 deletion products/ASC.Files/Client/tests/ignoringCultures.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,9 @@
"mainPage": ["en"],
"profileMenu": ["en"],
"mainButton": ["en"],
"tableSettings": ["en"]
"tableSettings": ["en"],
"addButton": ["en"],
"sortMenu": ["en"],
"filterBlock": ["en"],
"contextMenu": ["en"]
}
Loading