check-route-required-field-flag.cy.js 2.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051
  1. /*
  2. * Licensed to the Apache Software Foundation (ASF) under one or more
  3. * contributor license agreements. See the NOTICE file distributed with
  4. * this work for additional information regarding copyright ownership.
  5. * The ASF licenses this file to You under the Apache License, Version 2.0
  6. * (the "License"); you may not use this file except in compliance with
  7. * the License. You may obtain a copy of the License at
  8. *
  9. * http://www.apache.org/licenses/LICENSE-2.0
  10. *
  11. * Unless required by applicable law or agreed to in writing, software
  12. * distributed under the License is distributed on an "AS IS" BASIS,
  13. * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  14. * See the License for the specific language governing permissions and
  15. * limitations under the License.
  16. */
  17. /* eslint-disable no-undef */
  18. context('Check Route Required Field Flag', () => {
  19. beforeEach(() => {
  20. cy.login();
  21. });
  22. it('should exist required flag for Route name', function () {
  23. cy.visit('/');
  24. cy.contains('Route').click();
  25. cy.contains('Create').click();
  26. cy.get('label[title="Name"]').then(($els) => {
  27. // get Window reference from element
  28. const win = $els[0].ownerDocument.defaultView;
  29. // use getComputedStyle to read the pseudo selector
  30. const before = win.getComputedStyle($els[0], 'before');
  31. // read the value of the `content` CSS property
  32. const contentValue = before.getPropertyValue('content');
  33. // the returned value will have double quotes around it, but this is correct
  34. expect(contentValue).to.eq('"*"');
  35. });
  36. });
  37. it('should exist required flag for Route path', function () {
  38. cy.visit('/');
  39. cy.contains('Route').click();
  40. cy.contains('Create').click();
  41. cy.get('label[title="Path"]').then(($els) => {
  42. const win = $els[0].ownerDocument.defaultView;
  43. const before = win.getComputedStyle($els[0], 'before');
  44. const contentValue = before.getPropertyValue('content');
  45. expect(contentValue).to.eq('"*"');
  46. });
  47. });
  48. });