Files
Umbraco-CMS/tests/Umbraco.Tests.AcceptanceTest
Nhu Dinh 71199b3323 V14 Added acceptance tests for Data Type - p2 (#15873)
* Added tests for Multi URL Picker

* Added tests for Multiple Media Picker

* Added tests for RichTextEditor - not done

* Added tests for Richtext Editor

* Added tests for Content Picker

* Added tests for Tags

* Fixed the tests for Approved Color

* Added tests for Checkbox list

* Fixed tests for DataTypeFolder

* Fixed tests for DatePicker due to api changes

* Added tests for Dropdown

* Fixed tests for ImageCropper due to ui changes

* Added tests for List View

* Added tests for Multiple Media Picker

* Added tests for RichTextEditor

* Added tests for Radiobox

* Added tests for True false

* Added tests for Upload

* Bumped version of test helper

* Bumped version

* Fixed code format

* Removed hard waits

* Updated tests for Template and Partial View - not done

* Added insert section tests

* Used defaultTemplateContent to avoid duplicate code

* Added insert section tests

* Added missing tests for Partial View

* Added missing tests for Scripts

* Added missing tests for Stylesheet

* Added missing tests for Template

* Changed method's name due to test helper changes

* Added skip tests

* Bumped version of test helper

* Reversed waits

* Changed createThreeDotsButton to createButton due to UI changes

* Removed List View - Members tests as the UI changes

* Added more waits

* Removed unnecessary waits

* Added and removed skip tests

* Fixed and added missing tests

* Changed name of test file for Media Picker, Image Media Picker, Multiple Media Picker and Multiple Image Media Picker

* Updated and added missing tests for Data Types

* Bumped version of test helper

* Changed configuration of smokeTest to make all DataType tests run in the pipeline. It should remove before merging

* Added skip for all tests of Numeric as there is no configuration now

* Removed test.describle

* Change syntax of smoke tag

* Removed duplicate code

* Added the tests that avoid the minimum value is greater than the maximum value

* Added the tests that avoid the min height value is greater than the max height value

* Added test for adding available block to RTE

* Remove skip and add more tests

* Added tests for create an empty data type

* Fixed the create data type tests

* Added tests for changing setting a data type

* Updated the test for creating a new data type

* Added skip tests due to UI changes

* Skipped unhappy tests as the front-end is not ready

* Changed the way to create a new stylesheet

* Updated method names due to test helpers changes

* Bumped version of test helper

* Updated expected result

* Updated method name due to UI changes

* Bumped version of test helper

* Bumped version of test helper

* Fixed add start node tests

* Added skip tests

* Updated the expected result

* Fixed add layout tests

* Added more waits

* Add skip tests

* Removed , in the objects and renamed some tests

* Added tests for updating the option

* Fixed naming and removed unnecessary commas

* Update tests/Umbraco.Tests.AcceptanceTest/package.json

Co-authored-by: Andreas Zerbst <73799582+andr317c@users.noreply.github.com>

---------

Co-authored-by: Andreas Zerbst <andr317c@live.dk>
Co-authored-by: Andreas Zerbst <73799582+andr317c@users.noreply.github.com>
2024-06-06 14:36:49 +02:00
..
2024-04-22 13:58:05 +07:00

Umbraco Acceptance Tests

You can watch a video following these instructions here and a longer UmbraCollab recording here. Make sure to use the latest recommended contribution branch rather than v10 that's mentioned in the video. Alternatively, follow along the instructions below.

Prerequisites

  • NodeJS 16+
  • A running installed Umbraco on url: https://localhost:44339 (Default development port)
    • Install using a SqlServer/LocalDb as the tests execute too fast for Sqlite to handle.

Getting started

The tests are located in the project/folder as Umbraco.Tests.AcceptanceTests. Make sure you run npm ci & npx playwright install in that folder, or let your IDE do that.

The script will ask you to enter the username and password for a superadmin user of your Umbraco CMS.

Executing tests

There are two npm scripts that can be used to execute the test:

  1. npm run test
    • Executes the tests headless.
  2. npm run ui
    • Executes the tests in a browser handled by a playwright application.

In case of errors it is recommended to use await page.pause() so you can step through your test.

Executing single tests

If you wish to run a single test, which may be helpful when writing tests you can use the following command. As before, you need to run these tests in the 'tests/Umbraco.Tests.AcceptanceTest' folder.

npx playwright test <testname.ts>

For example to run the Login Test,

npx playwright test tests/DefaultConfig/Login/Login.spec.ts

Executing tests in UI Mode

If you would like to have an overview of all your test, to be able to see all the steps in the tests being executed and you would like to be able to run all of your tests one after another, and maybe only just one test. Then you should use UI Mode. As before, you need to run these commands in the 'tests/Umbraco.Tests.AcceptanceTest' folder.

npx playwright test --ui

You can also specify which tests you want to run

npx playwright test --ui tests/DefaultConfig

When entering UI Mode, you might only able to see the authenticate test. To fix this you will need to click on the 'Projects' in UI mode and select 'Chromium'. After you've done this. You should be able to see all your tests for the location you specified when running the command.

Environment Configuration

The environment configuration is begin setup by the npm installation script. This results in the creation of this file: .env. This file is already added to .gitignore and can contain values that are different for each developer machine.

The file has the following content:

UMBRACO_USER_LOGIN=email for superadmin
UMBRACO_USER_PASSWORD=password for superadmin
URL=https://localhost:44339

You can change this if you like or run the config script to reset the values, type "npm run config" in your terminal.

Documentation

For further documentation on Playwright, see the Playwright documentation.