v9: Fix tests on Linux (#11586)

* downgraded cypress, updated package

* Fixed language test

* Fix language test

* Fixed routing tests to wait for popup

* Publish test artifacts

* Added better element to wait on

* Fix routing tests for linux

* Fix language tests on linux

* Stablize tabs tests

* Implement waiting for inner tree like in content tests

* Assert that we are in settings section so we dont click an element that doesnt exist

* Fixed rollback by not doing cy.reload()

* Fix language test with correct wait

* Stabilize dataTypes by moving API Call, and stabilize systemInformation.ts test by waiting for success notification

* Fix dataTypes, tabs and template tests

* Update node to newer version in package-lock.json and fix template test

* Implemented cy.wait to test if it is because we are too fast

* Added comments

* Bigger wait

* Try another wait instead of magic numbers

Co-authored-by: Nikolaj Geisle <niko737@edu.ucl.dk>
This commit is contained in:
Nikolaj Geisle
2021-11-15 14:19:34 +01:00
committed by Bjarke Berg
parent 169fc7c12f
commit 32d8e0bb96
9 changed files with 2378 additions and 46 deletions

View File

@@ -259,7 +259,6 @@ stages:
# customCommand: 'run test -- --config="viewportHeight=812,viewportWidth=375,screenshotsFolder=cypress/artifacts/mobile/screenshots,videosFolder=cypress/artifacts/mobile/videos,videoUploadOnPasses=false"'
- task: PublishPipelineArtifact@1
displayName: "Publish test artifacts"
condition: failed()
inputs:
targetPath: '$(Build.SourcesDirectory)/tests/Umbraco.Tests.AcceptanceTest/cypress/artifacts'
artifact: 'Test artifacts - Windows'
@@ -361,13 +360,11 @@ stages:
# customCommand: 'run test -- --config="viewportHeight=812,viewportWidth=375,screenshotsFolder=cypress/artifacts/mobile/screenshots,videosFolder=cypress/artifacts/mobile/videos,videoUploadOnPasses=false"'
- task: PublishPipelineArtifact@1
displayName: "Publish test artifacts"
condition: failed()
inputs:
targetPath: '$(Build.SourcesDirectory)/tests/Umbraco.Tests.AcceptanceTest/cypress/artifacts'
artifact: 'Test artifacts - Linux'
- task: PublishPipelineArtifact@1
displayName: "Publish run log"
condition: failed()
inputs:
targetPath: '$(Build.ArtifactStagingDirectory)/dotnet_run_log_linux.txt'
artifact: Test Run logs - Linux

View File

@@ -353,7 +353,7 @@ context('Content', () => {
cy.get('.umb-editor-footer-content__right-side > [button-style="success"] > .umb-button > .btn-success').click();
cy.reload();
refreshContentTree();
// Assert
cy.get('.history').find('.umb-badge').contains('Save').should('be.visible');

View File

@@ -57,11 +57,16 @@ context('Routing', () => {
beforeEach(() => {
cy.umbracoLogin(Cypress.env('username'), Cypress.env('password'));
// Ensure cleaned before tests run
cy.deleteAllContent();
cy.umbracoEnsureDocumentTypeNameNotExists(rootDocTypeName);
cy.umbracoEnsureLanguageNotExists(danishCulture);
cy.umbracoEnsureLanguageNotExists(swedishCulture);
});
afterEach(() => {
// Cleanup after tests
cy.deleteAllContent();
cy.umbracoEnsureDocumentTypeNameNotExists(rootDocTypeName);
cy.umbracoEnsureLanguageNotExists(danishCulture);
cy.umbracoEnsureLanguageNotExists(swedishCulture);
@@ -75,9 +80,6 @@ context('Routing', () => {
.withAllowCultureVariation(true)
.build();
cy.deleteAllContent();
cy.umbracoEnsureDocumentTypeNameNotExists(rootDocTypeName);
saveNewLanguages();
cy.saveDocumentType(rootDocType).then((generatedRootDocType) => {
@@ -129,9 +131,6 @@ context('Routing', () => {
.withAllowCultureVariation(true)
.build();
cy.deleteAllContent();
cy.umbracoEnsureDocumentTypeNameNotExists(rootDocTypeName);
saveNewLanguages();
cy.saveDocumentType(rootDocType).then((generatedRootDocType) => {
@@ -173,7 +172,8 @@ context('Routing', () => {
cy.umbracoTreeItem("content", [nodeName, childNodeName]).click();
cy.umbracoButtonByLabelKey('buttons_saveAndPublish').click();
// Pop-up with what cultures you want to publish shows, click it
cy.get('.umb-list').contains("Swedish").click();
cy.get('.umb-list').should('be.visible');
cy.get('.checkbox').last().click();
cy.umbracoButtonByLabelKey('buttons_saveAndPublish').last().click();
// Assert
@@ -189,9 +189,6 @@ context('Routing', () => {
.withAllowCultureVariation(true)
.build();
cy.deleteAllContent();
cy.umbracoEnsureDocumentTypeNameNotExists(rootDocTypeName);
saveNewLanguages();
cy.saveDocumentType(rootDocType).then((generatedRootDocType) => {
@@ -256,14 +253,16 @@ context('Routing', () => {
cy.umbracoTreeItem("content", [nodeName, childNodeName]).click();
cy.umbracoButtonByLabelKey('buttons_saveAndPublish').click();
//Pop-up with what cultures you want to publish shows, click it
cy.get('.umb-list').contains("Swedish").click();
cy.get('.umb-list').should('be.visible');
cy.get('.checkbox').last().click();
cy.umbracoButtonByLabelKey('buttons_saveAndPublish').last().click();
// Publish Grandchild
cy.umbracoTreeItem("content", [nodeName, childNodeName, grandChildNodeName]).click();
cy.umbracoButtonByLabelKey('buttons_saveAndPublish').click();
// Pop-up with what cultures you want to publish shows, click it
cy.get('.umb-list').contains("Swedish").click();
cy.get('.umb-list').should('be.visible');
cy.get('.checkbox').last().click();
cy.umbracoButtonByLabelKey('buttons_saveAndPublish').last().click();
// Assert
@@ -279,9 +278,6 @@ context('Routing', () => {
.withAllowCultureVariation(true)
.build();
cy.deleteAllContent();
cy.umbracoEnsureDocumentTypeNameNotExists(rootDocTypeName);
saveNewLanguages();
cy.saveDocumentType(rootDocType).then((generatedRootDocType) => {
@@ -351,15 +347,16 @@ context('Routing', () => {
cy.umbracoTreeItem("content", [nodeName, childNodeName]).click();
cy.umbracoButtonByLabelKey('buttons_saveAndPublish').click();
// Pop-up with what cultures you want to publish shows, click it
cy.get('.umb-list').contains("Swedish").click();
cy.get('.umb-list').should('be.visible');
cy.get('.checkbox').last().click();
cy.umbracoButtonByLabelKey('buttons_saveAndPublish').last().click();
// Publish Grandchild
cy.umbracoTreeItem("content", [nodeName, childNodeName, grandChildNodeName]).click();
cy.umbracoButtonByLabelKey('buttons_saveAndPublish').click();
// Pop-up with what cultures you want to publish shows, click it
cy.get('.umb-list').contains("Swedish").click();
cy.get('.umb-list').contains("Danish").click();
cy.get('.umb-list').should('be.visible');
cy.get('.checkbox').click({multiple : true});
cy.umbracoButtonByLabelKey('buttons_saveAndPublish').last().click();
// Assert

View File

@@ -8,8 +8,8 @@ import {
context('DataTypes', () => {
beforeEach(() => {
cy.umbracoLogin(Cypress.env('username'), Cypress.env('password'), false);
});
cy.umbracoLogin(Cypress.env('username'), Cypress.env('password'));
});
it('Tests Approved Colors', () => {
cy.deleteAllContent();
@@ -26,6 +26,12 @@ context('DataTypes', () => {
//umbracoMakeDocTypeWithDataTypeAndContent(name, alias, pickerDataType);
cy.umbracoCreateDocTypeWithContent(name, alias, pickerDataType);
//Editing template with some content
cy.editTemplate(name, '@inherits Umbraco.Cms.Web.Common.Views.UmbracoViewPage<ApprovedColourTest>' +
'\n@{' +
'\n Layout = null;' +
'\n}' +
'\n<p style="color:@Model.UmbracoTest">Lorem ipsum dolor sit amet</p>');
// Act
// Enter content
@@ -36,22 +42,19 @@ context('DataTypes', () => {
//Save
cy.umbracoButtonByLabelKey('buttons_saveAndPublish').click();
cy.umbracoSuccessNotification().should('be.visible');
//Editing template with some content
cy.editTemplate(name, '@inherits Umbraco.Cms.Web.Common.Views.UmbracoViewPage<ApprovedColourTest>' +
'\n@{' +
'\n Layout = null;' +
'\n}' +
'\n<p style="color:@Model.UmbracoTest">Lorem ipsum dolor sit amet</p>');
//Assert
const expected = `<p style="color:000000" > Lorem ipsum dolor sit amet </p>`;
cy.umbracoVerifyRenderedViewContent('/', expected, true).should('be.true');
cy.get('.umb-button__overlay').should('not.be.visible');
//Pick another colour to verify both work
cy.get('.btn-FF0000').click();
//Save
cy.umbracoButtonByLabelKey('buttons_saveAndPublish').click();
cy.umbracoSuccessNotification().should('be.visible');
cy.umbracoButtonByLabelKey('buttons_saveAndPublish').should('be.visible');
cy.get('.umb-button__overlay').should('not.be.visible');
//Assert
const expected2 = '<p style="color:FF0000">Lorem ipsum dolor sit amet</p>';
cy.umbracoVerifyRenderedViewContent('/', expected2, true).should('be.true');
@@ -100,6 +103,7 @@ context('DataTypes', () => {
cy.get('.property-error').should('be.visible');
// Clean
cy.umbracoEnsureTemplateNameNotExists(name);
cy.umbracoEnsureDataTypeNameNotExists(name);
cy.umbracoEnsureDocumentTypeNameNotExists(name);
})

View File

@@ -24,7 +24,7 @@ context('System Information', () => {
cy.contains('Current Culture').parent().should('contain', 'en-US');
cy.contains('Current UI Culture').parent().should('contain', 'en-US');
});
it('Checks language displays correctly after switching', () => {
//Navigate to edit user and change language
@@ -32,6 +32,7 @@ context('System Information', () => {
cy.get('[alias="editUser"]').click();
cy.get('[name="culture"]').select('string:da-DK', { force: true});
cy.umbracoButtonByLabelKey('buttons_save').click({force: true});
cy.umbracoSuccessNotification().should('be.visible');
openSystemInformation();
//Assert

View File

@@ -13,7 +13,10 @@ context('Languages', () => {
cy.umbracoEnsureLanguageNotExists(language2);
cy.umbracoCreateLanguage(language1, true, '1');
cy.umbracoCreateLanguage(language2, true, '1');
//Enter settings section and wait for everything to load
cy.umbracoSection('settings');
cy.get('.umb-box-content').should('be.visible');
cy.get('li .umb-tree-root:contains("Settings")').should("be.visible");
// Enter language tree and select the language we just created
cy.umbracoTreeItem('settings', ['Languages']).click();
@@ -21,18 +24,16 @@ context('Languages', () => {
// Assert there are 3 languages
cy.get('tbody > tr').should('have.length', 3);
// Delete the Danish language
cy.get('tr').contains('Danish').parents('tr').within(() => {
cy.get('umb-button[label-key="general_delete"]').click()
});
// Delete UK Language
cy.get('umb-button[label-key="general_delete"]').last().click();
cy.umbracoButtonByLabelKey('contentTypeEditor_yesDelete').click();
// Assert there is only 2 language
cy.get('tbody > tr').should('have.length', 3);
// Assert there is only 2 languages
cy.get('tbody > tr').should('have.length', 2);
// Cleanup
cy.umbracoEnsureLanguageNotExists(language1);
cy.umbracoEnsureLanguageNotExists(language2);
});
});
});

View File

@@ -68,7 +68,9 @@ context('Templates', () => {
// Open partial view
cy.umbracoTreeItem("settings", ["Templates", name]).click();
// Edit
cy.get('.ace_text-input').type(edit, {force:true} );
cy.get('.ace_content').type(edit);
cy.get('.ace_content').contains(edit).should('be.visible');
cy.get('.btn-success').should('be.visible')
// Navigate away
cy.umbracoSection('content');
@@ -101,7 +103,9 @@ context('Templates', () => {
// Open partial view
cy.umbracoTreeItem("settings", ["Templates", name]).click();
// Edit
cy.get('.ace_text-input').type(edit, {force:true} );
cy.get('.ace_content').type(edit);
cy.get('.ace_content').contains(edit).should('be.visible');
cy.get('.btn-success').should('be.visible')
// Navigate away
cy.umbracoSection('content');

View File

@@ -14,14 +14,15 @@ import {
});
afterEach(() => {
cy.umbracoEnsureDocumentTypeNameNotExists(tabsDocTypeName)
cy.umbracoEnsureDocumentTypeNameNotExists(tabsDocTypeName);
cy.umbracoEnsureTemplateNameNotExists(tabsDocTypeName);
});
function OpenDocTypeFolder(){
cy.umbracoSection('settings');
// We have to wait in case the execution is slow, otherwise we'll try and click the item before it appears in the UI
cy.get('li .umb-tree-root:contains("Settings")').should("be.visible");
cy.get('.umb-tree-item__inner > .umb-tree-item__arrow').eq(0).click();
cy.get('.umb-tree-item__inner > .umb-tree-item__label').contains(tabsDocTypeName).click();
cy.umbracoTreeItem('settings', ["Document Types", tabsDocTypeName]).click();
}
function CreateDocWithTabAndNavigate(){
@@ -98,8 +99,6 @@ import {
cy.umbracoButtonByLabelKey('buttons_save').click();
//Assert
cy.get('[title="aTab 1"]').should('not.exist');
//Clean
cy.umbracoEnsureDocumentTypeNameNotExists(tabsDocTypeName);
});
it('Delete property in tab', () => {

File diff suppressed because it is too large Load Diff