-
Notifications
You must be signed in to change notification settings - Fork 31
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- bitly calls to shorten url are stubbed - toggle short url might be a bit flaky - remove old spec file
- Loading branch information
1 parent
bc97b9e
commit 2e5957a
Showing
2 changed files
with
50 additions
and
83 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,50 @@ | ||
import Share from './Share.vue' | ||
import I18nBuilder from '@/i18n/i18n-builder' | ||
import store from '@/store/store' | ||
|
||
const mockUrl = 'https://mock_url_123.test' | ||
|
||
describe('<Share />', () => { | ||
beforeEach(() => { | ||
cy.viewport(600, 562) | ||
cy.mount(Share, { | ||
i18n: I18nBuilder.build(), store: store, propsData: { | ||
url: mockUrl | ||
} | ||
}) | ||
}) | ||
it('renders, opens and closes modal', () => { | ||
cy.get('.share-container') | ||
cy.get('.share-modal').should('not.exist') | ||
cy.get('.open-share-btn').click() | ||
cy.get('.share-modal').should('be.visible') | ||
cy.get('.share-modal .box-header .close').click() | ||
cy.get('.share-modal').should('not.exist') | ||
}) | ||
it('shows share link correctly, iframe code and ', () => { | ||
cy.get('.open-share-btn').click() | ||
cy.get('input[type="text"]').should('have.value', mockUrl) | ||
}) | ||
it('shows iframe code correctly', () => { | ||
cy.get('.open-share-btn').click() | ||
const locale = 'en-us' | ||
store.commit('mapSettings', {locale: locale}) | ||
let iframeCode = `<iframe style='border:none' width='100%' height='100%' src="${mockUrl}/embed/${locale}"></iframe>` | ||
cy.get('textarea').should('have.value', iframeCode) | ||
}) | ||
it('toggles short url', () => { | ||
cy.get('.open-share-btn').click() | ||
cy.intercept('GET', '**/v3/shorten*', (req) => { | ||
req.reply({ | ||
'status_code': 200, | ||
'data': { | ||
'url': 'https://bit.ly/3ZHDUoZ', | ||
} | ||
}) | ||
}) | ||
cy.get('.toggle-short-url').click() | ||
cy.get('input[type="text"]').should('contain.value', 'https://bit.ly/') | ||
cy.get('.toggle-short-url').click() | ||
cy.get('input[type="text"]').should('have.value', mockUrl) | ||
}) | ||
}) |
This file was deleted.
Oops, something went wrong.