Files
Verso/services/web/test/frontend/features/group-management/components/domain-capture.spec.tsx
T
Jessica Lawshe 2389674cca Merge pull request #27894 from overleaf/ii-domain-capture-join-button
[web] Domain capture join button

GitOrigin-RevId: aec6033f6776e9384c77fe0ef609c65b13a90f87
2025-08-20 08:06:21 +00:00

81 lines
2.4 KiB
TypeScript
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
import DomainCapture from '../../../../../modules/group-settings/frontend/js/components/domain-capture'
describe('<DomainCapture />', function () {
beforeEach(function () {
this.email = 'user@example.com'
this.groupName = 'test-group'
this.ssoInitPath = '/sso/init/path'
cy.window().then(win => {
win.metaAttributesCache.set('ol-user', {
email: this.email,
first_name: 'Nice',
last_name: 'Wombat',
})
win.metaAttributesCache.set('ol-email', this.email)
win.metaAttributesCache.set('ol-groupName', this.groupName)
win.metaAttributesCache.set('ol-ssoInitPath', this.ssoInitPath)
})
cy.mount(<DomainCapture />)
})
it('renders the heading', function () {
cy.findByRole('heading', {
name: new RegExp(
`your organization ${this.groupName} now has an Overleaf enterprise license`,
'i'
),
})
})
it('renders the description', function () {
cy.findByTestId('domain-capture-signed-in-as')
.invoke('text')
.should(
'match',
new RegExp(`you are currently signed in as ${this.email}`, 'i')
)
cy.findByText(
new RegExp(
`because you are using your organization email on Overleaf, ${this.groupName} would like you to take one of the following actions`,
'i'
)
)
})
it('renders the join group card', function () {
cy.findByTestId('domain-capture-join-card').within(() => {
cy.findByRole('heading', {
name: new RegExp(`join ${this.groupName} enterprise group`, 'i'),
})
cy.findByText(
/get access to enterprise features and benefits provided by your organization/i
)
cy.findByText(/youll continue to have access to all of your projects/i)
cy.findByRole('link', { name: /join/i }).should(
'have.attr',
'href',
this.ssoInitPath
)
})
})
it('renders the remove company email card', function () {
cy.findByTestId('domain-capture-remove-email-card').within(() => {
cy.findByRole('heading', {
name: /remove your company email from your personal account/i,
})
cy.findByText(
/switch to a personal email to keep your accounts separate/i
)
cy.findByText(/youll continue to have access to all of your projects/i)
cy.findByRole('link', { name: /change your email/i }).should(
'have.attr',
'href',
'/user/settings'
)
})
})
})