@@ -22,9 +22,7 @@ const { JSDOM } = require('jsdom');
22
22
const path = require ( 'path' ) ;
23
23
const TestBed = require ( '../../../../../test/test-bed' ) ;
24
24
25
- const mainBundleScriptRegex = / i n d e x .* .b u n d l e \. j s / ;
26
-
27
- xdescribe ( 'Build Greenwood With: ' , function ( ) {
25
+ describe ( 'Build Greenwood With: ' , function ( ) {
28
26
const LABEL = 'Default Greenwood Configuration and Workspace w/Custom App Template' ;
29
27
let setup ;
30
28
@@ -40,85 +38,8 @@ xdescribe('Build Greenwood With: ', function() {
40
38
await setup . runGreenwoodCommand ( 'build' ) ;
41
39
} ) ;
42
40
43
- runSmokeTest ( [ 'public' , 'not-found' , 'hello' ] , LABEL ) ;
44
-
45
- describe ( 'Custom Index (Home) page' , function ( ) {
46
- const indexPageHeading = 'Greenwood' ;
47
- const indexPageBody = 'This is the home page built by Greenwood. Make your own pages in src/pages/index.js!' ;
48
- let dom ;
49
-
50
- beforeEach ( async function ( ) {
51
- dom = await JSDOM . fromFile ( path . resolve ( this . context . publicDir , 'index.html' ) ) ;
52
- } ) ;
53
-
54
- it ( 'should have the default config title in the <title> tag in the <head>' , function ( ) {
55
- const title = dom . window . document . querySelector ( 'head title' ) . textContent ;
56
-
57
- expect ( title ) . to . be . equal ( 'My App' ) ;
58
- } ) ;
59
-
60
- it ( 'should have one <script> tag in the <body> for the main bundle' , function ( ) {
61
- const scriptTags = dom . window . document . querySelectorAll ( 'body > script' ) ;
62
- const bundledScript = Array . prototype . slice . call ( scriptTags ) . filter ( script => {
63
- const src = script . src . replace ( 'file:///' , '' ) ;
64
-
65
- return mainBundleScriptRegex . test ( src ) ;
66
- } ) ;
67
-
68
- expect ( bundledScript . length ) . to . be . equal ( 1 ) ;
69
- } ) ;
70
-
71
- it ( 'should have one <script> tag in the <body> for the main bundle loaded with async' , function ( ) {
72
- const scriptTags = dom . window . document . querySelectorAll ( 'body > script' ) ;
73
- const bundledScript = Array . prototype . slice . call ( scriptTags ) . filter ( script => {
74
- const src = script . src . replace ( 'file:///' , '' ) ;
75
-
76
- return mainBundleScriptRegex . test ( src ) ;
77
- } ) ;
78
-
79
- expect ( bundledScript [ 0 ] . getAttribute ( 'async' ) ) . to . be . equal ( '' ) ;
80
- } ) ;
81
-
82
- it ( 'should have one <script> tag for Apollo state' , function ( ) {
83
- const scriptTags = dom . window . document . querySelectorAll ( 'script' ) ;
84
- const bundleScripts = Array . prototype . slice . call ( scriptTags ) . filter ( script => {
85
- return script . getAttribute ( 'data-state' ) === 'apollo' ;
86
- } ) ;
87
-
88
- expect ( bundleScripts . length ) . to . be . equal ( 1 ) ;
89
- } ) ;
90
-
91
- it ( 'should have only one <script> tag in the <head>' , function ( ) {
92
- const scriptTags = dom . window . document . querySelectorAll ( 'head > script' ) ;
93
-
94
- expect ( scriptTags . length ) . to . be . equal ( 1 ) ;
95
- } ) ;
96
-
97
- it ( 'should have a router outlet tag in the <body>' , function ( ) {
98
- const outlet = dom . window . document . querySelectorAll ( 'body app-root' ) ;
99
-
100
- expect ( outlet . length ) . to . be . equal ( 1 ) ;
101
- } ) ;
102
-
103
- // no 404 route in our custom app-template.js, like greenwood does
104
- it ( 'should have the correct route tags in the <body>' , function ( ) {
105
- const routes = dom . window . document . querySelectorAll ( 'body lit-route' ) ;
106
-
107
- expect ( routes . length ) . to . be . equal ( 2 ) ;
108
- } ) ;
109
-
110
- it ( 'should have the expected heading text within the index page in the public directory' , function ( ) {
111
- const heading = dom . window . document . querySelector ( 'h3' ) . textContent ;
112
-
113
- expect ( heading ) . to . equal ( indexPageHeading ) ;
114
- } ) ;
115
-
116
- it ( 'should have the expected paragraph text within the index page in the public directory' , function ( ) {
117
- let paragraph = dom . window . document . querySelector ( 'p' ) . textContent ;
118
-
119
- expect ( paragraph ) . to . equal ( indexPageBody ) ;
120
- } ) ;
121
- } ) ;
41
+ // TODO runSmokeTest(['public', 'not-found', 'hello'], LABEL);
42
+ runSmokeTest ( [ 'public' , 'index' ] , LABEL ) ;
122
43
123
44
describe ( 'Custom App Template' , function ( ) {
124
45
before ( async function ( ) {
@@ -130,7 +51,7 @@ xdescribe('Build Greenwood With: ', function() {
130
51
} ) ;
131
52
132
53
it ( 'should have the specific element we added as part of our custom app template' , function ( ) {
133
- const customParagraph = dom . window . document . querySelector ( 'p#custom-app-template ' ) . textContent ;
54
+ const customParagraph = dom . window . document . querySelector ( 'body p ' ) . textContent ;
134
55
135
56
expect ( customParagraph ) . to . equal ( 'My Custom App Template' ) ;
136
57
} ) ;
0 commit comments