[server-pro] tests: backport changes from SaaS E2E tests (#23921)

* [server-pro] tests: add helper for gitURL

* [server-pro] tests: avoid hard-coding URL scheme/origin

* [server-pro] tests: fix typo in query selector

* [server-pro] tests: fix spelling of GitHub

* [server-pro] tests: double down on matching email in body

* [server-pro] tests: speed up session resumption

* [server-pro] tests: use a single project in editor spec

* [server-pro] drop check on started recompile

The labels changed between versions and making it configurable is too
verbose.

GitOrigin-RevId: d1ace3b534f28c65b8e20c808bac12268f26fa4d
This commit is contained in:
Jakob Ackermann
2025-02-27 09:06:03 +00:00
committed by Copybot
parent 4645d38eb1
commit ceab650af8
6 changed files with 220 additions and 134 deletions
+12 -11
View File
@@ -22,7 +22,12 @@ describe('git-bridge', function () {
V1_HISTORY_URL: 'http://sharelatex:3100/api',
}
const gitBridgePublicHost = new URL(Cypress.config().baseUrl!).host
function gitURL(projectId: string) {
const url = new URL(Cypress.config().baseUrl!)
url.username = 'git'
url.pathname = `/git/${projectId}`
return url
}
describe('enabled in Server Pro', function () {
if (isExcludedBySharding('PRO_CUSTOM_1')) return
@@ -85,9 +90,7 @@ describe('git-bridge', function () {
cy.findByText('Git').click()
cy.findByTestId('git-bridge-modal').within(() => {
cy.get('@projectId').then(id => {
cy.get('code').contains(
`git clone http://git@${gitBridgePublicHost}/git/${id}`
)
cy.get('code').contains(`git clone ${gitURL(id.toString())}`)
})
cy.findByRole('button', {
name: 'Generate token',
@@ -101,9 +104,7 @@ describe('git-bridge', function () {
cy.findByText('Git').click()
cy.findByTestId('git-bridge-modal').within(() => {
cy.get('@projectId').then(id => {
cy.get('code').contains(
`git clone http://git@${gitBridgePublicHost}/git/${id}`
)
cy.get('code').contains(`git clone ${gitURL(id.toString())}`)
})
cy.findByText('Generate token').should('not.exist')
cy.findByText(/generate a new one in Account Settings/)
@@ -192,9 +193,7 @@ describe('git-bridge', function () {
cy.findByText('Git').click()
cy.get('@projectId').then(projectId => {
cy.findByTestId('git-bridge-modal').within(() => {
cy.get('code').contains(
`git clone http://git@${gitBridgePublicHost}/git/${projectId}`
)
cy.get('code').contains(`git clone ${gitURL(projectId.toString())}`)
})
cy.findByRole('button', {
name: 'Generate token',
@@ -234,9 +233,11 @@ describe('git-bridge', function () {
dir,
fs,
}
const url = gitURL(projectId.toString())
url.username = '' // basic auth is specified separately.
const httpOptions = {
http,
url: `http://sharelatex/git/${projectId}`,
url: url.toString(),
headers: {
Authorization: `Basic ${Buffer.from(`git:${token}`).toString('base64')}`,
},