mirror of
https://github.com/overleaf/overleaf.git
synced 2024-11-21 20:47:08 -05:00
Merge pull request #20117 from overleaf/jpa-server-pro-test-local
[server-pro] tests: add support for running email tests on Macs GitOrigin-RevId: 19a206f4ee70d43624094dd8da87091063d631a0
This commit is contained in:
parent
16eb99ee48
commit
3c5bd060f4
6 changed files with 25 additions and 17 deletions
|
@ -14,7 +14,10 @@ export COMPOSE_PROJECT_NAME ?= test
|
|||
|
||||
test-e2e-native:
|
||||
docker compose -f docker-compose.yml -f docker-compose.native.yml up --no-log-prefix sharelatex host-admin -d
|
||||
CYPRESS_ADMIN_CLIENT_URL='http://localhost:8081' CYPRESS_GIT_BRIDGE_PUBLIC_HOST='localhost' CYPRESS_SAML_PUBLIC_HOST='localhost:8082' CYPRESS_OVERLEAF_PUBLIC_HOST='localhost:8082' npm run cypress:open
|
||||
CYPRESS_HOST_ADMIN_URL='http://localhost:8081' \
|
||||
CYPRESS_SAML_URL='http://localhost:8082' \
|
||||
CYPRESS_MAILTRAP_URL='http://localhost:8083' \
|
||||
npm run cypress:open
|
||||
|
||||
test-e2e:
|
||||
docker compose up --no-log-prefix --exit-code-from=e2e e2e
|
||||
|
|
|
@ -19,3 +19,7 @@ services:
|
|||
environment:
|
||||
SAML_BASE_URL_PATH: 'http://localhost:8082/simplesaml/'
|
||||
SAML_TEST_SP_LOCATION: 'http://localhost/saml/callback'
|
||||
|
||||
mailtrap:
|
||||
ports:
|
||||
- 127.0.0.1:8083:80
|
||||
|
|
|
@ -3,15 +3,14 @@ import { createProject } from './helpers/project'
|
|||
|
||||
describe('SAML', () => {
|
||||
if (isExcludedBySharding('PRO_CUSTOM_1')) return
|
||||
const overleafPublicHost = Cypress.env('OVERLEAF_PUBLIC_HOST') || 'sharelatex'
|
||||
const samlPublicHost = Cypress.env('SAML_PUBLIC_HOST') || 'saml'
|
||||
const samlURL = Cypress.env('SAML_URL') || 'http://saml'
|
||||
|
||||
startWith({
|
||||
pro: true,
|
||||
vars: {
|
||||
EXTERNAL_AUTH: 'saml',
|
||||
OVERLEAF_SAML_ENTRYPOINT: `http://${samlPublicHost}/simplesaml/saml2/idp/SSOService.php`,
|
||||
OVERLEAF_SAML_CALLBACK_URL: `http://${overleafPublicHost}/saml/callback`,
|
||||
OVERLEAF_SAML_ENTRYPOINT: `${samlURL}/simplesaml/saml2/idp/SSOService.php`,
|
||||
OVERLEAF_SAML_CALLBACK_URL: `${Cypress.config().baseUrl}/saml/callback`,
|
||||
OVERLEAF_SAML_ISSUER: 'sharelatex-test-saml',
|
||||
OVERLEAF_SAML_IDENTITY_SERVICE_NAME: 'SAML Test Server',
|
||||
OVERLEAF_SAML_EMAIL_FIELD: 'email',
|
||||
|
@ -27,7 +26,7 @@ describe('SAML', () => {
|
|||
cy.visit('/')
|
||||
cy.findByText('Log in with SAML Test Server').click()
|
||||
|
||||
cy.origin(`http://${samlPublicHost}`, () => {
|
||||
cy.origin(samlURL, () => {
|
||||
cy.get('input[name="username"]').type('sally')
|
||||
cy.get('input[name="password"]').type('sally123')
|
||||
cy.get('button[type="submit"]').click()
|
||||
|
|
|
@ -20,8 +20,7 @@ describe('git-bridge', function () {
|
|||
V1_HISTORY_URL: 'http://sharelatex:3100/api',
|
||||
}
|
||||
|
||||
const gitBridgePublicHost =
|
||||
Cypress.env('GIT_BRIDGE_PUBLIC_HOST') || 'sharelatex'
|
||||
const gitBridgePublicHost = new URL(Cypress.config().baseUrl!).host
|
||||
|
||||
describe('enabled in Server Pro', function () {
|
||||
if (isExcludedBySharding('PRO_CUSTOM_1')) return
|
||||
|
|
|
@ -12,16 +12,19 @@ export function openEmail<T>(
|
|||
) {
|
||||
const runnerS = runner.toString()
|
||||
cy.origin(
|
||||
'http://mailtrap',
|
||||
Cypress.env('MAILTRAP_URL') || 'http://mailtrap',
|
||||
{ args: { args, runnerS, subject } },
|
||||
({ args, runnerS, subject }) => {
|
||||
cy.visit('/')
|
||||
cy.get('input[name="_user"]').type('mailtrap')
|
||||
cy.get('input[name="_pass"]').type('password-for-mailtrap')
|
||||
cy.get('button[type="submit"]').click()
|
||||
cy.log('mailtrap login is flaky in cypress, submit again')
|
||||
cy.get('input[name="_pass"]').type('password-for-mailtrap')
|
||||
cy.get('button[type="submit"]').click()
|
||||
cy.url().then(url => {
|
||||
if (!url.includes('?_task=login')) return
|
||||
cy.log('mailtrap login is flaky in cypress, submit again')
|
||||
cy.get('input[name="_pass"]').type('password-for-mailtrap')
|
||||
cy.get('button[type="submit"]').click()
|
||||
})
|
||||
// Use force as the subject is partially hidden
|
||||
cy.contains(subject).click({ force: true })
|
||||
cy.log('wait for iframe loading')
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
const hostAdminUrl = Cypress.env('ADMIN_CLIENT_URL') || 'http://host-admin'
|
||||
const hostAdminURL = Cypress.env('HOST_ADMIN_URL') || 'http://host-admin'
|
||||
|
||||
export async function dockerCompose(cmd: string, ...args: string[]) {
|
||||
return await fetchJSON(`${hostAdminUrl}/docker/compose/${cmd}`, {
|
||||
return await fetchJSON(`${hostAdminURL}/docker/compose/${cmd}`, {
|
||||
method: 'POST',
|
||||
body: JSON.stringify({
|
||||
args,
|
||||
|
@ -16,7 +16,7 @@ export async function reconfigure({
|
|||
withDataDir = false,
|
||||
resetData = false,
|
||||
}): Promise<{ previousConfigServer: string }> {
|
||||
return await fetchJSON(`${hostAdminUrl}/reconfigure`, {
|
||||
return await fetchJSON(`${hostAdminURL}/reconfigure`, {
|
||||
method: 'POST',
|
||||
body: JSON.stringify({
|
||||
pro,
|
||||
|
@ -68,7 +68,7 @@ export async function runScript({
|
|||
script: string
|
||||
args?: string[]
|
||||
}) {
|
||||
return await fetchJSON(`${hostAdminUrl}/run/script`, {
|
||||
return await fetchJSON(`${hostAdminURL}/run/script`, {
|
||||
method: 'POST',
|
||||
body: JSON.stringify({
|
||||
cwd,
|
||||
|
@ -79,7 +79,7 @@ export async function runScript({
|
|||
}
|
||||
|
||||
export async function getRedisKeys() {
|
||||
const { stdout } = await fetchJSON(`${hostAdminUrl}/redis/keys`, {
|
||||
const { stdout } = await fetchJSON(`${hostAdminURL}/redis/keys`, {
|
||||
method: 'GET',
|
||||
})
|
||||
return stdout.split('\n')
|
||||
|
|
Loading…
Reference in a new issue