Skip to content

Commit

Permalink
EMA-150 auto test memory optimizing
Browse files Browse the repository at this point in the history
  • Loading branch information
Sanyi committed Jul 29, 2024
1 parent b855637 commit 03d55ff
Show file tree
Hide file tree
Showing 7 changed files with 14 additions and 16 deletions.
4 changes: 4 additions & 0 deletions dev/testv2/attributes/index.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,10 @@ describe('Attributes endpoint', function () {

describe('get', function () {
it('should fetch attributes including extra fields for customer', async function () {
// @TODO Remove this line when the test is ready
let deliberateError = true;
expect(deliberateError).to.be.false;

const { attributes } = await this.magentoApi.execute('attributes', 'get', { type: 'customer' });
const mappedAttributes = mapAttributes(attributes);

Expand Down
5 changes: 1 addition & 4 deletions dev/testv2/cypress.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,12 +9,9 @@ module.exports = defineConfig({
experimentalMemoryManagement: true,
experimentalModifyObstructiveThirdPartyCode: true,
modifyObstructiveCode: true,
chromeWebSecurity: false,
numTestsKeptInMemory: 0,
blockHosts: ['*snippet.url.com', '*scarabresearch.com'],
env: {
snippetUrl: 'http://snippet.url.com/main.js',
NODE_OPTIONS: "--max-old-space-size=4096"
snippetUrl: 'http://snippet.url.com/main.js'
},
e2e: {
// We've imported your old cypress plugins here.
Expand Down
4 changes: 4 additions & 0 deletions dev/testv2/cypress/integration/default-behaviour.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,10 @@ describe('Default behaviour with everything turned off', function () {
it('should not create customer_password_reset event', function () {
const newPassword = 'newPassword1';

// @TODO Remove this line when the test is ready
let deliberateError = true;
expect(deliberateError).to.be.false;

cy.loginWithCustomer(this.defaultCustomer);
cy.changeCredentials(this.defaultCustomer.password, { password: newPassword });

Expand Down
2 changes: 1 addition & 1 deletion dev/testv2/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
"scripts": {
"postinstall": "if [ -d \"./../../.git\" ]; then npm run copy-git-hooks; fi",
"test": "npm run mocha && npm run code-style",
"e2e": "cypress run --browser chrome",
"e2e": "cypress run --browser electron --headless",
"e2e:ci": "cypress run --browser electron --headless --record --key 80ddf60c-0dca-4075-8074-31207092e038",
"e2e:debug": "DEBUG=cypress:* cypress run --browser electron --headless",
"quick-test": "npm run mocha",
Expand Down
4 changes: 2 additions & 2 deletions dev/testv2/tools/docker/Dockerfile-mage-node
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@ ENV NPM_TOKEN=${NPM_TOKEN}
COPY testv2 /test

WORKDIR /test
RUN npm ci && free
RUN ./node_modules/.bin/cypress install && free
RUN npm i
RUN ./node_modules/.bin/cypress install
# RUN ./node_modules/.bin/cypress verify && free

#CMD /usr/local/bin/shell.sh ; sleep infinity
5 changes: 2 additions & 3 deletions dev/testv2/tools/scripts/run-e2e.sh
Original file line number Diff line number Diff line change
Expand Up @@ -24,12 +24,11 @@ echo "\n|--- Starting containers"
docker compose -p mage_e2e_"$project_version" -f $composefile up --build -d
echo "\n|--- Waiting for containers to initialize"
sh ./wait.sh e2e >>/dev/null 2>&1

echo "\n|--- Running frontend tests"
free
docker compose -p mage_e2e_"$project_version" -f $composefile run --rm node sh -c "free && npm run e2e" --exit-code-from node --abort-on-container-exit node
docker compose -p mage_e2e_"$project_version" -f $composefile run --rm node sh -c "npm run e2e" --exit-code-from node --abort-on-container-exit node
exitcode=$?
echo "\n\n|--- All tests passed"
free

docker compose -p mage_e2e_"$project_version" -f $composefile down
exit $exitcode
6 changes: 0 additions & 6 deletions dev/testv2/tools/scripts/run-unit.sh
Original file line number Diff line number Diff line change
Expand Up @@ -27,12 +27,6 @@ docker compose -p mage_unit_$project_version -f $composefile up --build -d
echo "\n|--- Waiting for containers to initialize"
sh ./wait.sh unit >>/dev/null 2>&1

if ![[ $VERSION =~ ^2\.3\.3 ]]
then
echo "\n|--- Testing Magento DI compilation"
docker compose -p mage_unit_$project_version -f $composefile exec -T --user application magento-test bash -c "bin/magento setup:di:compile"
fi

echo "\n|--- Running backend tests"
docker compose -p mage_unit_$project_version -f $composefile run --rm node sh -c "npm run mocha" --exit-code-from node --abort-on-container-exit node
exitcode=$?
Expand Down

0 comments on commit 03d55ff

Please sign in to comment.