Because end-to-end accessibility tests are mainly meant for end-to-end testing, where we have to see the actual layout and we can do the testing on actual layout, similar to how users perceive your application. So for end-to-end tests, for xCore, it has a package that goes with Playwright, Playwright.js, which is my favorite end-to-end testing framework because it's very fast and free and it's open source project. And it can run in a lot of different languages, not just JavaScript.
For Playwright, it also has a dedicated section for accessibility testing, how to integrate xCore in accessibility testing. So to use xCore in Playwright, we will install xCore xPlaywright package and we'll just import the xBuilder, which is the class function that gives us the instance, include only wrap around the page, and then we can check, we can analyze, we can trigger the function, analyze on it. So first, we will go to, we will navigate our test to the page that the target page in this test is a homepage and then we will wait for the xBuilder to scan and analyze the page instance that we will just go to, and then we finally assert if there's any evaluation or not. Okay, so using xCore and Playwright, we can cover the real-world browser testing, including different devices, different browsers, and see if it actually works and how it looks. We can also extend it, not just see if there's any violation, we can also extend it whether a component is visible, an element is visible, an element is focusable, because it's mimicking user actual experience.
So when you can also see if an event handler, when you click on it, what will happen, the dialogs open as expected on the page level accessibility rule check and you can also do the third-party widget app validations and color contrast, full color contrast, and add fully automated with predefined set of rule. So that is xCore with Playwright, and this is the example of how the violation would look. It will be an array of violations where it will give you some detail, the impact level, and all the information about the elements that have the violation. Okay, and that is xCore with Playwright as end-to-end test and also as unit test.
What about adding accessibility as part of the CI workflow? So if you're using GitLab, there's a very nice feature for accessibility testing which is accessibility testing workflow. It's included in your GitLab workflow. What you need to do is just download the template and include it in your applications, the YARN template as the workflow, it's on workflow for accessibility, then include it into your main workflow YARN plate. In here, you can define an accessibility stage and we can also provide some variables including all the URL you want to test for your application on accessibility and include the template. The template is working and in the back it will be on top of PA11Y framework for end-to-end testing, and this framework is a very convenient framework that has a lot of different packages that allow you to create your own custom dashboard for accessibility where you can see the violation and different level compliance and it's open source of course. So that is about GitLab CI workflow.
We're talking a lot about accessibility testing, automated testing, manual testing, what we can use to put an end-to-end and unit test. So where do we plug this in the CI CD workflow if we don't use GitLab workflow? What is CI CD? So CI CD stands for continuous integration and continuous deployment. So this is an example of how the flow goes between code development to continuous integration and continuous deployment. So literally as you can see here in the code development, we have a single source control where all the code will stay there and then developer can work on top of it with branches and merge back to the source. It can be GitHub, it can be GitLab, it can be Azure DevOps repo which they build on top of Git repository and the four levels of CI CD integration, the source, the build, the test, up the deploy.
What in the source we're talking about is the course version control. We also have some pipeline run on commit up here to make sure that nothing break or uses unit test whoops before we merge it back to source so we can control the quality of the source code. We also have coding standard operations such as LinkedIn, such as checklist, such as code review. All of this will make sure that our code is at least at a certain standard before we move to build. So build, we combine the actual source code into the actual consumable package such as NuGet package, such as ESC, such as JAR and a OS minify file so that we can deploy to the cloud for a web application. And in this build version, we're going to run a set of unit tests on top of the ready source code so we know that the source is stable enough to build. And then after we build, we will deploy these to a testing environment and then on that, we can perform more complex tests such as end-to-end test, integration test, performance and security test.
Comments