Skip to content

Commit

Permalink
fix: failing tests from #18372 (#18414)
Browse files Browse the repository at this point in the history
  • Loading branch information
tgriesser authored Oct 8, 2021
1 parent a8b43ee commit 837977f
Show file tree
Hide file tree
Showing 6 changed files with 21 additions and 6 deletions.
4 changes: 2 additions & 2 deletions packages/app/cypress/integration/basic.spec.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
describe('App', () => {
it('resolves the home page', () => {
cy.visit('http://localhost:5556')
cy.get('[href="/__vite__/runner"]').click()
cy.get('[href="/__vite__/settings"]').click()
cy.get('[data-e2e-href="/runner"]').click()
cy.get('[data-e2e-href="/settings"]').click()
})
})
1 change: 1 addition & 0 deletions packages/app/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
"cypress:launch": "cross-env TZ=America/New_York node ../../scripts/cypress open --project ${PWD}",
"cypress:open": "yarn gulp cyOpenAppE2E",
"cypress:run:e2e": "yarn gulp cyRunAppE2E",
"debug": "gulp debug --project ${PWD}",
"dev": "gulp dev --project ${PWD}",
"start": "echo \"run 'yarn dev' from the root\" && exit 1",
"watch": "echo \"run 'yarn dev' from the root\" && exit 1",
Expand Down
1 change: 1 addition & 0 deletions packages/app/src/navigation/SidebarNavigation.vue
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
:to="item.href"
>
<SidebarNavigationRow
:data-e2e-href="item.href"
:active="isActive"
:icon="item.icon"
>
Expand Down
5 changes: 4 additions & 1 deletion packages/app/src/router/router.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,11 @@ import { setupLayouts } from 'virtual:generated-layouts'
export const createRouter = () => {
const routes = setupLayouts(generatedRoutes)

// TODO: clean this up
const historyBase = window.location.href.includes('__vite__') ? '__vite__' : ''

return _createRouter({
history: createWebHistory('/__vite__/'),
history: createWebHistory(historyBase),
routes,
})
}
10 changes: 8 additions & 2 deletions packages/data-context/src/sources/ProjectDataSource.ts
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,14 @@ export class ProjectDataSource {
async isFirstTimeAccessing (projectRoot: string, testingType: 'e2e' | 'component') {
try {
const config = await this.ctx.file.readJsonFile<{ e2e?: object, component?: object }>(path.join(projectRoot, 'cypress.json'))
const type = testingType === 'e2e' ? 'e2e' : 'component'
const overrides = config[type] || {}

// If we have a cypress.json file, even with no overrides, assume that it's not our
// first time accessing (for now, until the config refactor lands)
if (testingType === 'e2e') {
return false
}

const overrides = config.component || {}

return Object.keys(overrides).length === 0
} catch (e) {
Expand Down
6 changes: 5 additions & 1 deletion packages/data-context/src/sources/WizardDataSource.ts
Original file line number Diff line number Diff line change
Expand Up @@ -135,10 +135,14 @@ const LanguageNames: Record<WizardCodeLanguage, string> = {
}

export const wizardGetConfigCodeE2E = (opts: GetCodeOptsE2E): string | null => {
return `{
const exportStatement =
opts.lang === 'js' ? 'module.exports = {' : 'export default {'

return `${exportStatement}{
e2e: {
viewportHeight: 660,
viewportWidth: 1000,
}
}`
}

Expand Down

0 comments on commit 837977f

Please sign in to comment.