Skip to content
Snippets Groups Projects

Fix feed test.

Merged ilyaukin requested to merge IL/feed-tests into 2.0.x
4 files
+ 144
72
Compare changes
  • Side-by-side
  • Inline
Files
4
@@ -21,27 +21,29 @@ import atkConfig from '../../../cypress.atk.config';
import qaUserAccounts from '../../data/qaUsers.json';
describe('Feed Tests', () => {
const ctx = {
feedTypeName: undefined,
}
//
// Create a new feed definition, import fixture, validate that data is in the database.
//
it('(ATK-PW-1180) Creates the feed type settings',{ tags: ['@ATK-PW-1180', '@feeds', 'alters-db'] }, () => {
const testId = 'ATK-CY-1110';
it('(ATK-PW-1180) Creates the feed type settings', { tags: ['@ATK-PW-1180', '@feeds', '@alters-db'] }, () => {
const testId = 'ATK-CY-1180';
const uniqueToken = atkUtilities.createRandomString(6);
const termName = `${testId}: ${uniqueToken}`;
const feedTypeName = `${testId}: ${uniqueToken}`;
// Log in with the administrator account.
// Assuming logInViaForm is adapted for cypress.
cy.logInViaForm(qaUserAccounts.admin);
cy.visit('https://drupalatk:8890/admin/structure');
cy.visit(atkConfig.feedTypeAddUrl);
//
// Add a Feed type
//
cy.contains('Feed types').click();
cy.contains('Add feed type').click();
// Fill in the fields.
cy.contains('Name').type('Import with url');
cy.contains('Name').type(feedTypeName);
cy.contains('Description').type('Import feeds');
cy.contains('Explanation').type('ATK Feeds Test');
@@ -65,33 +67,31 @@ describe('Feed Tests', () => {
// Save the configured feed type.
cy.contains('Save and add mappings').click();
ctx.feedTypeName = feedTypeName
// Create mapping for imports
cy.get('#edit-add-target').first().select('Title (title)');
cy.get('select[data-drupal-selector="edit-mappings-0-map-value-select"]').select('Title');
// Save mapping structure
cy.get('[data-drupal-selector="edit-actions-submit"]').click();
cy.get('[data-drupal-selector="edit-actions-submit"]').click();
});
});
it('(ATK-PW-1181) Passes and imports items', { tags: ['@ATK-PW-1181', '@feeds', 'alters-db'] }, () => {
// ctx.feedTypeName must exist to run this test.
cy.wrap(ctx.feedTypeName).should('not.be.undefined', { message: 'Feed type must exist for this test' })
describe('Add Feed Url', () => {
it('(ATK-PW-1181) passes and imports items', { tags: ['@ATK-PW-1181', '@feeds', 'alters-db'] }, () => {
// Login via admin account.
cy.logInViaForm(qaUserAccounts.admin);
cy.visit('/admin/content');
//
// Add a new feed into the existing feed type.
//
cy.get('button[aria-label="Tabs display toggle"]').click();
cy.contains('Feeds').click();
cy.contains('Add feed').click();
cy.visit(atkConfig.feedAddUrl)
// Find the existing feed type.
// Select the feed that you have created.
cy.contains('Import with url').click();
cy.contains('a:visible', ctx.feedTypeName).click();
cy.contains('Title').type('nytimes rss business');
//
@@ -101,5 +101,37 @@ describe('Add Feed Url', () => {
// Save and export the feed.
cy.contains('Save and import').click();
cy.contains('nytimes rss business has been created.')
// Validate that content items are created.
cy.visit('admin/content')
cy.contains('tr', 'Anonymous')
});
after(() => {
//
// Clean up.
//
cy.visit('admin/content/feed')
cy.contains('tr', ctx.feedTypeName).then(($el) => {
if ($el.length) {
const deleteItemsUrl = $el.find('a:contains("Delete items")').attr('href')
const deleteUrl = $el.find('[aria-label^="Delete nytimes"]').attr('href')
cy.visit(deleteItemsUrl)
cy.get('#edit-submit').click({ force: true })
cy.get('h2[id^="status"]') // Wait to finish delete
cy.visit(deleteUrl)
cy.get('#edit-submit').click({ force: true })
}
})
cy.visit('admin/structure/feeds')
cy.contains('tr', ctx.feedTypeName).then(($el) => {
if ($el.length) {
const deleteUrl = $el.find('[aria-label^="Delete ATK"]').attr('href')
cy.visit(deleteUrl)
cy.get('#edit-submit').click({ force: true })
}
})
})
});
\ No newline at end of file
Loading